Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: fpdfsdk/include/fsdk_mgr.h

Issue 453133004: clang-format all code (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef _FPDFSDK_MGR_H 7 #ifndef _FPDFSDK_MGR_H
8 #define _FPDFSDK_MGR_H 8 #define _FPDFSDK_MGR_H
9 9
10 #include "fsdk_common.h" 10 #include "fsdk_common.h"
11 #include "fsdk_define.h" 11 #include "fsdk_define.h"
12 #include "fx_systemhandler.h" 12 #include "fx_systemhandler.h"
13 #include "fsdk_baseannot.h" 13 #include "fsdk_baseannot.h"
14 #include "fsdk_baseform.h" 14 #include "fsdk_baseform.h"
15 #include "fpdfformfill.h" 15 #include "fpdfformfill.h"
16 #include "fsdk_annothandler.h" 16 #include "fsdk_annothandler.h"
17 #include "fsdk_actionhandler.h" 17 #include "fsdk_actionhandler.h"
18 18
19 //cross platform keycode and events define. 19 // cross platform keycode and events define.
20 #include "fpdf_fwlevent.h" 20 #include "fpdf_fwlevent.h"
21 21
22
23 class CPDFSDK_Document; 22 class CPDFSDK_Document;
24 class CPDFSDK_PageView; 23 class CPDFSDK_PageView;
25 class CPDFSDK_Annot; 24 class CPDFSDK_Annot;
26 class CFFL_IFormFiller; 25 class CFFL_IFormFiller;
27 class CPDFSDK_Widget; 26 class CPDFSDK_Widget;
28 class IFX_SystemHandler; 27 class IFX_SystemHandler;
29 class CPDFSDK_ActionHandler; 28 class CPDFSDK_ActionHandler;
30 class CJS_RuntimeFactory; 29 class CJS_RuntimeFactory;
31 30
32 #include "javascript/IJavaScript.h" 31 #include "javascript/IJavaScript.h"
33 32
34 class CPDFDoc_Environment FX_FINAL 33 class CPDFDoc_Environment FX_FINAL {
35 { 34 public:
36 public: 35 CPDFDoc_Environment(CPDF_Document* pDoc);
37 CPDFDoc_Environment(CPDF_Document * pDoc); 36 ~CPDFDoc_Environment();
38 ~CPDFDoc_Environment(); 37
39 38 int RegAppHandle(
40 int RegAppHandle(FPDF_FORMFILLINFO* pFFinfo);//{ m_pInfo = pFFinfo; ret urn TRUE;} 39 FPDF_FORMFILLINFO* pFFinfo); //{ m_pInfo = pFFinfo; return TRUE;}
41 40
42 void FFI_Invalidate(FPDF_PAGE page, double left, double top, double righ t, double bottom) 41 void FFI_Invalidate(FPDF_PAGE page,
43 { 42 double left,
44 if (m_pInfo && m_pInfo->FFI_Invalidate) 43 double top,
45 { 44 double right,
46 m_pInfo->FFI_Invalidate(m_pInfo, page, left, top, right, bottom); 45 double bottom) {
47 } 46 if (m_pInfo && m_pInfo->FFI_Invalidate) {
48 } 47 m_pInfo->FFI_Invalidate(m_pInfo, page, left, top, right, bottom);
49 void FFI_OutputSelectedRect(FPDF_PAGE page, double left, double top, dou ble right, double bottom) 48 }
50 { 49 }
51 if (m_pInfo && m_pInfo->FFI_OutputSelectedRect) 50 void FFI_OutputSelectedRect(FPDF_PAGE page,
52 { 51 double left,
53 m_pInfo->FFI_OutputSelectedRect(m_pInfo, page, left, top , right, bottom); 52 double top,
54 } 53 double right,
55 } 54 double bottom) {
56 55 if (m_pInfo && m_pInfo->FFI_OutputSelectedRect) {
57 void FFI_SetCursor(int nCursorType) 56 m_pInfo->FFI_OutputSelectedRect(m_pInfo, page, left, top, right, bottom);
58 { 57 }
59 if (m_pInfo && m_pInfo->FFI_SetCursor) 58 }
60 { 59
61 m_pInfo->FFI_SetCursor(m_pInfo, nCursorType); 60 void FFI_SetCursor(int nCursorType) {
62 } 61 if (m_pInfo && m_pInfo->FFI_SetCursor) {
63 } 62 m_pInfo->FFI_SetCursor(m_pInfo, nCursorType);
64 63 }
65 int FFI_SetTimer(int uElapse, TimerCallback lpTimerFunc) 64 }
66 { 65
67 if (m_pInfo && m_pInfo->FFI_SetTimer) 66 int FFI_SetTimer(int uElapse, TimerCallback lpTimerFunc) {
68 { 67 if (m_pInfo && m_pInfo->FFI_SetTimer) {
69 return m_pInfo->FFI_SetTimer(m_pInfo, uElapse, lpTimerFu nc); 68 return m_pInfo->FFI_SetTimer(m_pInfo, uElapse, lpTimerFunc);
70 } 69 }
71 return -1; 70 return -1;
72 } 71 }
73 72
74 void FFI_KillTimer(int nTimerID) 73 void FFI_KillTimer(int nTimerID) {
75 { 74 if (m_pInfo && m_pInfo->FFI_KillTimer) {
76 if (m_pInfo && m_pInfo->FFI_KillTimer) 75 m_pInfo->FFI_KillTimer(m_pInfo, nTimerID);
77 { 76 }
78 m_pInfo->FFI_KillTimer(m_pInfo, nTimerID); 77 }
79 } 78 FX_SYSTEMTIME FFI_GetLocalTime() {
80 } 79 FX_SYSTEMTIME fxtime;
81 FX_SYSTEMTIME FFI_GetLocalTime() 80 if (m_pInfo && m_pInfo->FFI_GetLocalTime) {
82 { 81 FPDF_SYSTEMTIME systime = m_pInfo->FFI_GetLocalTime(m_pInfo);
83 FX_SYSTEMTIME fxtime; 82 fxtime.wDay = systime.wDay;
84 if(m_pInfo && m_pInfo->FFI_GetLocalTime) 83 fxtime.wDayOfWeek = systime.wDayOfWeek;
85 { 84 fxtime.wHour = systime.wHour;
86 FPDF_SYSTEMTIME systime = m_pInfo->FFI_GetLocalTime(m_pI nfo); 85 fxtime.wMilliseconds = systime.wMilliseconds;
87 fxtime.wDay = systime.wDay; 86 fxtime.wMinute = systime.wMinute;
88 fxtime.wDayOfWeek = systime.wDayOfWeek; 87 fxtime.wMonth = systime.wMonth;
89 fxtime.wHour = systime.wHour; 88 fxtime.wSecond = systime.wSecond;
90 fxtime.wMilliseconds = systime.wMilliseconds; 89 fxtime.wYear = systime.wYear;
91 fxtime.wMinute = systime.wMinute; 90 }
92 fxtime.wMonth = systime.wMonth; 91 return fxtime;
93 fxtime.wSecond = systime.wSecond; 92 }
94 fxtime.wYear = systime.wYear; 93
95 } 94 void FFI_OnChange() {
96 return fxtime; 95 if (m_pInfo && m_pInfo->FFI_OnChange) {
97 } 96 m_pInfo->FFI_OnChange(m_pInfo);
98 97 }
99 void FFI_OnChange() 98 }
100 { 99
101 if(m_pInfo && m_pInfo->FFI_OnChange) 100 FX_BOOL FFI_IsSHIFTKeyDown(FX_DWORD nFlag) {
102 { 101 return (nFlag & FWL_EVENTFLAG_ShiftKey) != 0;
103 m_pInfo->FFI_OnChange(m_pInfo); 102 }
104 } 103 FX_BOOL FFI_IsCTRLKeyDown(FX_DWORD nFlag) {
105 } 104 return (nFlag & FWL_EVENTFLAG_ControlKey) != 0;
106 105 }
107 FX_BOOL FFI_IsSHIFTKeyDown(FX_DWORD nFlag) 106 FX_BOOL FFI_IsALTKeyDown(FX_DWORD nFlag) {
108 { 107 return (nFlag & FWL_EVENTFLAG_AltKey) != 0;
109 108 }
110 return (nFlag & FWL_EVENTFLAG_ShiftKey) != 0; 109 FX_BOOL FFI_IsINSERTKeyDown(FX_DWORD nFlag) { return FALSE; }
111 } 110
112 FX_BOOL FFI_IsCTRLKeyDown(FX_DWORD nFlag) 111 int JS_appAlert(FX_LPCWSTR Msg,
113 { 112 FX_LPCWSTR Title,
114 113 FX_UINT Type,
115 return (nFlag & FWL_EVENTFLAG_ControlKey) != 0; 114 FX_UINT Icon) {
116 } 115 if (m_pInfo && m_pInfo->m_pJsPlatform &&
117 FX_BOOL FFI_IsALTKeyDown(FX_DWORD nFlag) 116 m_pInfo->m_pJsPlatform->app_alert) {
118 { 117 CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encode();
119 118 CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_Encode();
120 return (nFlag & FWL_EVENTFLAG_AltKey) != 0; 119 FPDF_WIDESTRING pMsg =
121 } 120 (FPDF_WIDESTRING)bsMsg.GetBuffer(bsMsg.GetLength());
122 FX_BOOL FFI_IsINSERTKeyDown(FX_DWORD nFlag) 121 FPDF_WIDESTRING pTitle =
123 { 122 (FPDF_WIDESTRING)bsTitle.GetBuffer(bsTitle.GetLength());
124 return FALSE; 123 int ret = m_pInfo->m_pJsPlatform->app_alert(
125 } 124 m_pInfo->m_pJsPlatform, pMsg, pTitle, Type, Icon);
126 125 bsMsg.ReleaseBuffer();
127 int JS_appAlert(FX_LPCWSTR Msg, FX_LPCWSTR Title, FX_UINT Type, FX_UINT Icon) 126 bsTitle.ReleaseBuffer();
128 { 127 return ret;
129 if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform-> app_alert) 128 }
130 { 129 return -1;
131 CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encod e(); 130 }
132 CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_E ncode(); 131
133 FPDF_WIDESTRING pMsg = (FPDF_WIDESTRING)bsMsg.GetBuffer( bsMsg.GetLength()); 132 int JS_appResponse(FX_LPCWSTR Question,
134 FPDF_WIDESTRING pTitle = (FPDF_WIDESTRING)bsTitle.GetBuf fer(bsTitle.GetLength()); 133 FX_LPCWSTR Title,
135 int ret = m_pInfo->m_pJsPlatform->app_alert(m_pInfo->m_p JsPlatform, pMsg, pTitle, Type, Icon); 134 FX_LPCWSTR Default,
136 bsMsg.ReleaseBuffer(); 135 FX_LPCWSTR cLabel,
137 bsTitle.ReleaseBuffer(); 136 FPDF_BOOL bPassword,
138 return ret; 137 void* response,
139 } 138 int length) {
140 return -1; 139 if (m_pInfo && m_pInfo->m_pJsPlatform &&
141 } 140 m_pInfo->m_pJsPlatform->app_response) {
142 141 CFX_ByteString bsQuestion = CFX_WideString(Question).UTF16LE_Encode();
143 int JS_appResponse(FX_LPCWSTR Question, FX_LPCWSTR Title, FX_LPCWSTR Def ault, FX_LPCWSTR cLabel, FPDF_BOOL bPassword, void* response, int length) 142 CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_Encode();
144 { 143 CFX_ByteString bsDefault = CFX_WideString(Default).UTF16LE_Encode();
145 if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform- >app_response) 144 CFX_ByteString bsLabel = CFX_WideString(cLabel).UTF16LE_Encode();
146 { 145 FPDF_WIDESTRING pQuestion =
147 CFX_ByteString bsQuestion = CFX_WideString(Question).UTF 16LE_Encode(); 146 (FPDF_WIDESTRING)bsQuestion.GetBuffer(bsQuestion.GetLength());
148 CFX_ByteString bsTitle = CFX_WideString(Title).UTF16LE_E ncode(); 147 FPDF_WIDESTRING pTitle =
149 CFX_ByteString bsDefault = CFX_WideString(Default).UTF16 LE_Encode(); 148 (FPDF_WIDESTRING)bsTitle.GetBuffer(bsTitle.GetLength());
150 CFX_ByteString bsLabel = CFX_WideString(cLabel).UTF16LE_ Encode(); 149 FPDF_WIDESTRING pDefault =
151 FPDF_WIDESTRING pQuestion = (FPDF_WIDESTRING)bsQuestion. GetBuffer(bsQuestion.GetLength()); 150 (FPDF_WIDESTRING)bsDefault.GetBuffer(bsDefault.GetLength());
152 FPDF_WIDESTRING pTitle = (FPDF_WIDESTRING)bsTitle.GetBuf fer(bsTitle.GetLength()); 151 FPDF_WIDESTRING pLabel =
153 FPDF_WIDESTRING pDefault = (FPDF_WIDESTRING)bsDefault.Ge tBuffer(bsDefault.GetLength()); 152 (FPDF_WIDESTRING)bsLabel.GetBuffer(bsLabel.GetLength());
154 FPDF_WIDESTRING pLabel = (FPDF_WIDESTRING)bsLabel.GetBuf fer(bsLabel.GetLength()); 153 int ret = m_pInfo->m_pJsPlatform->app_response(m_pInfo->m_pJsPlatform,
155 int ret = m_pInfo->m_pJsPlatform->app_response(m_pInfo-> m_pJsPlatform, pQuestion, pTitle, 154 pQuestion,
156 pDefault, pLabel, bPassword, response, length); 155 pTitle,
157 bsQuestion.ReleaseBuffer(); 156 pDefault,
158 bsTitle.ReleaseBuffer(); 157 pLabel,
159 bsDefault.ReleaseBuffer(); 158 bPassword,
160 bsLabel.ReleaseBuffer(); 159 response,
161 return ret; 160 length);
162 } 161 bsQuestion.ReleaseBuffer();
163 return -1; 162 bsTitle.ReleaseBuffer();
164 } 163 bsDefault.ReleaseBuffer();
165 164 bsLabel.ReleaseBuffer();
166 void JS_appBeep(int nType) 165 return ret;
167 { 166 }
168 if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform-> app_beep) 167 return -1;
169 { 168 }
170 m_pInfo->m_pJsPlatform->app_beep(m_pInfo->m_pJsPlatform, nType); 169
171 } 170 void JS_appBeep(int nType) {
172 } 171 if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->app_beep) {
173 172 m_pInfo->m_pJsPlatform->app_beep(m_pInfo->m_pJsPlatform, nType);
174 CFX_WideString JS_fieldBrowse() 173 }
175 { 174 }
176 if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform- >Field_browse) 175
177 { 176 CFX_WideString JS_fieldBrowse() {
178 int nRequiredLen = m_pInfo->m_pJsPlatform->Field_browse( m_pInfo->m_pJsPlatform, NULL, 0); 177 if (m_pInfo && m_pInfo->m_pJsPlatform &&
179 if (nRequiredLen <= 0) 178 m_pInfo->m_pJsPlatform->Field_browse) {
180 return L""; 179 int nRequiredLen =
181 180 m_pInfo->m_pJsPlatform->Field_browse(m_pInfo->m_pJsPlatform, NULL, 0);
182 char* pbuff = new char[nRequiredLen]; 181 if (nRequiredLen <= 0)
183 if (!pbuff) 182 return L"";
184 return L""; 183
185 184 char* pbuff = new char[nRequiredLen];
186 memset(pbuff, 0, nRequiredLen); 185 if (!pbuff)
187 int nActualLen = m_pInfo->m_pJsPlatform->Field_browse(m_ pInfo->m_pJsPlatform, pbuff, nRequiredLen); 186 return L"";
188 if (nActualLen <= 0 || nActualLen > nRequiredLen) 187
189 { 188 memset(pbuff, 0, nRequiredLen);
190 delete[] pbuff; 189 int nActualLen = m_pInfo->m_pJsPlatform->Field_browse(
191 return L""; 190 m_pInfo->m_pJsPlatform, pbuff, nRequiredLen);
192 } 191 if (nActualLen <= 0 || nActualLen > nRequiredLen) {
193 CFX_ByteString bsRet = CFX_ByteString(pbuff, nActualLen) ; 192 delete[] pbuff;
194 CFX_WideString wsRet = CFX_WideString::FromLocal(bsRet); 193 return L"";
195 delete[] pbuff; 194 }
196 return wsRet; 195 CFX_ByteString bsRet = CFX_ByteString(pbuff, nActualLen);
197 } 196 CFX_WideString wsRet = CFX_WideString::FromLocal(bsRet);
198 return L""; 197 delete[] pbuff;
199 } 198 return wsRet;
200 199 }
201 CFX_WideString JS_docGetFilePath() 200 return L"";
202 { 201 }
203 if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform- >Doc_getFilePath) 202
204 { 203 CFX_WideString JS_docGetFilePath() {
205 int nRequiredLen = m_pInfo->m_pJsPlatform->Doc_getFilePa th(m_pInfo->m_pJsPlatform, NULL, 0); 204 if (m_pInfo && m_pInfo->m_pJsPlatform &&
206 if (nRequiredLen <= 0) 205 m_pInfo->m_pJsPlatform->Doc_getFilePath) {
207 return L""; 206 int nRequiredLen = m_pInfo->m_pJsPlatform->Doc_getFilePath(
208 207 m_pInfo->m_pJsPlatform, NULL, 0);
209 char* pbuff = new char[nRequiredLen]; 208 if (nRequiredLen <= 0)
210 if (!pbuff) 209 return L"";
211 return L""; 210
212 211 char* pbuff = new char[nRequiredLen];
213 memset(pbuff, 0, nRequiredLen); 212 if (!pbuff)
214 int nActualLen = m_pInfo->m_pJsPlatform->Doc_getFilePath (m_pInfo->m_pJsPlatform, pbuff, nRequiredLen); 213 return L"";
215 if (nActualLen <= 0 || nActualLen > nRequiredLen) 214
216 { 215 memset(pbuff, 0, nRequiredLen);
217 delete[] pbuff; 216 int nActualLen = m_pInfo->m_pJsPlatform->Doc_getFilePath(
218 return L""; 217 m_pInfo->m_pJsPlatform, pbuff, nRequiredLen);
219 } 218 if (nActualLen <= 0 || nActualLen > nRequiredLen) {
220 CFX_ByteString bsRet = CFX_ByteString(pbuff, nActualLen) ; 219 delete[] pbuff;
221 CFX_WideString wsRet = CFX_WideString::FromLocal(bsRet); 220 return L"";
222 delete[] pbuff; 221 }
223 return wsRet; 222 CFX_ByteString bsRet = CFX_ByteString(pbuff, nActualLen);
224 } 223 CFX_WideString wsRet = CFX_WideString::FromLocal(bsRet);
225 return L""; 224 delete[] pbuff;
226 } 225 return wsRet;
227 226 }
228 void JS_docSubmitForm(void* formData, int length, FX_LPCWSTR URL) 227 return L"";
229 { 228 }
230 if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform-> Doc_submitForm) 229
231 { 230 void JS_docSubmitForm(void* formData, int length, FX_LPCWSTR URL) {
232 CFX_ByteString bsDestination = CFX_WideString(URL).UTF16 LE_Encode(); 231 if (m_pInfo && m_pInfo->m_pJsPlatform &&
233 FPDF_WIDESTRING pDestination = (FPDF_WIDESTRING)bsDestin ation.GetBuffer(bsDestination.GetLength()); 232 m_pInfo->m_pJsPlatform->Doc_submitForm) {
234 m_pInfo->m_pJsPlatform->Doc_submitForm(m_pInfo->m_pJsPla tform, formData, length, pDestination); 233 CFX_ByteString bsDestination = CFX_WideString(URL).UTF16LE_Encode();
235 bsDestination.ReleaseBuffer(); 234 FPDF_WIDESTRING pDestination =
236 } 235 (FPDF_WIDESTRING)bsDestination.GetBuffer(bsDestination.GetLength());
237 } 236 m_pInfo->m_pJsPlatform->Doc_submitForm(
238 237 m_pInfo->m_pJsPlatform, formData, length, pDestination);
239 void JS_docmailForm(void* mailData, int length, FPDF_BOOL bUI,FX_LPCWSTR To, FX_LPCWSTR Subject, FX_LPCWSTR CC, FX_LPCWSTR BCC, FX_LPCWSTR Msg) 238 bsDestination.ReleaseBuffer();
240 { 239 }
241 if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform-> Doc_mail) 240 }
242 { 241
243 CFX_ByteString bsTo = CFX_WideString(To).UTF16LE_Encode( ); 242 void JS_docmailForm(void* mailData,
244 CFX_ByteString bsCC = CFX_WideString(Subject).UTF16LE_En code(); 243 int length,
245 CFX_ByteString bsBcc = CFX_WideString(BCC).UTF16LE_Encod e(); 244 FPDF_BOOL bUI,
246 CFX_ByteString bsSubject = CFX_WideString(Subject).UTF16 LE_Encode(); 245 FX_LPCWSTR To,
247 CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encod e(); 246 FX_LPCWSTR Subject,
248 FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(bs To.GetLength()); 247 FX_LPCWSTR CC,
249 FPDF_WIDESTRING pCC = (FPDF_WIDESTRING)bsCC.GetBuffer(bs CC.GetLength()); 248 FX_LPCWSTR BCC,
250 FPDF_WIDESTRING pBcc = (FPDF_WIDESTRING)bsBcc.GetBuffer( bsBcc.GetLength()); 249 FX_LPCWSTR Msg) {
251 FPDF_WIDESTRING pSubject = (FPDF_WIDESTRING)bsSubject.Ge tBuffer(bsSubject.GetLength()); 250 if (m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform->Doc_mail) {
252 FPDF_WIDESTRING pMsg = (FPDF_WIDESTRING)bsMsg.GetBuffer( bsMsg.GetLength()); 251 CFX_ByteString bsTo = CFX_WideString(To).UTF16LE_Encode();
253 m_pInfo->m_pJsPlatform->Doc_mail(m_pInfo->m_pJsPlatform, mailData, length, bUI, pTo, pSubject, 252 CFX_ByteString bsCC = CFX_WideString(Subject).UTF16LE_Encode();
254 pCC, pBcc, pMsg); 253 CFX_ByteString bsBcc = CFX_WideString(BCC).UTF16LE_Encode();
255 bsTo.ReleaseBuffer(); 254 CFX_ByteString bsSubject = CFX_WideString(Subject).UTF16LE_Encode();
256 bsCC.ReleaseBuffer(); 255 CFX_ByteString bsMsg = CFX_WideString(Msg).UTF16LE_Encode();
257 bsBcc.ReleaseBuffer(); 256 FPDF_WIDESTRING pTo = (FPDF_WIDESTRING)bsTo.GetBuffer(bsTo.GetLength());
258 bsSubject.ReleaseBuffer(); 257 FPDF_WIDESTRING pCC = (FPDF_WIDESTRING)bsCC.GetBuffer(bsCC.GetLength());
259 bsMsg.ReleaseBuffer(); 258 FPDF_WIDESTRING pBcc =
260 } 259 (FPDF_WIDESTRING)bsBcc.GetBuffer(bsBcc.GetLength());
261 } 260 FPDF_WIDESTRING pSubject =
262 CFX_WideString JS_appbrowseForDoc(FPDF_BOOL bSave, FX_LPCWSTR cFilenameI nit) 261 (FPDF_WIDESTRING)bsSubject.GetBuffer(bsSubject.GetLength());
263 { 262 FPDF_WIDESTRING pMsg =
264 //to do.... 263 (FPDF_WIDESTRING)bsMsg.GetBuffer(bsMsg.GetLength());
265 return L""; 264 m_pInfo->m_pJsPlatform->Doc_mail(m_pInfo->m_pJsPlatform,
266 // if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform-> app_browseForDoc) 265 mailData,
267 // { 266 length,
268 // CFX_ByteString bsFilenameInit = CFX_WideString(cFilename Init).UTF16LE_Encode(); 267 bUI,
269 // FPDF_WIDESTRING pFileNameInit = (FPDF_WIDESTRING)bsFilen ameInit.GetBuffer(bsFilenameInit.GetLength()); 268 pTo,
270 // 269 pSubject,
271 // m_pInfo->m_pJsPlatform->app_browseForDoc(m_pInfo->m_pJsP latform, pFileNameInit); 270 pCC,
272 // bsFilenameInit.ReleaseBuffer(); 271 pBcc,
273 // } 272 pMsg);
274 } 273 bsTo.ReleaseBuffer();
275 274 bsCC.ReleaseBuffer();
276 void JS_docprint(FPDF_BOOL bUI , int nStart, int nEnd, FPDF_BOOL bSilent ,FPDF_BOOL bShrinkToFit,FPDF_BOOL bPrintAsImage ,FPDF_BOOL bReverse ,FPDF_BOOL bAnnotations) 275 bsBcc.ReleaseBuffer();
277 { 276 bsSubject.ReleaseBuffer();
278 if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform-> Doc_print) 277 bsMsg.ReleaseBuffer();
279 { 278 }
280 m_pInfo->m_pJsPlatform->Doc_print(m_pInfo->m_pJsPlatform , bUI, nStart, nEnd, bSilent, bShrinkToFit, bPrintAsImage, bReverse, bAnnotation s); 279 }
281 } 280 CFX_WideString JS_appbrowseForDoc(FPDF_BOOL bSave, FX_LPCWSTR cFilenameInit) {
282 } 281 // to do....
283 void JS_docgotoPage(int nPageNum) 282 return L"";
284 { 283 // if(m_pInfo && m_pInfo->m_pJsPlatform &&
285 if(m_pInfo && m_pInfo->m_pJsPlatform && m_pInfo->m_pJsPlatform-> Doc_gotoPage) 284 // m_pInfo->m_pJsPlatform->app_browseForDoc)
286 { 285 // {
287 m_pInfo->m_pJsPlatform->Doc_gotoPage(m_pInfo->m_pJsPlatf orm, nPageNum); 286 // CFX_ByteString bsFilenameInit =
288 } 287 // CFX_WideString(cFilenameInit).UTF16LE_Encode();
289 } 288 // FPDF_WIDESTRING pFileNameInit =
290 289 // (FPDF_WIDESTRING)bsFilenameInit.GetBuffer(bsFilenameInit.GetLength());
291 FPDF_PAGE FFI_GetPage(FPDF_DOCUMENT document,int nPageIndex) 290 //
292 { 291 // m_pInfo->m_pJsPlatform->app_browseForDoc(m_pInfo->m_pJsP latform,
293 if(m_pInfo && m_pInfo->FFI_GetPage) 292 // pFileNameInit);
294 { 293 // bsFilenameInit.ReleaseBuffer();
295 return m_pInfo->FFI_GetPage(m_pInfo, document, nPageInde x); 294 // }
296 } 295 }
297 return NULL; 296
298 } 297 void JS_docprint(FPDF_BOOL bUI,
299 298 int nStart,
300 FPDF_PAGE FFI_GetCurrentPage(FPDF_DOCUMENT document) 299 int nEnd,
301 { 300 FPDF_BOOL bSilent,
302 if(m_pInfo && m_pInfo->FFI_GetCurrentPage) 301 FPDF_BOOL bShrinkToFit,
303 { 302 FPDF_BOOL bPrintAsImage,
304 return m_pInfo->FFI_GetCurrentPage(m_pInfo, document); 303 FPDF_BOOL bReverse,
305 } 304 FPDF_BOOL bAnnotations) {
306 return NULL; 305 if (m_pInfo && m_pInfo->m_pJsPlatform &&
307 } 306 m_pInfo->m_pJsPlatform->Doc_print) {
308 307 m_pInfo->m_pJsPlatform->Doc_print(m_pInfo->m_pJsPlatform,
309 int FFI_GetRotation(FPDF_PAGE page) 308 bUI,
310 { 309 nStart,
311 if(m_pInfo && m_pInfo->FFI_GetRotation) 310 nEnd,
312 { 311 bSilent,
313 return m_pInfo->FFI_GetRotation(m_pInfo, page); 312 bShrinkToFit,
314 } 313 bPrintAsImage,
315 return 0; 314 bReverse,
316 } 315 bAnnotations);
317 void FFI_ExecuteNamedAction(FX_LPCSTR namedAction) 316 }
318 { 317 }
319 if(m_pInfo && m_pInfo->FFI_ExecuteNamedAction) 318 void JS_docgotoPage(int nPageNum) {
320 { 319 if (m_pInfo && m_pInfo->m_pJsPlatform &&
321 m_pInfo->FFI_ExecuteNamedAction(m_pInfo, namedAction); 320 m_pInfo->m_pJsPlatform->Doc_gotoPage) {
322 } 321 m_pInfo->m_pJsPlatform->Doc_gotoPage(m_pInfo->m_pJsPlatform, nPageNum);
323 } 322 }
324 void FFI_OnSetFieldInputFocus(void* field,FPDF_WIDESTRING focusText, FPDF_DWORD nTextLen, FX_BOOL bFocus) 323 }
325 { 324
326 if(m_pInfo && m_pInfo->FFI_SetTextFieldFocus) 325 FPDF_PAGE FFI_GetPage(FPDF_DOCUMENT document, int nPageIndex) {
327 { 326 if (m_pInfo && m_pInfo->FFI_GetPage) {
328 m_pInfo->FFI_SetTextFieldFocus(m_pInfo, focusText, nText Len, bFocus); 327 return m_pInfo->FFI_GetPage(m_pInfo, document, nPageIndex);
329 } 328 }
330 } 329 return NULL;
331 330 }
332 void FFI_DoURIAction(FX_LPCSTR bsURI) 331
333 { 332 FPDF_PAGE FFI_GetCurrentPage(FPDF_DOCUMENT document) {
334 if(m_pInfo && m_pInfo->FFI_DoURIAction) 333 if (m_pInfo && m_pInfo->FFI_GetCurrentPage) {
335 { 334 return m_pInfo->FFI_GetCurrentPage(m_pInfo, document);
336 m_pInfo->FFI_DoURIAction(m_pInfo, bsURI); 335 }
337 } 336 return NULL;
338 } 337 }
339 338
340 void FFI_DoGoToAction(int nPageIndex, int zoomMode, float* fPosArray, int sizeOfArray) 339 int FFI_GetRotation(FPDF_PAGE page) {
341 { 340 if (m_pInfo && m_pInfo->FFI_GetRotation) {
342 if(m_pInfo && m_pInfo->FFI_DoGoToAction) 341 return m_pInfo->FFI_GetRotation(m_pInfo, page);
343 { 342 }
344 m_pInfo->FFI_DoGoToAction(m_pInfo, nPageIndex, zoomMode, fPosArray, sizeOfArray); 343 return 0;
345 } 344 }
346 } 345 void FFI_ExecuteNamedAction(FX_LPCSTR namedAction) {
347 346 if (m_pInfo && m_pInfo->FFI_ExecuteNamedAction) {
348 public: 347 m_pInfo->FFI_ExecuteNamedAction(m_pInfo, namedAction);
349 FX_BOOL IsJSInitiated(); 348 }
350 349 }
351 public: 350 void FFI_OnSetFieldInputFocus(void* field,
352 void SetCurrentDoc(CPDFSDK_Document* pFXDoc) {m_pSDKDoc = pFXDoc;} 351 FPDF_WIDESTRING focusText,
353 CPDFSDK_Document* GetCurrentDoc(); 352 FPDF_DWORD nTextLen,
354 CPDF_Document* GetPDFDocument() {return m_pPDFDoc;} 353 FX_BOOL bFocus) {
355 // CPDFSDK_Document* GetDocument(int nIndex); 354 if (m_pInfo && m_pInfo->FFI_SetTextFieldFocus) {
356 // int CountDocuments() {return m_docMa p.GetCount();} 355 m_pInfo->FFI_SetTextFieldFocus(m_pInfo, focusText, nTextLen, bFocus);
357 356 }
358 CPDFSDK_Document* OpenDocument(CFX_WideString &fileName); 357 }
359 CPDFSDK_Document* OpenMemPDFDoc(CPDF_Document* pNewDoc, CF X_WideString &fileName); 358
360 FX_BOOL OpenURL(CFX_WideString &filePath ); 359 void FFI_DoURIAction(FX_LPCSTR bsURI) {
361 360 if (m_pInfo && m_pInfo->FFI_DoURIAction) {
362 361 m_pInfo->FFI_DoURIAction(m_pInfo, bsURI);
363 CFX_ByteString GetAppName() {return "";} 362 }
364 363 }
365 CFFL_IFormFiller* GetIFormFiller(); 364
366 IFX_SystemHandler* GetSysHandler() {return m_pSysHandler;} 365 void FFI_DoGoToAction(int nPageIndex,
367 366 int zoomMode,
368 public: 367 float* fPosArray,
369 CPDFSDK_AnnotHandlerMgr* GetAnnotHandlerMgr(); 368 int sizeOfArray) {
370 IFXJS_Runtime* GetJSRuntime(); 369 if (m_pInfo && m_pInfo->FFI_DoGoToAction) {
371 CPDFSDK_ActionHandler* GetActionHander(); 370 m_pInfo->FFI_DoGoToAction(
372 private: 371 m_pInfo, nPageIndex, zoomMode, fPosArray, sizeOfArray);
373 CPDFSDK_AnnotHandlerMgr* m_pAnnotHandlerMgr; 372 }
374 CPDFSDK_ActionHandler* m_pActionHandler; 373 }
375 IFXJS_Runtime* m_pJSRuntime; 374
376 public: 375 public:
377 FPDF_FORMFILLINFO* GetFormFillInfo() {return m_pInfo;} 376 FX_BOOL IsJSInitiated();
378 private: 377
379 FPDF_FORMFILLINFO* m_pInfo; 378 public:
380 // CFX_MapPtrTemplate<CPDF_Document*, CPDFSDK_Document*> m_docMap; 379 void SetCurrentDoc(CPDFSDK_Document* pFXDoc) { m_pSDKDoc = pFXDoc; }
381 CPDFSDK_Document* m_pSDKDoc; 380 CPDFSDK_Document* GetCurrentDoc();
382 CPDF_Document* m_pPDFDoc; 381 CPDF_Document* GetPDFDocument() { return m_pPDFDoc; }
383 382 // CPDFSDK_Document* GetDocument(int nIndex);
384 CFFL_IFormFiller* m_pIFormFiller; 383 // int CountDocuments() {return
385 IFX_SystemHandler* m_pSysHandler; 384 // m_docMap.GetCount();}
386 385
387 public: 386 CPDFSDK_Document* OpenDocument(CFX_WideString& fileName);
388 CJS_RuntimeFactory* m_pJSRuntimeFactory; 387 CPDFSDK_Document* OpenMemPDFDoc(CPDF_Document* pNewDoc,
388 CFX_WideString& fileName);
389 FX_BOOL OpenURL(CFX_WideString& filePath);
390
391 CFX_ByteString GetAppName() { return ""; }
392
393 CFFL_IFormFiller* GetIFormFiller();
394 IFX_SystemHandler* GetSysHandler() { return m_pSysHandler; }
395
396 public:
397 CPDFSDK_AnnotHandlerMgr* GetAnnotHandlerMgr();
398 IFXJS_Runtime* GetJSRuntime();
399 CPDFSDK_ActionHandler* GetActionHander();
400
401 private:
402 CPDFSDK_AnnotHandlerMgr* m_pAnnotHandlerMgr;
403 CPDFSDK_ActionHandler* m_pActionHandler;
404 IFXJS_Runtime* m_pJSRuntime;
405
406 public:
407 FPDF_FORMFILLINFO* GetFormFillInfo() { return m_pInfo; }
408
409 private:
410 FPDF_FORMFILLINFO* m_pInfo;
411 // CFX_MapPtrTemplate<CPDF_Document*, CPDFSDK_Document*> m_docMap;
412 CPDFSDK_Document* m_pSDKDoc;
413 CPDF_Document* m_pPDFDoc;
414
415 CFFL_IFormFiller* m_pIFormFiller;
416 IFX_SystemHandler* m_pSysHandler;
417
418 public:
419 CJS_RuntimeFactory* m_pJSRuntimeFactory;
389 }; 420 };
390 421
391
392
393 // class CFX_App 422 // class CFX_App
394 // { 423 // {
395 // public: 424 // public:
396 // CFX_App():m_pCurDoc(NULL) {} 425 // CFX_App():m_pCurDoc(NULL) {}
397 // void SetAt(CPDF_Document* pPDFDoc, CPDFSDK_Document* pFXDoc); 426 // void SetAt(CPDF_Document* pPDFDoc, CPDFSDK_Document* pFXDoc);
398 // CPDFSDK_Document* GetAt(CPDF_Document* pPDFDoc); 427 // CPDFSDK_Document* GetAt(CPDF_Document* pPDFDoc);
399 // public: 428 // public:
400 // void SetCurrentDocument(CPDFSDK_Document* pFXDoc) {m_pCurDoc = pFXDoc;} 429 // void SetCurrentDocument(CPDFSDK_Document* pFXDoc) {m_pCurDoc = pFXDoc;}
401 // CPDFSDK_Document* GetCurrentDocument() {return m_pCurDoc;} 430 // CPDFSDK_Document* GetCurrentDocument() {return m_pCurDoc;}
402 // private: 431 // private:
403 // CFX_MapPtrTemplate<CPDF_Document*, CPDFSDK_Document*> m_docArray; 432 // CFX_MapPtrTemplate<CPDF_Document*, CPDFSDK_Document*> m_docArray;
404 // CPDFSDK_Document* m_pCurDoc; 433 // CPDFSDK_Document* m_pCurDoc;
405 // }; 434 // };
406 class CPDFSDK_InterForm; 435 class CPDFSDK_InterForm;
407 class CPDFSDK_Document 436 class CPDFSDK_Document {
408 { 437 public:
409 public: 438 CPDFSDK_Document(CPDF_Document* pDoc, CPDFDoc_Environment* pEnv);
410 » CPDFSDK_Document(CPDF_Document* pDoc, CPDFDoc_Environment* pEnv); 439 ~CPDFSDK_Document();
411 » ~CPDFSDK_Document(); 440
412 public: 441 public:
413 » CPDFSDK_InterForm*» » GetInterForm() ; 442 CPDFSDK_InterForm* GetInterForm();
414 » CPDF_Document*» » » GetDocument() {return m_pDoc;} 443 CPDF_Document* GetDocument() { return m_pDoc; }
415 444
416 public: 445 public:
417 » void» » » » » InitPageView(); 446 void InitPageView();
418 » void» » » » » AddPageView(CPDF_Page* pPDFPage, CPDFSDK_PageView* pPageView); 447 void AddPageView(CPDF_Page* pPDFPage, CPDFSDK_PageView* pPageView);
419 » CPDFSDK_PageView*» » GetPageView(CPDF_Page* pPDFPage, FX_BOOL ReNew = TRUE); 448 CPDFSDK_PageView* GetPageView(CPDF_Page* pPDFPage, FX_BOOL ReNew = TRUE);
420 » CPDFSDK_PageView*» » GetPageView(int nIndex); 449 CPDFSDK_PageView* GetPageView(int nIndex);
421 » CPDFSDK_PageView*» » GetCurrentView(); 450 CPDFSDK_PageView* GetCurrentView();
422 » void» » » » » ReMovePageView(CPDF_Page* pPDFPa ge); 451 void ReMovePageView(CPDF_Page* pPDFPage);
423 » void» » » » » UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot); 452 void UpdateAllViews(CPDFSDK_PageView* pSender, CPDFSDK_Annot* pAnnot);
424 453
425 » CPDFSDK_Annot*» » » GetFocusAnnot();//{return NULL;} 454 CPDFSDK_Annot* GetFocusAnnot(); //{return NULL;}
426 455
427 » IFXJS_Runtime *»» » GetJsRuntime(); 456 IFXJS_Runtime* GetJsRuntime();
428 » 457
429 » FX_BOOL»» » » » SetFocusAnnot(CPDFSDK_Annot* pAn not, FX_UINT nFlag = 0);//{return FALSE;} 458 FX_BOOL SetFocusAnnot(CPDFSDK_Annot* pAnnot,
430 » FX_BOOL»» » » » KillFocusAnnot(FX_UINT nFlag = 0 ); 459 FX_UINT nFlag = 0); //{return FALSE;}
431 460 FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0);
432 » FX_BOOL»» » » » ExtractPages(const CFX_WordArray &arrExtraPages, CPDF_Document* pDstDoc); 461
433 » FX_BOOL»» » » » InsertPages(int nInsertAt, const CPDF_Document* pSrcDoc, const CFX_WordArray &arrSrcPages); 462 FX_BOOL ExtractPages(const CFX_WordArray& arrExtraPages,
434 » FX_BOOL»» » » » DeletePages(int nStart, int nCou nt); 463 CPDF_Document* pDstDoc);
435 » FX_BOOL»» » » » ReplacePages(int nPage, const CP DF_Document* pSrcDoc, const CFX_WordArray &arrSrcPages); 464 FX_BOOL InsertPages(int nInsertAt,
436 465 const CPDF_Document* pSrcDoc,
437 » void» » » » » OnCloseDocument(); 466 const CFX_WordArray& arrSrcPages);
438 467 FX_BOOL DeletePages(int nStart, int nCount);
439 » int» » » » » » GetPageCount() {return m _pDoc->GetPageCount();} 468 FX_BOOL ReplacePages(int nPage,
440 » FX_BOOL»» » » » GetPermissions(int nFlag); 469 const CPDF_Document* pSrcDoc,
441 » FX_BOOL»» » » » GetChangeMark() {return m_bChang eMask;} 470 const CFX_WordArray& arrSrcPages);
442 » void» » » » » SetChangeMark() {m_bChangeMask = TRUE;} 471
443 » void» » » » » ClearChangeMark() {m_bChangeMask = FALSE;} 472 void OnCloseDocument();
444 //» FX_BOOL»» » » » GetChangeMark(){return FALSE;}// IsAnnotModified()||IsFormModified() || IsWidgetModified()|| m_nChangeMark>0 ;}» 473
445 //» void ClearChangeMark(){} 474 int GetPageCount() { return m_pDoc->GetPageCount(); }
446 » CFX_WideString» » » GetPath() ; 475 FX_BOOL GetPermissions(int nFlag);
447 » CPDF_Page*» » » » GetPage(int nIndex); 476 FX_BOOL GetChangeMark() { return m_bChangeMask; }
448 » CPDFDoc_Environment *» GetEnv() {return m_pEnv; } 477 void SetChangeMark() { m_bChangeMask = TRUE; }
449 » void» » » » ProcJavascriptFun(); 478 void ClearChangeMark() { m_bChangeMask = FALSE; }
450 » FX_BOOL»» » » » ProcOpenAction(); 479 //» FX_BOOL»» » » » GetChangeMark(){return
451 » CPDF_OCContext*»» » GetOCContext(); 480 //FALSE;}//IsAnnotModified()||IsFormModified() || IsWidgetModified()||
452 private: 481 //m_nChangeMark>0 ;}
453 » //CFX_ArrayTemplate<CPDFSDK_PageView*> m_pageArray; 482 //» void ClearChangeMark(){}
454 » CFX_MapPtrTemplate<CPDF_Page*, CPDFSDK_PageView*> m_pageMap; 483 CFX_WideString GetPath();
455 » CPDF_Document*» » » m_pDoc; 484 CPDF_Page* GetPage(int nIndex);
456 485 CPDFDoc_Environment* GetEnv() { return m_pEnv; }
457 » CPDFSDK_InterForm*» » m_pInterForm; 486 void ProcJavascriptFun();
458 » CPDFSDK_Annot*» » » m_pFocusAnnot; 487 FX_BOOL ProcOpenAction();
459 » CPDFDoc_Environment *» m_pEnv; 488 CPDF_OCContext* GetOCContext();
460 » CPDF_OCContext *» » m_pOccontent; 489
461 » FX_BOOL»» » » » m_bChangeMask; 490 private:
491 // CFX_ArrayTemplate<CPDFSDK_PageView*> m_pageArray;
492 CFX_MapPtrTemplate<CPDF_Page*, CPDFSDK_PageView*> m_pageMap;
493 CPDF_Document* m_pDoc;
494
495 CPDFSDK_InterForm* m_pInterForm;
496 CPDFSDK_Annot* m_pFocusAnnot;
497 CPDFDoc_Environment* m_pEnv;
498 CPDF_OCContext* m_pOccontent;
499 FX_BOOL m_bChangeMask;
462 }; 500 };
463 501
464 class CPDFSDK_PageView FX_FINAL 502 class CPDFSDK_PageView FX_FINAL {
465 { 503 public:
466 public: 504 CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc, CPDF_Page* page);
467 » CPDFSDK_PageView(CPDFSDK_Document* pSDKDoc,CPDF_Page* page); 505 ~CPDFSDK_PageView();
468 » ~CPDFSDK_PageView(); 506
469 public: 507 public:
470 » void PageView_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Devic e,CPDF_RenderOptions* pOptions) ; 508 void PageView_OnDraw(CFX_RenderDevice* pDevice,
471 public: 509 CPDF_Matrix* pUser2Device,
472 » CPDF_Annot*» » » » » » GetPDFAnnotAtPoi nt(FX_FLOAT pageX, FX_FLOAT pageY); 510 CPDF_RenderOptions* pOptions);
473 » CPDFSDK_Annot*» » » » » GetFXAnnotAtPoint(FX_FLO AT pageX, FX_FLOAT pageY); 511
474 » CPDF_Annot*» » » » » » GetPDFWidgetAtPo int(FX_FLOAT pageX, FX_FLOAT pageY); 512 public:
475 » CPDFSDK_Annot*» » » » » GetFXWidgetAtPoint(FX_FL OAT pageX, FX_FLOAT pageY); 513 CPDF_Annot* GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
476 » CPDFSDK_Annot*» » » » » GetFocusAnnot() ; 514 CPDFSDK_Annot* GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
477 » void» » » » » » » SetFocusAnnot(CP DFSDK_Annot* pSDKAnnot,FX_UINT nFlag = 0) {m_pSDKDoc->SetFocusAnnot(pSDKAnnot, n Flag);} 515 CPDF_Annot* GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
478 » FX_BOOL»» » » » » » KillFocusAnnot(F X_UINT nFlag = 0) {return m_pSDKDoc->KillFocusAnnot(nFlag);} 516 CPDFSDK_Annot* GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY);
479 » FX_BOOL»» » » » » » Annot_HasAppeara nce(CPDF_Annot* pAnnot); 517 CPDFSDK_Annot* GetFocusAnnot();
480 518 void SetFocusAnnot(CPDFSDK_Annot* pSDKAnnot, FX_UINT nFlag = 0) {
481 » CPDFSDK_Annot*» » » » » AddAnnot(CPDF_Dictionary * pDict); 519 m_pSDKDoc->SetFocusAnnot(pSDKAnnot, nFlag);
482 » CPDFSDK_Annot*» » » » » AddAnnot(FX_LPCSTR lpSub Type,CPDF_Dictionary * pDict); 520 }
483 » CPDFSDK_Annot*» » » » » AddAnnot(CPDF_Annot * pP DFAnnot); 521 FX_BOOL KillFocusAnnot(FX_UINT nFlag = 0) {
484 » FX_BOOL»» » » » » » DeleteAnnot(CPDF SDK_Annot* pAnnot);» » » » » » » 522 return m_pSDKDoc->KillFocusAnnot(nFlag);
485 » 523 }
486 » int» » » » » » » » CountAnn ots(); 524 FX_BOOL Annot_HasAppearance(CPDF_Annot* pAnnot);
487 » CPDFSDK_Annot*» » » » » GetAnnot(int nIndex); 525
488 » CPDFSDK_Annot*» » » » GetAnnotByDict(CPDF_Dictiona ry * pDict); 526 CPDFSDK_Annot* AddAnnot(CPDF_Dictionary* pDict);
489 » CPDF_Page*» » » » » » GetPDFPage(){ret urn m_page;} 527 CPDFSDK_Annot* AddAnnot(FX_LPCSTR lpSubType, CPDF_Dictionary* pDict);
490 » CPDF_Document*» » » » » GetPDFDocument(); 528 CPDFSDK_Annot* AddAnnot(CPDF_Annot* pPDFAnnot);
491 » CPDFSDK_Document*» » » » GetSDKDocument() {return m_pSDKDoc;}» 529 FX_BOOL DeleteAnnot(CPDFSDK_Annot* pAnnot);
492 public: 530
493 » FX_BOOL»» » » » OnLButtonDown(const CPDF_Point & point, FX_UINT nFlag); 531 int CountAnnots();
494 » FX_BOOL»» » » » OnLButtonUp(const CPDF_Point & p oint, FX_UINT nFlag); 532 CPDFSDK_Annot* GetAnnot(int nIndex);
495 » FX_BOOL»» » » » OnChar(int nChar, FX_UINT nFlag) ; 533 CPDFSDK_Annot* GetAnnotByDict(CPDF_Dictionary* pDict);
496 » FX_BOOL»» » » » OnKeyDown(int nKeyCode, int nFla g); 534 CPDF_Page* GetPDFPage() { return m_page; }
497 » FX_BOOL»» » » » OnKeyUp(int nKeyCode, int nFlag) ; 535 CPDF_Document* GetPDFDocument();
498 536 CPDFSDK_Document* GetSDKDocument() { return m_pSDKDoc; }
499 » FX_BOOL»» » » » OnMouseMove(const CPDF_Point & p oint, int nFlag); 537
500 » FX_BOOL»» » » » OnMouseWheel(double deltaX, doub le deltaY,const CPDF_Point& point, int nFlag); 538 public:
501 » FX_BOOL»» » » » IsValidAnnot(FX_LPVOID p); 539 FX_BOOL OnLButtonDown(const CPDF_Point& point, FX_UINT nFlag);
502 public: 540 FX_BOOL OnLButtonUp(const CPDF_Point& point, FX_UINT nFlag);
503 » void» » » » » GetCurrentMatrix(CPDF_Matrix& ma trix) {matrix = m_curMatrix;} 541 FX_BOOL OnChar(int nChar, FX_UINT nFlag);
504 » void» » » » » UpdateRects(CFX_RectArray& rects ); 542 FX_BOOL OnKeyDown(int nKeyCode, int nFlag);
505 » void» » » » » » » UpdateView(CPDFS DK_Annot* pAnnot); 543 FX_BOOL OnKeyUp(int nKeyCode, int nFlag);
506 » CFX_PtrArray*» » » » » GetAnnotList(){ return & m_fxAnnotArray; } 544
507 545 FX_BOOL OnMouseMove(const CPDF_Point& point, int nFlag);
508 public: 546 FX_BOOL OnMouseWheel(double deltaX,
509 » int» » » » » » GetPageIndex(); 547 double deltaY,
510 » void» » » » » » » LoadFXAnnots(); 548 const CPDF_Point& point,
511 private: 549 int nFlag);
512 » CPDF_Matrix m_curMatrix; 550 FX_BOOL IsValidAnnot(FX_LPVOID p);
513 551
514 private: 552 public:
515 » void PageView_OnHighlightFormFields(CFX_RenderDevice* pDevice, CPDFSDK_W idget* pWidget); 553 void GetCurrentMatrix(CPDF_Matrix& matrix) { matrix = m_curMatrix; }
516 554 void UpdateRects(CFX_RectArray& rects);
517 private: 555 void UpdateView(CPDFSDK_Annot* pAnnot);
518 » CPDF_Page* m_page; 556 CFX_PtrArray* GetAnnotList() { return &m_fxAnnotArray; }
519 » CPDF_AnnotList* m_pAnnotList; 557
520 558 public:
521 » //CPDFSDK_Annot* m_pFocusAnnot; 559 int GetPageIndex();
522 » CFX_PtrArray m_fxAnnotArray; 560 void LoadFXAnnots();
523 561
524 » CPDFSDK_Document* m_pSDKDoc; 562 private:
525 private: 563 CPDF_Matrix m_curMatrix;
526 » CPDFSDK_Widget* m_CaptureWidget; 564
527 » FX_BOOL m_bEnterWidget; 565 private:
528 » FX_BOOL m_bExitWidget; 566 void PageView_OnHighlightFormFields(CFX_RenderDevice* pDevice,
529 » FX_BOOL m_bOnWidget; 567 CPDFSDK_Widget* pWidget);
530 public: 568
531 » void SetValid(FX_BOOL bValid) {m_bValid = bValid;} 569 private:
532 » FX_BOOL IsValid() {return m_bValid;} 570 CPDF_Page* m_page;
533 private: 571 CPDF_AnnotList* m_pAnnotList;
534 » FX_BOOL m_bValid; 572
573 // CPDFSDK_Annot* m_pFocusAnnot;
574 CFX_PtrArray m_fxAnnotArray;
575
576 CPDFSDK_Document* m_pSDKDoc;
577
578 private:
579 CPDFSDK_Widget* m_CaptureWidget;
580 FX_BOOL m_bEnterWidget;
581 FX_BOOL m_bExitWidget;
582 FX_BOOL m_bOnWidget;
583
584 public:
585 void SetValid(FX_BOOL bValid) { m_bValid = bValid; }
586 FX_BOOL IsValid() { return m_bValid; }
587
588 private:
589 FX_BOOL m_bValid;
535 }; 590 };
536 591
537 592 template <class TYPE>
538 template<class TYPE> 593 class CGW_ArrayTemplate : public CFX_ArrayTemplate<TYPE> {
539 class CGW_ArrayTemplate : public CFX_ArrayTemplate<TYPE> 594 public:
540 { 595 CGW_ArrayTemplate() {}
541 public: 596 virtual ~CGW_ArrayTemplate() {}
542 » CGW_ArrayTemplate(){} 597
543 » virtual ~CGW_ArrayTemplate(){} 598 typedef int (*LP_COMPARE)(TYPE p1, TYPE p2);
544 » 599
545 » typedef int (*LP_COMPARE)(TYPE p1, TYPE p2); 600 void Sort(LP_COMPARE pCompare, FX_BOOL bAscent = TRUE) {
546 » 601 int nSize = this->GetSize();
547 » void Sort(LP_COMPARE pCompare, FX_BOOL bAscent = TRUE) 602 QuickSort(0, nSize - 1, bAscent, pCompare);
548 » { 603 }
549 » » int nSize = this->GetSize(); 604
550 » » QuickSort(0, nSize -1, bAscent, pCompare); 605 private:
551 » } 606 void QuickSort(FX_UINT nStartPos,
552 » 607 FX_UINT nStopPos,
553 private: 608 FX_BOOL bAscend,
554 » void QuickSort(FX_UINT nStartPos, FX_UINT nStopPos, FX_BOOL bAscend, LP_ COMPARE pCompare) 609 LP_COMPARE pCompare) {
555 » { 610 if (nStartPos >= nStopPos)
556 » » if (nStartPos >= nStopPos) return; 611 return;
557 » » 612
558 » » if ((nStopPos - nStartPos) == 1) 613 if ((nStopPos - nStartPos) == 1) {
559 » » { 614 TYPE Value1 = this->GetAt(nStartPos);
560 » » » TYPE Value1 = this->GetAt(nStartPos); 615 TYPE Value2 = this->GetAt(nStopPos);
561 » » » TYPE Value2 = this->GetAt(nStopPos); 616
562 » » » 617 int iGreate = (*pCompare)(Value1, Value2);
563 » » » int iGreate = (*pCompare)(Value1, Value2); 618 if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0)) {
564 » » » if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0 )) 619 this->SetAt(nStartPos, Value2);
565 » » » { 620 this->SetAt(nStopPos, Value1);
566 » » » » this->SetAt(nStartPos, Value2); 621 }
567 » » » » this->SetAt(nStopPos, Value1); 622 return;
568 » » » } 623 }
569 » » » return; 624
570 » » } 625 FX_UINT m = nStartPos + (nStopPos - nStartPos) / 2;
571 » » 626 FX_UINT i = nStartPos;
572 » » FX_UINT m = nStartPos + (nStopPos - nStartPos) / 2; 627
573 » » FX_UINT i = nStartPos; 628 TYPE Value = this->GetAt(m);
574 » » 629
575 » » TYPE Value = this->GetAt(m); 630 while (i < m) {
576 » » 631 TYPE temp = this->GetAt(i);
577 » » while (i < m) 632
578 » » { 633 int iGreate = (*pCompare)(temp, Value);
579 » » » TYPE temp = this->GetAt(i); 634 if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0)) {
580 » » » 635 this->InsertAt(m + 1, temp);
581 » » » int iGreate = (*pCompare)(temp, Value); 636 this->RemoveAt(i);
582 » » » if ((bAscend && iGreate > 0) || (!bAscend && iGreate < 0 )) 637 m--;
583 » » » { 638 } else {
584 » » » » this->InsertAt(m+1, temp); 639 i++;
585 » » » » this->RemoveAt(i); 640 }
586 » » » » m--; 641 }
587 » » » } 642
588 » » » else 643 FX_UINT j = nStopPos;
589 » » » { 644
590 » » » » i++; 645 while (j > m) {
591 » » » } 646 TYPE temp = this->GetAt(j);
592 » » } 647
593 » » 648 int iGreate = (*pCompare)(temp, Value);
594 » » FX_UINT j = nStopPos; 649 if ((bAscend && iGreate < 0) || (!bAscend && iGreate > 0)) {
595 » » 650 this->RemoveAt(j);
596 » » while (j > m) 651 this->InsertAt(m, temp);
597 » » { 652 m++;
598 » » » TYPE temp = this->GetAt(j); 653 } else {
599 » » » 654 j--;
600 » » » int iGreate = (*pCompare)(temp, Value); 655 }
601 » » » if ((bAscend && iGreate < 0) || (!bAscend && iGreate > 0 )) 656 }
602 » » » { 657
603 » » » » this->RemoveAt(j); 658 if (nStartPos < m)
604 » » » » this->InsertAt(m, temp); 659 QuickSort(nStartPos, m, bAscend, pCompare);
605 » » » » m++; 660 if (nStopPos > m)
606 » » » } 661 QuickSort(m, nStopPos, bAscend, pCompare);
607 » » » else 662 }
608 » » » {
609 » » » » j--;
610 » » » }
611 » » }
612 » »
613 » » if (nStartPos < m) QuickSort(nStartPos, m, bAscend, pCompare);
614 » » if (nStopPos > m) QuickSort(m, nStopPos, bAscend, pCompare);
615 » }
616 }; 663 };
617 664
618 665 #endif //_FPDFSDK_MGR_H
619 #endif //_FPDFSDK_MGR_H
620
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698