1 //========================================================================
2 //
3 // XPDFApp.h
4 //
5 // Copyright 2002-2003 Glyph & Cog, LLC
6 //
7 //========================================================================
8 
9 #ifndef XPDFAPP_H
10 #define XPDFAPP_H
11 
12 #include <aconf.h>
13 
14 #ifdef USE_GCC_PRAGMAS
15 #pragma interface
16 #endif
17 
18 #define Object XtObject
19 #include <Xm/XmAll.h>
20 #undef Object
21 #include "gtypes.h"
22 #include "SplashTypes.h"
23 
24 class GString;
25 class GList;
26 class PDFDoc;
27 class XPDFViewer;
28 
29 //------------------------------------------------------------------------
30 
31 #define xpdfAppName "Xpdf"
32 
33 //------------------------------------------------------------------------
34 // XPDFApp
35 //------------------------------------------------------------------------
36 
37 class XPDFApp {
38 public:
39 
40   XPDFApp(int *argc, char *argv[]);
41   ~XPDFApp();
42 
43   XPDFViewer *open(GString *fileName, int page = 1,
44 		   GString *ownerPassword = NULL,
45 		   GString *userPassword = NULL);
46   XPDFViewer *openAtDest(GString *fileName, GString *dest,
47 			 GString *ownerPassword = NULL,
48 			 GString *userPassword = NULL);
49   XPDFViewer *reopen(XPDFViewer *viewer, PDFDoc *doc, int page,
50 		     GBool fullScreenA);
51   void close(XPDFViewer *viewer, GBool closeLast);
52   void quit();
53 
54   void run();
55 
56   //----- remote server
57   void setRemoteName(char *remoteName);
58   GBool remoteServerRunning();
59   void remoteExec(char *cmd);
60   void remoteOpen(GString *fileName, int page, GBool raise);
61   void remoteOpenAtDest(GString *fileName, GString *dest, GBool raise);
62   void remoteReload(GBool raise);
63   void remoteRaise();
64   void remoteQuit();
65 
66   //----- resource/option values
getGeometry()67   GString *getGeometry() { return geometry; }
getTitle()68   GString *getTitle() { return title; }
getInstallCmap()69   GBool getInstallCmap() { return installCmap; }
getRGBCubeSize()70   int getRGBCubeSize() { return rgbCubeSize; }
getReverseVideo()71   GBool getReverseVideo() { return reverseVideo; }
getPaperRGB()72   SplashColorPtr getPaperRGB() { return paperRGB; }
getPaperPixel()73   Gulong getPaperPixel() { return paperPixel; }
getMattePixel(GBool fullScreenA)74   Gulong getMattePixel(GBool fullScreenA)
75     { return fullScreenA ? fullScreenMattePixel : mattePixel; }
getInitialZoom()76   GString *getInitialZoom() { return initialZoom; }
setFullScreen(GBool fullScreenA)77   void setFullScreen(GBool fullScreenA) { fullScreen = fullScreenA; }
getFullScreen()78   GBool getFullScreen() { return fullScreen; }
79 
getAppContext()80   XtAppContext getAppContext() { return appContext; }
getAppShell()81   Widget getAppShell() { return appShell; }
82 
83 private:
84 
85   void getResources();
86   static void remoteMsgCbk(Widget widget, XtPointer ptr,
87 			   XEvent *event, Boolean *cont);
88 
89   Display *display;
90   int screenNum;
91   XtAppContext appContext;
92   Widget appShell;
93   GList *viewers;		// [XPDFViewer]
94 
95   Atom remoteAtom;
96   Window remoteXWin;
97   XPDFViewer *remoteViewer;
98   Widget remoteWin;
99 
100   //----- resource/option values
101   GString *geometry;
102   GString *title;
103   GBool installCmap;
104   int rgbCubeSize;
105   GBool reverseVideo;
106   SplashColor paperRGB;
107   Gulong paperPixel;
108   Gulong mattePixel;
109   Gulong fullScreenMattePixel;
110   GString *initialZoom;
111   GBool fullScreen;
112 };
113 
114 #endif
115