fix build with recent changes/gcc 6.3.0
[AROS-Contrib.git] / arospdf / xpdf / XPDFCore.h
blob84f27ee6fe190e746c2f1b65738782f221fd4266
1 //========================================================================
2 //
3 // XPDFCore.h
4 //
5 // Copyright 2002-2003 Glyph & Cog, LLC
6 //
7 //========================================================================
9 #ifndef XPDFCORE_H
10 #define XPDFCORE_H
12 #include <aconf.h>
14 #ifdef USE_GCC_PRAGMAS
15 #pragma interface
16 #endif
18 #include "gtypes.h"
19 #include "gfile.h" // for time_t
20 #include "SplashTypes.h"
21 #include "PDFCore.h"
23 class GString;
24 class BaseStream;
25 class PDFDoc;
26 class LinkAction;
28 //------------------------------------------------------------------------
30 #define xMaxRGBCube 6 // max size of RGB color cube
32 //------------------------------------------------------------------------
33 // XPDFCore
34 //------------------------------------------------------------------------
36 class XPDFCore: public PDFCore {
37 public:
39 // Create viewer core inside <parentWidgetA>.
40 XPDFCore(//Widget shellA, Widget parentWidgetA,
41 SplashColorPtr paperColorA, Gulong paperPixelA,
42 Gulong mattePixelA, GBool fullScreenA, GBool reverseVideoA,
43 GBool installCmap, int rgbCubeSizeA);
45 ~XPDFCore();
47 //----- loadFile / displayPage / displayDest
49 // Load a new file. Returns pdfOk or error code.
50 virtual int loadFile(GString *fileName, GString *ownerPassword = NULL,
51 GString *userPassword = NULL);
53 // Load a new file, via a Stream instead of a file name. Returns
54 // pdfOk or error code.
55 virtual int loadFile(BaseStream *stream, GString *ownerPassword = NULL,
56 GString *userPassword = NULL);
58 // Load an already-created PDFDoc xObject.
59 virtual void loadDoc(PDFDoc *docA);
61 // Resize the window to fit page <pg> of the current document.
62 void resizeToPage(int pg);
64 // Update the display, given the specified parameters.
65 virtual void update(int topPageA, int scrollXA, int scrollYA,
66 double zoomA, int rotateA,
67 GBool force, GBool addToHist);
69 //----- page/position changes
71 virtual GBool gotoNextPage(int inc, GBool top);
72 virtual GBool gotoPrevPage(int dec, GBool top, GBool bottom);
73 virtual GBool goForward();
74 virtual GBool goBackward();
76 //----- selection
78 void startSelection(int wx, int wy);
79 void endSelection(int wx, int wy);
80 void copySelection();
81 void startPan(int wx, int wy);
82 void endPan(int wx, int wy);
84 //----- hyperlinks
86 void doAction(LinkAction *action);
87 LinkAction *getLinkAction() { return linkAction; }
88 GString *mungeURL(GString *url);
90 //----- find
92 virtual GBool find(char *s, GBool caseSensitive,
93 GBool next, GBool backward, GBool onePageOnly);
94 virtual GBool findU(Unicode *u, int len, GBool caseSensitive,
95 GBool next, GBool backward, GBool onePageOnly);
97 //----- simple modal dialogs
99 GBool doQuestionDialog(char *title, GString *msg);
100 void doInfoDialog(char *title, GString *msg);
101 void doErrorDialog(char *title, GString *msg);
103 //----- password dialog
105 GString *getPassword();
107 //----- misc access
109 //Widget getWidget() { return scrolledWin; }
110 //Widget getDrawAreaWidget() { return drawArea; }
111 virtual void setBusyCursor(GBool busy);
112 //Cursor getBusyCursor() { return busyCursor; }
113 void takeFocus();
114 void enableHyperlinks(GBool on) { hyperlinksEnabled = on; }
115 GBool getHyperlinksEnabled() { return hyperlinksEnabled; }
116 void enableSelect(GBool on) { selectEnabled = on; }
117 GBool getFullScreen() { return fullScreen; }
119 private:
121 virtual GBool checkForNewFile();
123 //----- hyperlinks
124 void runCommand(GString *cmdFmt, GString *arg);
126 //----- selection
127 /* static Boolean convertSelectionCbk(Widget widget, Atom *selection,
128 Atom *target, Atom *type,
129 XtPointer *value, unsigned long *length,
130 int *format);
132 //----- GUI code
133 void setupX(GBool installCmap, int rgbCubeSizeA);
134 void initWindow();
136 virtual PDFCoreTile *newTile(int xDestA, int yDestA);
137 virtual void updateTileData(PDFCoreTile *tileA, int xSrc, int ySrc,
138 int width, int height, GBool composited);
139 virtual void redrawRect(PDFCoreTile *tileA, int xSrc, int ySrc,
140 int xDest, int yDest, int width, int height,
141 GBool composited);
142 virtual void updateScrollbars();
143 //void setCursor(Cursor cursor);
144 GBool doDialog(int type, GBool hasCancel,
145 char *title, GString *msg);
146 /*static void dialogOkCbk(Widget widget, XtPointer ptr,
147 XtPointer callData);
148 static void dialogCancelCbk(Widget widget, XtPointer ptr,
149 XtPointer callData);*/
150 void initPasswordDialog();
151 /*static void passwordTextVerifyCbk(Widget widget, XtPointer ptr,
152 XtPointer callData);
153 static void passwordOkCbk(Widget widget, XtPointer ptr,
154 XtPointer callData);
155 static void passwordCancelCbk(Widget widget, XtPointer ptr,
156 XtPointer callData);
158 Gulong paperPixel;
159 Gulong mattePixel;
160 //~unimp: move fullScreen into PDFCore?
161 GBool fullScreen;
163 //Display *display;
164 int screenNum;
165 //Visual *visual;
166 //Colormap colormap;
167 Guint depth; // visual depth
168 GBool trueColor; // set if using a TrueColor visual
169 int rDiv, gDiv, bDiv; // RGB right shifts (for TrueColor)
170 int rShift, gShift, bShift; // RGB left shifts (for TrueColor)
171 int rgbCubeSize; // size of color cube (for non-TrueColor)
172 Gulong // color cube (for non-TrueColor)
173 colors[xMaxRGBCube * xMaxRGBCube * xMaxRGBCube];
175 /*Widget shell; // top-level shell containing the widget
176 Widget parentWidget; // parent widget (not created by XPDFCore)
177 Widget scrolledWin;
178 Widget hScrollBar;
179 Widget vScrollBar;
180 Widget drawAreaFrame;
181 Widget drawArea;*/
182 //Cursor busyCursor, linkCursor, selectCursor;
183 //Cursor currentCursor;
184 //GC drawAreaGC; // GC for blitting into drawArea
186 static GString *currentSelection; // selected text
187 static XPDFCore *currentSelectionOwner;
188 //static Atom targetsAtom;
190 GBool panning;
191 int panMX, panMY;
193 time_t modTime; // last modification time of PDF file
195 LinkAction *linkAction; // mouse cursor is over this link
197 /*XPDFUpdateCbk updateCbk;
198 void *updateCbkData;
199 XPDFActionCbk actionCbk;
200 void *actionCbkData;
201 XPDFKeyPressCbk keyPressCbk;
202 void *keyPressCbkData;
203 XPDFMouseCbk mouseCbk;
204 void *mouseCbkData;*/
206 GBool hyperlinksEnabled;
207 GBool selectEnabled;
209 int dialogDone;
211 /*Widget passwordDialog;
212 Widget passwordText;*/
213 GString *password;
216 #endif