00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef PDFVIEW_H_
00020 #define PDFVIEW_H_
00021
00022 #include <liberdm/erdm.h>
00023 #include "poppler/Link.h"
00024 #include "PageInfo.h"
00025 #include "Settings.h"
00026 #include <gtk/gtk.h>
00027
00028 struct rectangle;
00029 struct Controller;
00030 class CPageInfo;
00031
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00044 class CPDFView
00045 {
00046 public:
00047 Controller * ctrl;
00048 private:
00049 GtkWidget * drawArea;
00050
00052 private:
00053 GBool bAuth;
00054 GooString * password;
00055 int dialogDone;
00056
00057 public:
00058 GooString * getPassword();
00059 GtkWidget * getWindow() { return drawArea; }
00060
00062 public:
00063 rectangle zoomRect;
00064 point panPt;
00065 void initPan(const int x, const int y);
00066 void initZoomRect(const int x, const int y);
00067 void adjustZoomRect(const int x, const int y);
00068 GBool isSmallOffset(const int x, const int y);
00069 double calRatio(rectangle & rect, GBool bZoomin = gTrue);
00070 int lessThreshold(const rectangle & rect);
00071
00073 public:
00074 GBool doLink(const int pn, int offsetX, int offsetY);
00075 GBool doAction(LinkAction * action);
00076 void cvtDevToUser(CPageInfo *page, const int offsetX, const int offsetY, double & ux, double & uy);
00077 int getLinkPage(LinkAction *action);
00078
00080
00081
00082 public:
00083 void issueNewRequests();
00084 void issueItem(const int pn, GBool bHead = gTrue, const int time = 0);
00085 void issuePrevNextPages(const int offset, const int from = 0, const int time = 0);
00086 void issueLinks(CPageInfo *page);
00087 void issueLink(Link * p);
00088
00089 public:
00091 GBool isPanEnable();
00092 GBool isZoomInEnable();
00093 GBool isZoomOutEnable();
00094 GBool isScribbleEnable();
00095 GBool isEraseEnable();
00096
00098 GBool isPageMode();
00099 GBool isContinousMode();
00100 void setPageMode();
00101 void setContinousMode();
00102 GBool isPortraitView();
00103 GBool isLandscapeView();
00104
00105 public:
00106 CPDFView(GtkWidget * win, Controller * c );
00107 ~CPDFView(void);
00108
00110 void installEventHandler(GtkWidget * win);
00111
00113 void initializeViews();
00114 void rotateContinousMode(const int angle);
00115 void rotatePageMode(const int angle);
00116 void refreshDeviceScreen(eDmQuality quality, GBool bOff = gTrue);
00117 void displayPage(const int pageNumber, const ContinousModeScroll mode = ScrollToPage);
00118 void onClose();
00119 void quit();
00120
00122 static void ipcCbk(gpointer client_data, gint * file_descriptor,
00123 GdkInputCondition id);
00124
00126 static gboolean exposeCbk(GtkWidget *, GdkEventExpose *, gpointer);
00127 static gboolean buttonPressCbk(GtkWidget *, GdkEventButton *, gpointer);
00128 static gboolean buttonReleaseCbk(GtkWidget *, GdkEventButton *, gpointer);
00129 static gboolean motionNotifyCbk(GtkWidget *, GdkEventMotion *, gpointer);
00130 static gboolean keyPressCbk(GtkWidget *, GdkEventKey *, gpointer);
00131 static gboolean deleteCbk(GtkWidget *, GdkEvent *, gpointer);
00132 };
00133
00134 #endif
00135