OLD | NEW |
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 #include "Document.h" | 7 #include "Document.h" |
8 | 8 |
9 #include "../../../third_party/base/numerics/safe_math.h" | 9 #include "../../../third_party/base/numerics/safe_math.h" |
10 #include "../../include/fsdk_mgr.h" // For CPDFDoc_Environment. | 10 #include "../../include/fsdk_mgr.h" // For CPDFDoc_Environment. |
11 #include "../../include/javascript/IJavaScript.h" | 11 #include "../../include/javascript/IJavaScript.h" |
12 #include "Field.h" | 12 #include "Field.h" |
13 #include "Icon.h" | 13 #include "Icon.h" |
14 #include "JS_Context.h" | 14 #include "JS_Context.h" |
15 #include "JS_Define.h" | 15 #include "JS_Define.h" |
16 #include "JS_EventHandler.h" | 16 #include "JS_EventHandler.h" |
17 #include "JS_Object.h" | 17 #include "JS_Object.h" |
18 #include "JS_Runtime.h" | 18 #include "JS_Runtime.h" |
19 #include "JS_Value.h" | 19 #include "JS_Value.h" |
20 #include "app.h" | 20 #include "app.h" |
21 #include "resource.h" | 21 #include "resource.h" |
22 | 22 |
23 static v8::Isolate* GetIsolate(IFXJS_Context* cc) { | 23 static v8::Isolate* GetIsolate(IJS_Context* cc) { |
24 CJS_Context* pContext = (CJS_Context*)cc; | 24 CJS_Context* pContext = (CJS_Context*)cc; |
25 ASSERT(pContext != NULL); | 25 ASSERT(pContext != NULL); |
26 | 26 |
27 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 27 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
28 ASSERT(pRuntime != NULL); | 28 ASSERT(pRuntime != NULL); |
29 | 29 |
30 return pRuntime->GetIsolate(); | 30 return pRuntime->GetIsolate(); |
31 } | 31 } |
32 | 32 |
33 BEGIN_JS_STATIC_CONST(CJS_PrintParamsObj) | 33 BEGIN_JS_STATIC_CONST(CJS_PrintParamsObj) |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 JS_STATIC_METHOD_ENTRY(replacePages) | 133 JS_STATIC_METHOD_ENTRY(replacePages) |
134 JS_STATIC_METHOD_ENTRY(resetForm) | 134 JS_STATIC_METHOD_ENTRY(resetForm) |
135 JS_STATIC_METHOD_ENTRY(removeIcon) | 135 JS_STATIC_METHOD_ENTRY(removeIcon) |
136 JS_STATIC_METHOD_ENTRY(saveAs) | 136 JS_STATIC_METHOD_ENTRY(saveAs) |
137 JS_STATIC_METHOD_ENTRY(submitForm) | 137 JS_STATIC_METHOD_ENTRY(submitForm) |
138 JS_STATIC_METHOD_ENTRY(mailDoc) | 138 JS_STATIC_METHOD_ENTRY(mailDoc) |
139 END_JS_STATIC_METHOD() | 139 END_JS_STATIC_METHOD() |
140 | 140 |
141 IMPLEMENT_JS_CLASS(CJS_Document, Document) | 141 IMPLEMENT_JS_CLASS(CJS_Document, Document) |
142 | 142 |
143 FX_BOOL CJS_Document::InitInstance(IFXJS_Context* cc) { | 143 FX_BOOL CJS_Document::InitInstance(IJS_Context* cc) { |
144 CJS_Context* pContext = (CJS_Context*)cc; | 144 CJS_Context* pContext = (CJS_Context*)cc; |
145 ASSERT(pContext != NULL); | 145 ASSERT(pContext != NULL); |
146 | 146 |
147 Document* pDoc = (Document*)GetEmbedObject(); | 147 Document* pDoc = (Document*)GetEmbedObject(); |
148 ASSERT(pDoc != NULL); | 148 ASSERT(pDoc != NULL); |
149 | 149 |
150 pDoc->AttachDoc(pContext->GetReaderDocument()); | 150 pDoc->AttachDoc(pContext->GetReaderDocument()); |
151 pDoc->SetIsolate(pContext->GetJSRuntime()->GetIsolate()); | 151 pDoc->SetIsolate(pContext->GetJSRuntime()->GetIsolate()); |
152 return TRUE; | 152 return TRUE; |
153 }; | 153 }; |
(...skipping 21 matching lines...) Expand all Loading... |
175 pData = NULL; | 175 pData = NULL; |
176 m_DelayData.SetAt(i, NULL); | 176 m_DelayData.SetAt(i, NULL); |
177 } | 177 } |
178 } | 178 } |
179 | 179 |
180 m_DelayData.RemoveAll(); | 180 m_DelayData.RemoveAll(); |
181 m_DelayAnnotData.RemoveAll(); | 181 m_DelayAnnotData.RemoveAll(); |
182 } | 182 } |
183 | 183 |
184 // the total number of fileds in document. | 184 // the total number of fileds in document. |
185 FX_BOOL Document::numFields(IFXJS_Context* cc, | 185 FX_BOOL Document::numFields(IJS_Context* cc, |
186 CJS_PropValue& vp, | 186 CJS_PropValue& vp, |
187 CFX_WideString& sError) { | 187 CFX_WideString& sError) { |
188 if (vp.IsSetting()) { | 188 if (vp.IsSetting()) { |
189 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 189 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
190 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); | 190 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); |
191 return FALSE; | 191 return FALSE; |
192 } | 192 } |
193 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); | 193 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); |
194 CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); | 194 CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); |
195 vp << (int)pPDFForm->CountFields(); | 195 vp << (int)pPDFForm->CountFields(); |
196 return TRUE; | 196 return TRUE; |
197 } | 197 } |
198 | 198 |
199 FX_BOOL Document::dirty(IFXJS_Context* cc, | 199 FX_BOOL Document::dirty(IJS_Context* cc, |
200 CJS_PropValue& vp, | 200 CJS_PropValue& vp, |
201 CFX_WideString& sError) { | 201 CFX_WideString& sError) { |
202 ASSERT(m_pDocument != NULL); | 202 ASSERT(m_pDocument != NULL); |
203 | 203 |
204 if (vp.IsGetting()) { | 204 if (vp.IsGetting()) { |
205 if (m_pDocument->GetChangeMark()) | 205 if (m_pDocument->GetChangeMark()) |
206 vp << true; | 206 vp << true; |
207 else | 207 else |
208 vp << false; | 208 vp << false; |
209 } else { | 209 } else { |
210 bool bChanged = false; | 210 bool bChanged = false; |
211 | 211 |
212 vp >> bChanged; | 212 vp >> bChanged; |
213 | 213 |
214 if (bChanged) | 214 if (bChanged) |
215 m_pDocument->SetChangeMark(); | 215 m_pDocument->SetChangeMark(); |
216 else | 216 else |
217 m_pDocument->ClearChangeMark(); | 217 m_pDocument->ClearChangeMark(); |
218 } | 218 } |
219 | 219 |
220 return TRUE; | 220 return TRUE; |
221 } | 221 } |
222 | 222 |
223 FX_BOOL Document::ADBE(IFXJS_Context* cc, | 223 FX_BOOL Document::ADBE(IJS_Context* cc, |
224 CJS_PropValue& vp, | 224 CJS_PropValue& vp, |
225 CFX_WideString& sError) { | 225 CFX_WideString& sError) { |
226 ASSERT(m_pDocument != NULL); | 226 ASSERT(m_pDocument != NULL); |
227 | 227 |
228 if (vp.IsGetting()) { | 228 if (vp.IsGetting()) { |
229 vp.SetNull(); | 229 vp.SetNull(); |
230 } else { | 230 } else { |
231 } | 231 } |
232 | 232 |
233 return TRUE; | 233 return TRUE; |
234 } | 234 } |
235 | 235 |
236 FX_BOOL Document::pageNum(IFXJS_Context* cc, | 236 FX_BOOL Document::pageNum(IJS_Context* cc, |
237 CJS_PropValue& vp, | 237 CJS_PropValue& vp, |
238 CFX_WideString& sError) { | 238 CFX_WideString& sError) { |
239 ASSERT(m_pDocument != NULL); | 239 ASSERT(m_pDocument != NULL); |
240 | 240 |
241 if (vp.IsGetting()) { | 241 if (vp.IsGetting()) { |
242 if (CPDFSDK_PageView* pPageView = m_pDocument->GetCurrentView()) { | 242 if (CPDFSDK_PageView* pPageView = m_pDocument->GetCurrentView()) { |
243 vp << pPageView->GetPageIndex(); | 243 vp << pPageView->GetPageIndex(); |
244 } | 244 } |
245 } else { | 245 } else { |
246 int iPageCount = m_pDocument->GetPageCount(); | 246 int iPageCount = m_pDocument->GetPageCount(); |
247 int iPageNum = 0; | 247 int iPageNum = 0; |
248 vp >> iPageNum; | 248 vp >> iPageNum; |
249 | 249 |
250 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); | 250 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); |
251 if (iPageNum >= 0 && iPageNum < iPageCount) { | 251 if (iPageNum >= 0 && iPageNum < iPageCount) { |
252 pEnv->JS_docgotoPage(iPageNum); | 252 pEnv->JS_docgotoPage(iPageNum); |
253 } else if (iPageNum >= iPageCount) { | 253 } else if (iPageNum >= iPageCount) { |
254 pEnv->JS_docgotoPage(iPageCount - 1); | 254 pEnv->JS_docgotoPage(iPageCount - 1); |
255 } else if (iPageNum < 0) { | 255 } else if (iPageNum < 0) { |
256 pEnv->JS_docgotoPage(0); | 256 pEnv->JS_docgotoPage(0); |
257 } | 257 } |
258 } | 258 } |
259 | 259 |
260 return TRUE; | 260 return TRUE; |
261 } | 261 } |
262 | 262 |
263 FX_BOOL Document::addAnnot(IFXJS_Context* cc, | 263 FX_BOOL Document::addAnnot(IJS_Context* cc, |
264 const CJS_Parameters& params, | 264 const CJS_Parameters& params, |
265 CJS_Value& vRet, | 265 CJS_Value& vRet, |
266 CFX_WideString& sError) { | 266 CFX_WideString& sError) { |
267 // Not supported. | 267 // Not supported. |
268 return TRUE; | 268 return TRUE; |
269 } | 269 } |
270 | 270 |
271 FX_BOOL Document::addField(IFXJS_Context* cc, | 271 FX_BOOL Document::addField(IJS_Context* cc, |
272 const CJS_Parameters& params, | 272 const CJS_Parameters& params, |
273 CJS_Value& vRet, | 273 CJS_Value& vRet, |
274 CFX_WideString& sError) { | 274 CFX_WideString& sError) { |
275 // Not supported. | 275 // Not supported. |
276 return TRUE; | 276 return TRUE; |
277 } | 277 } |
278 | 278 |
279 FX_BOOL Document::exportAsText(IFXJS_Context* cc, | 279 FX_BOOL Document::exportAsText(IJS_Context* cc, |
280 const CJS_Parameters& params, | 280 const CJS_Parameters& params, |
281 CJS_Value& vRet, | 281 CJS_Value& vRet, |
282 CFX_WideString& sError) { | 282 CFX_WideString& sError) { |
283 // Unsafe, not supported. | 283 // Unsafe, not supported. |
284 return TRUE; | 284 return TRUE; |
285 } | 285 } |
286 | 286 |
287 FX_BOOL Document::exportAsFDF(IFXJS_Context* cc, | 287 FX_BOOL Document::exportAsFDF(IJS_Context* cc, |
288 const CJS_Parameters& params, | 288 const CJS_Parameters& params, |
289 CJS_Value& vRet, | 289 CJS_Value& vRet, |
290 CFX_WideString& sError) { | 290 CFX_WideString& sError) { |
291 // Unsafe, not supported. | 291 // Unsafe, not supported. |
292 return TRUE; | 292 return TRUE; |
293 } | 293 } |
294 | 294 |
295 FX_BOOL Document::exportAsXFDF(IFXJS_Context* cc, | 295 FX_BOOL Document::exportAsXFDF(IJS_Context* cc, |
296 const CJS_Parameters& params, | 296 const CJS_Parameters& params, |
297 CJS_Value& vRet, | 297 CJS_Value& vRet, |
298 CFX_WideString& sError) { | 298 CFX_WideString& sError) { |
299 // Unsafe, not supported. | 299 // Unsafe, not supported. |
300 return TRUE; | 300 return TRUE; |
301 } | 301 } |
302 | 302 |
303 // Maps a field object in PDF document to a JavaScript variable | 303 // Maps a field object in PDF document to a JavaScript variable |
304 // comment: | 304 // comment: |
305 // note: the paremter cName, this is clue how to treat if the cName is not a | 305 // note: the paremter cName, this is clue how to treat if the cName is not a |
306 // valiable filed name in this document | 306 // valiable filed name in this document |
307 | 307 |
308 FX_BOOL Document::getField(IFXJS_Context* cc, | 308 FX_BOOL Document::getField(IJS_Context* cc, |
309 const CJS_Parameters& params, | 309 const CJS_Parameters& params, |
310 CJS_Value& vRet, | 310 CJS_Value& vRet, |
311 CFX_WideString& sError) { | 311 CFX_WideString& sError) { |
312 CJS_Context* pContext = (CJS_Context*)cc; | 312 CJS_Context* pContext = (CJS_Context*)cc; |
313 if (params.size() < 1) { | 313 if (params.size() < 1) { |
314 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); | 314 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); |
315 return FALSE; | 315 return FALSE; |
316 } | 316 } |
317 | 317 |
318 CFX_WideString wideName = params[0].ToCFXWideString(); | 318 CFX_WideString wideName = params[0].ToCFXWideString(); |
(...skipping 12 matching lines...) Expand all Loading... |
331 v8::Isolate* isolate = GetIsolate(cc); | 331 v8::Isolate* isolate = GetIsolate(cc); |
332 CJS_Field* pJSField = (CJS_Field*)FXJS_GetPrivate(isolate, pFieldObj); | 332 CJS_Field* pJSField = (CJS_Field*)FXJS_GetPrivate(isolate, pFieldObj); |
333 Field* pField = (Field*)pJSField->GetEmbedObject(); | 333 Field* pField = (Field*)pJSField->GetEmbedObject(); |
334 pField->AttachField(this, wideName); | 334 pField->AttachField(this, wideName); |
335 | 335 |
336 vRet = pJSField; | 336 vRet = pJSField; |
337 return TRUE; | 337 return TRUE; |
338 } | 338 } |
339 | 339 |
340 // Gets the name of the nth field in the document | 340 // Gets the name of the nth field in the document |
341 FX_BOOL Document::getNthFieldName(IFXJS_Context* cc, | 341 FX_BOOL Document::getNthFieldName(IJS_Context* cc, |
342 const CJS_Parameters& params, | 342 const CJS_Parameters& params, |
343 CJS_Value& vRet, | 343 CJS_Value& vRet, |
344 CFX_WideString& sError) { | 344 CFX_WideString& sError) { |
345 CJS_Context* pContext = (CJS_Context*)cc; | 345 CJS_Context* pContext = (CJS_Context*)cc; |
346 if (params.size() != 1) { | 346 if (params.size() != 1) { |
347 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); | 347 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); |
348 return FALSE; | 348 return FALSE; |
349 } | 349 } |
350 | 350 |
351 int nIndex = params[0].ToInt(); | 351 int nIndex = params[0].ToInt(); |
352 if (nIndex < 0) { | 352 if (nIndex < 0) { |
353 sError = JSGetStringFromID(pContext, IDS_STRING_JSVALUEERROR); | 353 sError = JSGetStringFromID(pContext, IDS_STRING_JSVALUEERROR); |
354 return FALSE; | 354 return FALSE; |
355 } | 355 } |
356 | 356 |
357 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); | 357 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); |
358 CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); | 358 CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); |
359 CPDF_FormField* pField = pPDFForm->GetField(nIndex); | 359 CPDF_FormField* pField = pPDFForm->GetField(nIndex); |
360 if (!pField) | 360 if (!pField) |
361 return FALSE; | 361 return FALSE; |
362 | 362 |
363 vRet = pField->GetFullName().c_str(); | 363 vRet = pField->GetFullName().c_str(); |
364 return TRUE; | 364 return TRUE; |
365 } | 365 } |
366 | 366 |
367 FX_BOOL Document::importAnFDF(IFXJS_Context* cc, | 367 FX_BOOL Document::importAnFDF(IJS_Context* cc, |
368 const CJS_Parameters& params, | 368 const CJS_Parameters& params, |
369 CJS_Value& vRet, | 369 CJS_Value& vRet, |
370 CFX_WideString& sError) { | 370 CFX_WideString& sError) { |
371 // Unsafe, not supported. | 371 // Unsafe, not supported. |
372 return TRUE; | 372 return TRUE; |
373 } | 373 } |
374 | 374 |
375 FX_BOOL Document::importAnXFDF(IFXJS_Context* cc, | 375 FX_BOOL Document::importAnXFDF(IJS_Context* cc, |
376 const CJS_Parameters& params, | 376 const CJS_Parameters& params, |
377 CJS_Value& vRet, | 377 CJS_Value& vRet, |
378 CFX_WideString& sError) { | 378 CFX_WideString& sError) { |
379 // Unsafe, not supported. | 379 // Unsafe, not supported. |
380 return TRUE; | 380 return TRUE; |
381 } | 381 } |
382 | 382 |
383 FX_BOOL Document::importTextData(IFXJS_Context* cc, | 383 FX_BOOL Document::importTextData(IJS_Context* cc, |
384 const CJS_Parameters& params, | 384 const CJS_Parameters& params, |
385 CJS_Value& vRet, | 385 CJS_Value& vRet, |
386 CFX_WideString& sError) { | 386 CFX_WideString& sError) { |
387 // Unsafe, not supported. | 387 // Unsafe, not supported. |
388 return TRUE; | 388 return TRUE; |
389 } | 389 } |
390 | 390 |
391 // exports the form data and mails the resulting fdf file as an attachment to | 391 // exports the form data and mails the resulting fdf file as an attachment to |
392 // all recipients. | 392 // all recipients. |
393 // comment: need reader supports | 393 // comment: need reader supports |
394 // note: | 394 // note: |
395 // int CPDFSDK_Document::mailForm(FX_BOOL bUI,String cto,string ccc,string | 395 // int CPDFSDK_Document::mailForm(FX_BOOL bUI,String cto,string ccc,string |
396 // cbcc,string cSubject,string cms); | 396 // cbcc,string cSubject,string cms); |
397 | 397 |
398 FX_BOOL Document::mailForm(IFXJS_Context* cc, | 398 FX_BOOL Document::mailForm(IJS_Context* cc, |
399 const CJS_Parameters& params, | 399 const CJS_Parameters& params, |
400 CJS_Value& vRet, | 400 CJS_Value& vRet, |
401 CFX_WideString& sError) { | 401 CFX_WideString& sError) { |
402 ASSERT(m_pDocument != NULL); | 402 ASSERT(m_pDocument != NULL); |
403 | 403 |
404 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) | 404 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) |
405 return FALSE; | 405 return FALSE; |
406 | 406 |
407 int iLength = params.size(); | 407 int iLength = params.size(); |
408 | 408 |
(...skipping 20 matching lines...) Expand all Loading... |
429 ASSERT(pRuntime != NULL); | 429 ASSERT(pRuntime != NULL); |
430 | 430 |
431 pRuntime->BeginBlock(); | 431 pRuntime->BeginBlock(); |
432 pEnv->JS_docmailForm(textBuf.GetBuffer(), textBuf.GetLength(), bUI, | 432 pEnv->JS_docmailForm(textBuf.GetBuffer(), textBuf.GetLength(), bUI, |
433 cTo.c_str(), cSubject.c_str(), cCc.c_str(), cBcc.c_str(), | 433 cTo.c_str(), cSubject.c_str(), cCc.c_str(), cBcc.c_str(), |
434 cMsg.c_str()); | 434 cMsg.c_str()); |
435 pRuntime->EndBlock(); | 435 pRuntime->EndBlock(); |
436 return TRUE; | 436 return TRUE; |
437 } | 437 } |
438 | 438 |
439 FX_BOOL Document::print(IFXJS_Context* cc, | 439 FX_BOOL Document::print(IJS_Context* cc, |
440 const CJS_Parameters& params, | 440 const CJS_Parameters& params, |
441 CJS_Value& vRet, | 441 CJS_Value& vRet, |
442 CFX_WideString& sError) { | 442 CFX_WideString& sError) { |
443 FX_BOOL bUI = TRUE; | 443 FX_BOOL bUI = TRUE; |
444 int nStart = 0; | 444 int nStart = 0; |
445 int nEnd = 0; | 445 int nEnd = 0; |
446 FX_BOOL bSilent = FALSE; | 446 FX_BOOL bSilent = FALSE; |
447 FX_BOOL bShrinkToFit = FALSE; | 447 FX_BOOL bShrinkToFit = FALSE; |
448 FX_BOOL bPrintAsImage = FALSE; | 448 FX_BOOL bPrintAsImage = FALSE; |
449 FX_BOOL bReverse = FALSE; | 449 FX_BOOL bReverse = FALSE; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 bReverse, bAnnotations); | 497 bReverse, bAnnotations); |
498 return TRUE; | 498 return TRUE; |
499 } | 499 } |
500 return FALSE; | 500 return FALSE; |
501 } | 501 } |
502 | 502 |
503 // removes the specified field from the document. | 503 // removes the specified field from the document. |
504 // comment: | 504 // comment: |
505 // note: if the filed name is not retional, adobe is dumb for it. | 505 // note: if the filed name is not retional, adobe is dumb for it. |
506 | 506 |
507 FX_BOOL Document::removeField(IFXJS_Context* cc, | 507 FX_BOOL Document::removeField(IJS_Context* cc, |
508 const CJS_Parameters& params, | 508 const CJS_Parameters& params, |
509 CJS_Value& vRet, | 509 CJS_Value& vRet, |
510 CFX_WideString& sError) { | 510 CFX_WideString& sError) { |
511 ASSERT(m_pDocument != NULL); | 511 ASSERT(m_pDocument != NULL); |
512 | 512 |
513 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || | 513 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || |
514 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM))) | 514 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM))) |
515 return FALSE; | 515 return FALSE; |
516 | 516 |
517 CJS_Context* pContext = (CJS_Context*)cc; | 517 CJS_Context* pContext = (CJS_Context*)cc; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 m_pDocument->SetChangeMark(); | 555 m_pDocument->SetChangeMark(); |
556 } | 556 } |
557 | 557 |
558 return TRUE; | 558 return TRUE; |
559 } | 559 } |
560 | 560 |
561 // reset filed values within a document. | 561 // reset filed values within a document. |
562 // comment: | 562 // comment: |
563 // note: if the fields names r not rational, aodbe is dumb for it. | 563 // note: if the fields names r not rational, aodbe is dumb for it. |
564 | 564 |
565 FX_BOOL Document::resetForm(IFXJS_Context* cc, | 565 FX_BOOL Document::resetForm(IJS_Context* cc, |
566 const CJS_Parameters& params, | 566 const CJS_Parameters& params, |
567 CJS_Value& vRet, | 567 CJS_Value& vRet, |
568 CFX_WideString& sError) { | 568 CFX_WideString& sError) { |
569 ASSERT(m_pDocument != NULL); | 569 ASSERT(m_pDocument != NULL); |
570 | 570 |
571 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || | 571 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || |
572 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || | 572 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || |
573 m_pDocument->GetPermissions(FPDFPERM_FILL_FORM))) | 573 m_pDocument->GetPermissions(FPDFPERM_FILL_FORM))) |
574 return FALSE; | 574 return FALSE; |
575 | 575 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 m_pDocument->SetChangeMark(); | 610 m_pDocument->SetChangeMark(); |
611 } | 611 } |
612 } else { | 612 } else { |
613 pPDFForm->ResetForm(TRUE); | 613 pPDFForm->ResetForm(TRUE); |
614 m_pDocument->SetChangeMark(); | 614 m_pDocument->SetChangeMark(); |
615 } | 615 } |
616 | 616 |
617 return TRUE; | 617 return TRUE; |
618 } | 618 } |
619 | 619 |
620 FX_BOOL Document::saveAs(IFXJS_Context* cc, | 620 FX_BOOL Document::saveAs(IJS_Context* cc, |
621 const CJS_Parameters& params, | 621 const CJS_Parameters& params, |
622 CJS_Value& vRet, | 622 CJS_Value& vRet, |
623 CFX_WideString& sError) { | 623 CFX_WideString& sError) { |
624 // Unsafe, not supported. | 624 // Unsafe, not supported. |
625 return TRUE; | 625 return TRUE; |
626 } | 626 } |
627 | 627 |
628 FX_BOOL Document::submitForm(IFXJS_Context* cc, | 628 FX_BOOL Document::submitForm(IJS_Context* cc, |
629 const CJS_Parameters& params, | 629 const CJS_Parameters& params, |
630 CJS_Value& vRet, | 630 CJS_Value& vRet, |
631 CFX_WideString& sError) { | 631 CFX_WideString& sError) { |
632 ASSERT(m_pDocument != NULL); | 632 ASSERT(m_pDocument != NULL); |
633 CJS_Context* pContext = (CJS_Context*)cc; | 633 CJS_Context* pContext = (CJS_Context*)cc; |
634 int nSize = params.size(); | 634 int nSize = params.size(); |
635 if (nSize < 1) { | 635 if (nSize < 1) { |
636 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); | 636 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); |
637 return FALSE; | 637 return FALSE; |
638 } | 638 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 FX_BOOL Document::ExtractFileName(CPDFSDK_Document* pDoc, | 718 FX_BOOL Document::ExtractFileName(CPDFSDK_Document* pDoc, |
719 CFX_ByteString& strFileName) { | 719 CFX_ByteString& strFileName) { |
720 return FALSE; | 720 return FALSE; |
721 } | 721 } |
722 | 722 |
723 FX_BOOL Document::ExtractFolderName(CPDFSDK_Document* pDoc, | 723 FX_BOOL Document::ExtractFolderName(CPDFSDK_Document* pDoc, |
724 CFX_ByteString& strFolderName) { | 724 CFX_ByteString& strFolderName) { |
725 return FALSE; | 725 return FALSE; |
726 } | 726 } |
727 | 727 |
728 FX_BOOL Document::bookmarkRoot(IFXJS_Context* cc, | 728 FX_BOOL Document::bookmarkRoot(IJS_Context* cc, |
729 CJS_PropValue& vp, | 729 CJS_PropValue& vp, |
730 CFX_WideString& sError) { | 730 CFX_WideString& sError) { |
731 return TRUE; | 731 return TRUE; |
732 } | 732 } |
733 | 733 |
734 FX_BOOL Document::mailDoc(IFXJS_Context* cc, | 734 FX_BOOL Document::mailDoc(IJS_Context* cc, |
735 const CJS_Parameters& params, | 735 const CJS_Parameters& params, |
736 CJS_Value& vRet, | 736 CJS_Value& vRet, |
737 CFX_WideString& sError) { | 737 CFX_WideString& sError) { |
738 ASSERT(m_pDocument != NULL); | 738 ASSERT(m_pDocument != NULL); |
739 | 739 |
740 FX_BOOL bUI = TRUE; | 740 FX_BOOL bUI = TRUE; |
741 CFX_WideString cTo = L""; | 741 CFX_WideString cTo = L""; |
742 CFX_WideString cCc = L""; | 742 CFX_WideString cCc = L""; |
743 CFX_WideString cBcc = L""; | 743 CFX_WideString cBcc = L""; |
744 CFX_WideString cSubject = L""; | 744 CFX_WideString cSubject = L""; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
789 | 789 |
790 pRuntime->BeginBlock(); | 790 pRuntime->BeginBlock(); |
791 CPDFDoc_Environment* pEnv = pRuntime->GetReaderApp(); | 791 CPDFDoc_Environment* pEnv = pRuntime->GetReaderApp(); |
792 pEnv->JS_docmailForm(NULL, 0, bUI, cTo.c_str(), cSubject.c_str(), cCc.c_str(), | 792 pEnv->JS_docmailForm(NULL, 0, bUI, cTo.c_str(), cSubject.c_str(), cCc.c_str(), |
793 cBcc.c_str(), cMsg.c_str()); | 793 cBcc.c_str(), cMsg.c_str()); |
794 pRuntime->EndBlock(); | 794 pRuntime->EndBlock(); |
795 | 795 |
796 return TRUE; | 796 return TRUE; |
797 } | 797 } |
798 | 798 |
799 FX_BOOL Document::author(IFXJS_Context* cc, | 799 FX_BOOL Document::author(IJS_Context* cc, |
800 CJS_PropValue& vp, | 800 CJS_PropValue& vp, |
801 CFX_WideString& sError) { | 801 CFX_WideString& sError) { |
802 ASSERT(m_pDocument != NULL); | 802 ASSERT(m_pDocument != NULL); |
803 | 803 |
804 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo(); | 804 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo(); |
805 if (!pDictionary) | 805 if (!pDictionary) |
806 return FALSE; | 806 return FALSE; |
807 | 807 |
808 if (vp.IsGetting()) { | 808 if (vp.IsGetting()) { |
809 vp << pDictionary->GetUnicodeText("Author"); | 809 vp << pDictionary->GetUnicodeText("Author"); |
810 return TRUE; | 810 return TRUE; |
811 } else { | 811 } else { |
812 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) | 812 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) |
813 return FALSE; | 813 return FALSE; |
814 | 814 |
815 CFX_WideString csAuthor; | 815 CFX_WideString csAuthor; |
816 vp >> csAuthor; | 816 vp >> csAuthor; |
817 pDictionary->SetAtString("Author", PDF_EncodeText(csAuthor)); | 817 pDictionary->SetAtString("Author", PDF_EncodeText(csAuthor)); |
818 m_pDocument->SetChangeMark(); | 818 m_pDocument->SetChangeMark(); |
819 return TRUE; | 819 return TRUE; |
820 } | 820 } |
821 } | 821 } |
822 | 822 |
823 FX_BOOL Document::info(IFXJS_Context* cc, | 823 FX_BOOL Document::info(IJS_Context* cc, |
824 CJS_PropValue& vp, | 824 CJS_PropValue& vp, |
825 CFX_WideString& sError) { | 825 CFX_WideString& sError) { |
826 ASSERT(m_pDocument != NULL); | 826 ASSERT(m_pDocument != NULL); |
827 | 827 |
828 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo(); | 828 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo(); |
829 if (!pDictionary) | 829 if (!pDictionary) |
830 return FALSE; | 830 return FALSE; |
831 | 831 |
832 CFX_WideString cwAuthor = pDictionary->GetUnicodeText("Author"); | 832 CFX_WideString cwAuthor = pDictionary->GetUnicodeText("Author"); |
833 CFX_WideString cwTitle = pDictionary->GetUnicodeText("Title"); | 833 CFX_WideString cwTitle = pDictionary->GetUnicodeText("Title"); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 (float)pValueObj->GetNumber()); | 871 (float)pValueObj->GetNumber()); |
872 if (pValueObj->GetType() == PDFOBJ_BOOLEAN) | 872 if (pValueObj->GetType() == PDFOBJ_BOOLEAN) |
873 FXJS_PutObjectBoolean(isolate, pObj, wsKey.c_str(), | 873 FXJS_PutObjectBoolean(isolate, pObj, wsKey.c_str(), |
874 (bool)pValueObj->GetInteger()); | 874 (bool)pValueObj->GetInteger()); |
875 } | 875 } |
876 vp << pObj; | 876 vp << pObj; |
877 } | 877 } |
878 return TRUE; | 878 return TRUE; |
879 } | 879 } |
880 | 880 |
881 FX_BOOL Document::creationDate(IFXJS_Context* cc, | 881 FX_BOOL Document::creationDate(IJS_Context* cc, |
882 CJS_PropValue& vp, | 882 CJS_PropValue& vp, |
883 CFX_WideString& sError) { | 883 CFX_WideString& sError) { |
884 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo(); | 884 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo(); |
885 if (!pDictionary) | 885 if (!pDictionary) |
886 return FALSE; | 886 return FALSE; |
887 | 887 |
888 if (vp.IsGetting()) { | 888 if (vp.IsGetting()) { |
889 vp << pDictionary->GetUnicodeText("CreationDate"); | 889 vp << pDictionary->GetUnicodeText("CreationDate"); |
890 } else { | 890 } else { |
891 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) | 891 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) |
892 return FALSE; | 892 return FALSE; |
893 | 893 |
894 CFX_WideString csCreationDate; | 894 CFX_WideString csCreationDate; |
895 vp >> csCreationDate; | 895 vp >> csCreationDate; |
896 pDictionary->SetAtString("CreationDate", PDF_EncodeText(csCreationDate)); | 896 pDictionary->SetAtString("CreationDate", PDF_EncodeText(csCreationDate)); |
897 m_pDocument->SetChangeMark(); | 897 m_pDocument->SetChangeMark(); |
898 } | 898 } |
899 return TRUE; | 899 return TRUE; |
900 } | 900 } |
901 | 901 |
902 FX_BOOL Document::creator(IFXJS_Context* cc, | 902 FX_BOOL Document::creator(IJS_Context* cc, |
903 CJS_PropValue& vp, | 903 CJS_PropValue& vp, |
904 CFX_WideString& sError) { | 904 CFX_WideString& sError) { |
905 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo(); | 905 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo(); |
906 if (!pDictionary) | 906 if (!pDictionary) |
907 return FALSE; | 907 return FALSE; |
908 | 908 |
909 if (vp.IsGetting()) { | 909 if (vp.IsGetting()) { |
910 vp << pDictionary->GetUnicodeText("Creator"); | 910 vp << pDictionary->GetUnicodeText("Creator"); |
911 } else { | 911 } else { |
912 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) | 912 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) |
913 return FALSE; | 913 return FALSE; |
914 | 914 |
915 CFX_WideString csCreator; | 915 CFX_WideString csCreator; |
916 vp >> csCreator; | 916 vp >> csCreator; |
917 pDictionary->SetAtString("Creator", PDF_EncodeText(csCreator)); | 917 pDictionary->SetAtString("Creator", PDF_EncodeText(csCreator)); |
918 m_pDocument->SetChangeMark(); | 918 m_pDocument->SetChangeMark(); |
919 } | 919 } |
920 return TRUE; | 920 return TRUE; |
921 } | 921 } |
922 | 922 |
923 FX_BOOL Document::delay(IFXJS_Context* cc, | 923 FX_BOOL Document::delay(IJS_Context* cc, |
924 CJS_PropValue& vp, | 924 CJS_PropValue& vp, |
925 CFX_WideString& sError) { | 925 CFX_WideString& sError) { |
926 if (vp.IsGetting()) { | 926 if (vp.IsGetting()) { |
927 vp << m_bDelay; | 927 vp << m_bDelay; |
928 } else { | 928 } else { |
929 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) | 929 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) |
930 return FALSE; | 930 return FALSE; |
931 | 931 |
932 vp >> m_bDelay; | 932 vp >> m_bDelay; |
933 if (m_bDelay) { | 933 if (m_bDelay) { |
(...skipping 14 matching lines...) Expand all Loading... |
948 CJS_DelayData* pData = DelayDataToProcess.GetAt(i); | 948 CJS_DelayData* pData = DelayDataToProcess.GetAt(i); |
949 Field::DoDelay(m_pDocument, pData); | 949 Field::DoDelay(m_pDocument, pData); |
950 DelayDataToProcess.SetAt(i, NULL); | 950 DelayDataToProcess.SetAt(i, NULL); |
951 delete pData; | 951 delete pData; |
952 } | 952 } |
953 } | 953 } |
954 } | 954 } |
955 return TRUE; | 955 return TRUE; |
956 } | 956 } |
957 | 957 |
958 FX_BOOL Document::keywords(IFXJS_Context* cc, | 958 FX_BOOL Document::keywords(IJS_Context* cc, |
959 CJS_PropValue& vp, | 959 CJS_PropValue& vp, |
960 CFX_WideString& sError) { | 960 CFX_WideString& sError) { |
961 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo(); | 961 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo(); |
962 if (!pDictionary) | 962 if (!pDictionary) |
963 return FALSE; | 963 return FALSE; |
964 | 964 |
965 if (vp.IsGetting()) { | 965 if (vp.IsGetting()) { |
966 vp << pDictionary->GetUnicodeText("Keywords"); | 966 vp << pDictionary->GetUnicodeText("Keywords"); |
967 } else { | 967 } else { |
968 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) | 968 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) |
969 return FALSE; | 969 return FALSE; |
970 | 970 |
971 CFX_WideString csKeywords; | 971 CFX_WideString csKeywords; |
972 vp >> csKeywords; | 972 vp >> csKeywords; |
973 pDictionary->SetAtString("Keywords", PDF_EncodeText(csKeywords)); | 973 pDictionary->SetAtString("Keywords", PDF_EncodeText(csKeywords)); |
974 m_pDocument->SetChangeMark(); | 974 m_pDocument->SetChangeMark(); |
975 } | 975 } |
976 return TRUE; | 976 return TRUE; |
977 } | 977 } |
978 | 978 |
979 FX_BOOL Document::modDate(IFXJS_Context* cc, | 979 FX_BOOL Document::modDate(IJS_Context* cc, |
980 CJS_PropValue& vp, | 980 CJS_PropValue& vp, |
981 CFX_WideString& sError) { | 981 CFX_WideString& sError) { |
982 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo(); | 982 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo(); |
983 if (!pDictionary) | 983 if (!pDictionary) |
984 return FALSE; | 984 return FALSE; |
985 | 985 |
986 if (vp.IsGetting()) { | 986 if (vp.IsGetting()) { |
987 vp << pDictionary->GetUnicodeText("ModDate"); | 987 vp << pDictionary->GetUnicodeText("ModDate"); |
988 } else { | 988 } else { |
989 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) | 989 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) |
990 return FALSE; | 990 return FALSE; |
991 | 991 |
992 CFX_WideString csmodDate; | 992 CFX_WideString csmodDate; |
993 vp >> csmodDate; | 993 vp >> csmodDate; |
994 pDictionary->SetAtString("ModDate", PDF_EncodeText(csmodDate)); | 994 pDictionary->SetAtString("ModDate", PDF_EncodeText(csmodDate)); |
995 m_pDocument->SetChangeMark(); | 995 m_pDocument->SetChangeMark(); |
996 } | 996 } |
997 return TRUE; | 997 return TRUE; |
998 } | 998 } |
999 | 999 |
1000 FX_BOOL Document::producer(IFXJS_Context* cc, | 1000 FX_BOOL Document::producer(IJS_Context* cc, |
1001 CJS_PropValue& vp, | 1001 CJS_PropValue& vp, |
1002 CFX_WideString& sError) { | 1002 CFX_WideString& sError) { |
1003 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo(); | 1003 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo(); |
1004 if (!pDictionary) | 1004 if (!pDictionary) |
1005 return FALSE; | 1005 return FALSE; |
1006 | 1006 |
1007 if (vp.IsGetting()) { | 1007 if (vp.IsGetting()) { |
1008 vp << pDictionary->GetUnicodeText("Producer"); | 1008 vp << pDictionary->GetUnicodeText("Producer"); |
1009 } else { | 1009 } else { |
1010 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) | 1010 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) |
1011 return FALSE; | 1011 return FALSE; |
1012 | 1012 |
1013 CFX_WideString csproducer; | 1013 CFX_WideString csproducer; |
1014 vp >> csproducer; | 1014 vp >> csproducer; |
1015 pDictionary->SetAtString("Producer", PDF_EncodeText(csproducer)); | 1015 pDictionary->SetAtString("Producer", PDF_EncodeText(csproducer)); |
1016 m_pDocument->SetChangeMark(); | 1016 m_pDocument->SetChangeMark(); |
1017 } | 1017 } |
1018 return TRUE; | 1018 return TRUE; |
1019 } | 1019 } |
1020 | 1020 |
1021 FX_BOOL Document::subject(IFXJS_Context* cc, | 1021 FX_BOOL Document::subject(IJS_Context* cc, |
1022 CJS_PropValue& vp, | 1022 CJS_PropValue& vp, |
1023 CFX_WideString& sError) { | 1023 CFX_WideString& sError) { |
1024 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo(); | 1024 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo(); |
1025 if (!pDictionary) | 1025 if (!pDictionary) |
1026 return FALSE; | 1026 return FALSE; |
1027 | 1027 |
1028 if (vp.IsGetting()) { | 1028 if (vp.IsGetting()) { |
1029 vp << pDictionary->GetUnicodeText("Subject"); | 1029 vp << pDictionary->GetUnicodeText("Subject"); |
1030 } else { | 1030 } else { |
1031 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) | 1031 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) |
1032 return FALSE; | 1032 return FALSE; |
1033 | 1033 |
1034 CFX_WideString cssubject; | 1034 CFX_WideString cssubject; |
1035 vp >> cssubject; | 1035 vp >> cssubject; |
1036 pDictionary->SetAtString("Subject", PDF_EncodeText(cssubject)); | 1036 pDictionary->SetAtString("Subject", PDF_EncodeText(cssubject)); |
1037 m_pDocument->SetChangeMark(); | 1037 m_pDocument->SetChangeMark(); |
1038 } | 1038 } |
1039 return TRUE; | 1039 return TRUE; |
1040 } | 1040 } |
1041 | 1041 |
1042 FX_BOOL Document::title(IFXJS_Context* cc, | 1042 FX_BOOL Document::title(IJS_Context* cc, |
1043 CJS_PropValue& vp, | 1043 CJS_PropValue& vp, |
1044 CFX_WideString& sError) { | 1044 CFX_WideString& sError) { |
1045 if (m_pDocument == NULL || m_pDocument->GetDocument() == NULL) | 1045 if (m_pDocument == NULL || m_pDocument->GetDocument() == NULL) |
1046 return FALSE; | 1046 return FALSE; |
1047 | 1047 |
1048 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo(); | 1048 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetInfo(); |
1049 if (!pDictionary) | 1049 if (!pDictionary) |
1050 return FALSE; | 1050 return FALSE; |
1051 | 1051 |
1052 if (vp.IsGetting()) { | 1052 if (vp.IsGetting()) { |
1053 vp << pDictionary->GetUnicodeText("Title"); | 1053 vp << pDictionary->GetUnicodeText("Title"); |
1054 } else { | 1054 } else { |
1055 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) | 1055 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) |
1056 return FALSE; | 1056 return FALSE; |
1057 | 1057 |
1058 CFX_WideString cstitle; | 1058 CFX_WideString cstitle; |
1059 vp >> cstitle; | 1059 vp >> cstitle; |
1060 pDictionary->SetAtString("Title", PDF_EncodeText(cstitle)); | 1060 pDictionary->SetAtString("Title", PDF_EncodeText(cstitle)); |
1061 m_pDocument->SetChangeMark(); | 1061 m_pDocument->SetChangeMark(); |
1062 } | 1062 } |
1063 return TRUE; | 1063 return TRUE; |
1064 } | 1064 } |
1065 | 1065 |
1066 FX_BOOL Document::numPages(IFXJS_Context* cc, | 1066 FX_BOOL Document::numPages(IJS_Context* cc, |
1067 CJS_PropValue& vp, | 1067 CJS_PropValue& vp, |
1068 CFX_WideString& sError) { | 1068 CFX_WideString& sError) { |
1069 if (vp.IsSetting()) { | 1069 if (vp.IsSetting()) { |
1070 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 1070 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
1071 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); | 1071 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); |
1072 return FALSE; | 1072 return FALSE; |
1073 } | 1073 } |
1074 vp << m_pDocument->GetPageCount(); | 1074 vp << m_pDocument->GetPageCount(); |
1075 return TRUE; | 1075 return TRUE; |
1076 } | 1076 } |
1077 | 1077 |
1078 FX_BOOL Document::external(IFXJS_Context* cc, | 1078 FX_BOOL Document::external(IJS_Context* cc, |
1079 CJS_PropValue& vp, | 1079 CJS_PropValue& vp, |
1080 CFX_WideString& sError) { | 1080 CFX_WideString& sError) { |
1081 // In Chrome case,should always return true. | 1081 // In Chrome case,should always return true. |
1082 if (vp.IsGetting()) { | 1082 if (vp.IsGetting()) { |
1083 vp << true; | 1083 vp << true; |
1084 } | 1084 } |
1085 return TRUE; | 1085 return TRUE; |
1086 } | 1086 } |
1087 | 1087 |
1088 FX_BOOL Document::filesize(IFXJS_Context* cc, | 1088 FX_BOOL Document::filesize(IJS_Context* cc, |
1089 CJS_PropValue& vp, | 1089 CJS_PropValue& vp, |
1090 CFX_WideString& sError) { | 1090 CFX_WideString& sError) { |
1091 if (vp.IsSetting()) { | 1091 if (vp.IsSetting()) { |
1092 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 1092 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
1093 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); | 1093 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); |
1094 return FALSE; | 1094 return FALSE; |
1095 } | 1095 } |
1096 vp << 0; | 1096 vp << 0; |
1097 return TRUE; | 1097 return TRUE; |
1098 } | 1098 } |
1099 | 1099 |
1100 FX_BOOL Document::mouseX(IFXJS_Context* cc, | 1100 FX_BOOL Document::mouseX(IJS_Context* cc, |
1101 CJS_PropValue& vp, | 1101 CJS_PropValue& vp, |
1102 CFX_WideString& sError) { | 1102 CFX_WideString& sError) { |
1103 return TRUE; | 1103 return TRUE; |
1104 } | 1104 } |
1105 | 1105 |
1106 FX_BOOL Document::mouseY(IFXJS_Context* cc, | 1106 FX_BOOL Document::mouseY(IJS_Context* cc, |
1107 CJS_PropValue& vp, | 1107 CJS_PropValue& vp, |
1108 CFX_WideString& sError) { | 1108 CFX_WideString& sError) { |
1109 return TRUE; | 1109 return TRUE; |
1110 } | 1110 } |
1111 | 1111 |
1112 FX_BOOL Document::baseURL(IFXJS_Context* cc, | 1112 FX_BOOL Document::baseURL(IJS_Context* cc, |
1113 CJS_PropValue& vp, | 1113 CJS_PropValue& vp, |
1114 CFX_WideString& sError) { | 1114 CFX_WideString& sError) { |
1115 if (vp.IsGetting()) { | 1115 if (vp.IsGetting()) { |
1116 vp << m_cwBaseURL; | 1116 vp << m_cwBaseURL; |
1117 } else { | 1117 } else { |
1118 vp >> m_cwBaseURL; | 1118 vp >> m_cwBaseURL; |
1119 } | 1119 } |
1120 return TRUE; | 1120 return TRUE; |
1121 } | 1121 } |
1122 | 1122 |
1123 FX_BOOL Document::calculate(IFXJS_Context* cc, | 1123 FX_BOOL Document::calculate(IJS_Context* cc, |
1124 CJS_PropValue& vp, | 1124 CJS_PropValue& vp, |
1125 CFX_WideString& sError) { | 1125 CFX_WideString& sError) { |
1126 ASSERT(m_pDocument != NULL); | 1126 ASSERT(m_pDocument != NULL); |
1127 | 1127 |
1128 CPDFSDK_InterForm* pInterForm = | 1128 CPDFSDK_InterForm* pInterForm = |
1129 (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); | 1129 (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); |
1130 ASSERT(pInterForm != NULL); | 1130 ASSERT(pInterForm != NULL); |
1131 | 1131 |
1132 if (vp.IsGetting()) { | 1132 if (vp.IsGetting()) { |
1133 if (pInterForm->IsCalculateEnabled()) | 1133 if (pInterForm->IsCalculateEnabled()) |
1134 vp << true; | 1134 vp << true; |
1135 else | 1135 else |
1136 vp << false; | 1136 vp << false; |
1137 } else { | 1137 } else { |
1138 bool bCalculate; | 1138 bool bCalculate; |
1139 vp >> bCalculate; | 1139 vp >> bCalculate; |
1140 | 1140 |
1141 pInterForm->EnableCalculate(bCalculate); | 1141 pInterForm->EnableCalculate(bCalculate); |
1142 } | 1142 } |
1143 | 1143 |
1144 return TRUE; | 1144 return TRUE; |
1145 } | 1145 } |
1146 | 1146 |
1147 FX_BOOL Document::documentFileName(IFXJS_Context* cc, | 1147 FX_BOOL Document::documentFileName(IJS_Context* cc, |
1148 CJS_PropValue& vp, | 1148 CJS_PropValue& vp, |
1149 CFX_WideString& sError) { | 1149 CFX_WideString& sError) { |
1150 if (vp.IsSetting()) { | 1150 if (vp.IsSetting()) { |
1151 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 1151 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
1152 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); | 1152 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); |
1153 return FALSE; | 1153 return FALSE; |
1154 } | 1154 } |
1155 CFX_WideString wsFilePath = m_pDocument->GetPath(); | 1155 CFX_WideString wsFilePath = m_pDocument->GetPath(); |
1156 int32_t i = wsFilePath.GetLength() - 1; | 1156 int32_t i = wsFilePath.GetLength() - 1; |
1157 for (; i >= 0; i--) { | 1157 for (; i >= 0; i--) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1201 } | 1201 } |
1202 pResult[iLength] = L'\0'; | 1202 pResult[iLength] = L'\0'; |
1203 | 1203 |
1204 cbFrom.ReleaseBuffer(); | 1204 cbFrom.ReleaseBuffer(); |
1205 CFX_WideString cbRet = CFX_WideString(pResult); | 1205 CFX_WideString cbRet = CFX_WideString(pResult); |
1206 free(pResult); | 1206 free(pResult); |
1207 pResult = NULL; | 1207 pResult = NULL; |
1208 return cbRet; | 1208 return cbRet; |
1209 } | 1209 } |
1210 | 1210 |
1211 FX_BOOL Document::path(IFXJS_Context* cc, | 1211 FX_BOOL Document::path(IJS_Context* cc, |
1212 CJS_PropValue& vp, | 1212 CJS_PropValue& vp, |
1213 CFX_WideString& sError) { | 1213 CFX_WideString& sError) { |
1214 if (vp.IsSetting()) { | 1214 if (vp.IsSetting()) { |
1215 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 1215 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
1216 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); | 1216 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); |
1217 return FALSE; | 1217 return FALSE; |
1218 } | 1218 } |
1219 vp << app::SysPathToPDFPath(m_pDocument->GetPath()); | 1219 vp << app::SysPathToPDFPath(m_pDocument->GetPath()); |
1220 return TRUE; | 1220 return TRUE; |
1221 } | 1221 } |
1222 | 1222 |
1223 FX_BOOL Document::pageWindowRect(IFXJS_Context* cc, | 1223 FX_BOOL Document::pageWindowRect(IJS_Context* cc, |
1224 CJS_PropValue& vp, | 1224 CJS_PropValue& vp, |
1225 CFX_WideString& sError) { | 1225 CFX_WideString& sError) { |
1226 return TRUE; | 1226 return TRUE; |
1227 } | 1227 } |
1228 | 1228 |
1229 FX_BOOL Document::layout(IFXJS_Context* cc, | 1229 FX_BOOL Document::layout(IJS_Context* cc, |
1230 CJS_PropValue& vp, | 1230 CJS_PropValue& vp, |
1231 CFX_WideString& sError) { | 1231 CFX_WideString& sError) { |
1232 return TRUE; | 1232 return TRUE; |
1233 } | 1233 } |
1234 | 1234 |
1235 FX_BOOL Document::addLink(IFXJS_Context* cc, | 1235 FX_BOOL Document::addLink(IJS_Context* cc, |
1236 const CJS_Parameters& params, | 1236 const CJS_Parameters& params, |
1237 CJS_Value& vRet, | 1237 CJS_Value& vRet, |
1238 CFX_WideString& sError) { | 1238 CFX_WideString& sError) { |
1239 return TRUE; | 1239 return TRUE; |
1240 } | 1240 } |
1241 | 1241 |
1242 FX_BOOL Document::closeDoc(IFXJS_Context* cc, | 1242 FX_BOOL Document::closeDoc(IJS_Context* cc, |
1243 const CJS_Parameters& params, | 1243 const CJS_Parameters& params, |
1244 CJS_Value& vRet, | 1244 CJS_Value& vRet, |
1245 CFX_WideString& sError) { | 1245 CFX_WideString& sError) { |
1246 ASSERT(m_pDocument != NULL); | 1246 ASSERT(m_pDocument != NULL); |
1247 return TRUE; | 1247 return TRUE; |
1248 } | 1248 } |
1249 | 1249 |
1250 FX_BOOL Document::getPageBox(IFXJS_Context* cc, | 1250 FX_BOOL Document::getPageBox(IJS_Context* cc, |
1251 const CJS_Parameters& params, | 1251 const CJS_Parameters& params, |
1252 CJS_Value& vRet, | 1252 CJS_Value& vRet, |
1253 CFX_WideString& sError) { | 1253 CFX_WideString& sError) { |
1254 return TRUE; | 1254 return TRUE; |
1255 } | 1255 } |
1256 | 1256 |
1257 FX_BOOL Document::getAnnot(IFXJS_Context* cc, | 1257 FX_BOOL Document::getAnnot(IJS_Context* cc, |
1258 const CJS_Parameters& params, | 1258 const CJS_Parameters& params, |
1259 CJS_Value& vRet, | 1259 CJS_Value& vRet, |
1260 CFX_WideString& sError) { | 1260 CFX_WideString& sError) { |
1261 return TRUE; | 1261 return TRUE; |
1262 } | 1262 } |
1263 | 1263 |
1264 FX_BOOL Document::getAnnots(IFXJS_Context* cc, | 1264 FX_BOOL Document::getAnnots(IJS_Context* cc, |
1265 const CJS_Parameters& params, | 1265 const CJS_Parameters& params, |
1266 CJS_Value& vRet, | 1266 CJS_Value& vRet, |
1267 CFX_WideString& sError) { | 1267 CFX_WideString& sError) { |
1268 vRet.SetNull(); | 1268 vRet.SetNull(); |
1269 return TRUE; | 1269 return TRUE; |
1270 } | 1270 } |
1271 | 1271 |
1272 FX_BOOL Document::getAnnot3D(IFXJS_Context* cc, | 1272 FX_BOOL Document::getAnnot3D(IJS_Context* cc, |
1273 const CJS_Parameters& params, | 1273 const CJS_Parameters& params, |
1274 CJS_Value& vRet, | 1274 CJS_Value& vRet, |
1275 CFX_WideString& sError) { | 1275 CFX_WideString& sError) { |
1276 vRet.SetNull(); | 1276 vRet.SetNull(); |
1277 return TRUE; | 1277 return TRUE; |
1278 } | 1278 } |
1279 | 1279 |
1280 FX_BOOL Document::getAnnots3D(IFXJS_Context* cc, | 1280 FX_BOOL Document::getAnnots3D(IJS_Context* cc, |
1281 const CJS_Parameters& params, | 1281 const CJS_Parameters& params, |
1282 CJS_Value& vRet, | 1282 CJS_Value& vRet, |
1283 CFX_WideString& sError) { | 1283 CFX_WideString& sError) { |
1284 vRet = CJS_Value::VT_undefined; | 1284 vRet = CJS_Value::VT_undefined; |
1285 return TRUE; | 1285 return TRUE; |
1286 } | 1286 } |
1287 | 1287 |
1288 FX_BOOL Document::getOCGs(IFXJS_Context* cc, | 1288 FX_BOOL Document::getOCGs(IJS_Context* cc, |
1289 const CJS_Parameters& params, | 1289 const CJS_Parameters& params, |
1290 CJS_Value& vRet, | 1290 CJS_Value& vRet, |
1291 CFX_WideString& sError) { | 1291 CFX_WideString& sError) { |
1292 return TRUE; | 1292 return TRUE; |
1293 } | 1293 } |
1294 | 1294 |
1295 FX_BOOL Document::getLinks(IFXJS_Context* cc, | 1295 FX_BOOL Document::getLinks(IJS_Context* cc, |
1296 const CJS_Parameters& params, | 1296 const CJS_Parameters& params, |
1297 CJS_Value& vRet, | 1297 CJS_Value& vRet, |
1298 CFX_WideString& sError) { | 1298 CFX_WideString& sError) { |
1299 return TRUE; | 1299 return TRUE; |
1300 } | 1300 } |
1301 | 1301 |
1302 bool Document::IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect) { | 1302 bool Document::IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect) { |
1303 return (rect.left <= LinkRect.left && rect.top <= LinkRect.top && | 1303 return (rect.left <= LinkRect.left && rect.top <= LinkRect.top && |
1304 rect.right >= LinkRect.right && rect.bottom >= LinkRect.bottom); | 1304 rect.right >= LinkRect.right && rect.bottom >= LinkRect.bottom); |
1305 } | 1305 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 if (iIndex >= 0 && iIndex <= m_iLength) { | 1342 if (iIndex >= 0 && iIndex <= m_iLength) { |
1343 IconElement* pTemp = m_pHead; | 1343 IconElement* pTemp = m_pHead; |
1344 for (int i = 0; i < iIndex; i++) { | 1344 for (int i = 0; i < iIndex; i++) { |
1345 pTemp = pTemp->NextIcon; | 1345 pTemp = pTemp->NextIcon; |
1346 } | 1346 } |
1347 return pTemp; | 1347 return pTemp; |
1348 } | 1348 } |
1349 return NULL; | 1349 return NULL; |
1350 } | 1350 } |
1351 | 1351 |
1352 FX_BOOL Document::addIcon(IFXJS_Context* cc, | 1352 FX_BOOL Document::addIcon(IJS_Context* cc, |
1353 const CJS_Parameters& params, | 1353 const CJS_Parameters& params, |
1354 CJS_Value& vRet, | 1354 CJS_Value& vRet, |
1355 CFX_WideString& sError) { | 1355 CFX_WideString& sError) { |
1356 CJS_Context* pContext = (CJS_Context*)cc; | 1356 CJS_Context* pContext = (CJS_Context*)cc; |
1357 if (params.size() != 2) { | 1357 if (params.size() != 2) { |
1358 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); | 1358 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); |
1359 return FALSE; | 1359 return FALSE; |
1360 } | 1360 } |
1361 CFX_WideString swIconName = params[0].ToCFXWideString(); | 1361 CFX_WideString swIconName = params[0].ToCFXWideString(); |
1362 | 1362 |
(...skipping 19 matching lines...) Expand all Loading... |
1382 m_pIconTree = new IconTree(); | 1382 m_pIconTree = new IconTree(); |
1383 | 1383 |
1384 IconElement* pNewIcon = new IconElement(); | 1384 IconElement* pNewIcon = new IconElement(); |
1385 pNewIcon->IconName = swIconName; | 1385 pNewIcon->IconName = swIconName; |
1386 pNewIcon->NextIcon = NULL; | 1386 pNewIcon->NextIcon = NULL; |
1387 pNewIcon->IconStream = pIcon; | 1387 pNewIcon->IconStream = pIcon; |
1388 m_pIconTree->InsertIconElement(pNewIcon); | 1388 m_pIconTree->InsertIconElement(pNewIcon); |
1389 return TRUE; | 1389 return TRUE; |
1390 } | 1390 } |
1391 | 1391 |
1392 FX_BOOL Document::icons(IFXJS_Context* cc, | 1392 FX_BOOL Document::icons(IJS_Context* cc, |
1393 CJS_PropValue& vp, | 1393 CJS_PropValue& vp, |
1394 CFX_WideString& sError) { | 1394 CFX_WideString& sError) { |
1395 if (vp.IsSetting()) { | 1395 if (vp.IsSetting()) { |
1396 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 1396 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
1397 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); | 1397 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); |
1398 return FALSE; | 1398 return FALSE; |
1399 } | 1399 } |
1400 | 1400 |
1401 if (!m_pIconTree) { | 1401 if (!m_pIconTree) { |
1402 vp.SetNull(); | 1402 vp.SetNull(); |
(...skipping 25 matching lines...) Expand all Loading... |
1428 | 1428 |
1429 pIcon->SetStream(pIconElement->IconStream->GetStream()); | 1429 pIcon->SetStream(pIconElement->IconStream->GetStream()); |
1430 pIcon->SetIconName(pIconElement->IconName); | 1430 pIcon->SetIconName(pIconElement->IconName); |
1431 Icons.SetElement(i, CJS_Value(m_isolate, pJS_Icon)); | 1431 Icons.SetElement(i, CJS_Value(m_isolate, pJS_Icon)); |
1432 } | 1432 } |
1433 | 1433 |
1434 vp << Icons; | 1434 vp << Icons; |
1435 return TRUE; | 1435 return TRUE; |
1436 } | 1436 } |
1437 | 1437 |
1438 FX_BOOL Document::getIcon(IFXJS_Context* cc, | 1438 FX_BOOL Document::getIcon(IJS_Context* cc, |
1439 const CJS_Parameters& params, | 1439 const CJS_Parameters& params, |
1440 CJS_Value& vRet, | 1440 CJS_Value& vRet, |
1441 CFX_WideString& sError) { | 1441 CFX_WideString& sError) { |
1442 CJS_Context* pContext = (CJS_Context*)cc; | 1442 CJS_Context* pContext = (CJS_Context*)cc; |
1443 if (params.size() != 1) { | 1443 if (params.size() != 1) { |
1444 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); | 1444 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); |
1445 return FALSE; | 1445 return FALSE; |
1446 } | 1446 } |
1447 | 1447 |
1448 if (!m_pIconTree) | 1448 if (!m_pIconTree) |
(...skipping 23 matching lines...) Expand all Loading... |
1472 pIcon->SetIconName(swIconName); | 1472 pIcon->SetIconName(swIconName); |
1473 pIcon->SetStream(pRetIcon->GetStream()); | 1473 pIcon->SetStream(pRetIcon->GetStream()); |
1474 vRet = pJS_Icon; | 1474 vRet = pJS_Icon; |
1475 return TRUE; | 1475 return TRUE; |
1476 } | 1476 } |
1477 } | 1477 } |
1478 | 1478 |
1479 return FALSE; | 1479 return FALSE; |
1480 } | 1480 } |
1481 | 1481 |
1482 FX_BOOL Document::removeIcon(IFXJS_Context* cc, | 1482 FX_BOOL Document::removeIcon(IJS_Context* cc, |
1483 const CJS_Parameters& params, | 1483 const CJS_Parameters& params, |
1484 CJS_Value& vRet, | 1484 CJS_Value& vRet, |
1485 CFX_WideString& sError) { | 1485 CFX_WideString& sError) { |
1486 // Unsafe, no supported. | 1486 // Unsafe, no supported. |
1487 return TRUE; | 1487 return TRUE; |
1488 } | 1488 } |
1489 | 1489 |
1490 FX_BOOL Document::createDataObject(IFXJS_Context* cc, | 1490 FX_BOOL Document::createDataObject(IJS_Context* cc, |
1491 const CJS_Parameters& params, | 1491 const CJS_Parameters& params, |
1492 CJS_Value& vRet, | 1492 CJS_Value& vRet, |
1493 CFX_WideString& sError) { | 1493 CFX_WideString& sError) { |
1494 // Unsafe, not implemented. | 1494 // Unsafe, not implemented. |
1495 return TRUE; | 1495 return TRUE; |
1496 } | 1496 } |
1497 | 1497 |
1498 FX_BOOL Document::media(IFXJS_Context* cc, | 1498 FX_BOOL Document::media(IJS_Context* cc, |
1499 CJS_PropValue& vp, | 1499 CJS_PropValue& vp, |
1500 CFX_WideString& sError) { | 1500 CFX_WideString& sError) { |
1501 return TRUE; | 1501 return TRUE; |
1502 } | 1502 } |
1503 | 1503 |
1504 FX_BOOL Document::calculateNow(IFXJS_Context* cc, | 1504 FX_BOOL Document::calculateNow(IJS_Context* cc, |
1505 const CJS_Parameters& params, | 1505 const CJS_Parameters& params, |
1506 CJS_Value& vRet, | 1506 CJS_Value& vRet, |
1507 CFX_WideString& sError) { | 1507 CFX_WideString& sError) { |
1508 ASSERT(m_pDocument != NULL); | 1508 ASSERT(m_pDocument != NULL); |
1509 | 1509 |
1510 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || | 1510 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || |
1511 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || | 1511 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || |
1512 m_pDocument->GetPermissions(FPDFPERM_FILL_FORM))) | 1512 m_pDocument->GetPermissions(FPDFPERM_FILL_FORM))) |
1513 return FALSE; | 1513 return FALSE; |
1514 | 1514 |
1515 CPDFSDK_InterForm* pInterForm = | 1515 CPDFSDK_InterForm* pInterForm = |
1516 (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); | 1516 (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); |
1517 ASSERT(pInterForm != NULL); | 1517 ASSERT(pInterForm != NULL); |
1518 pInterForm->OnCalculate(); | 1518 pInterForm->OnCalculate(); |
1519 return TRUE; | 1519 return TRUE; |
1520 } | 1520 } |
1521 | 1521 |
1522 FX_BOOL Document::Collab(IFXJS_Context* cc, | 1522 FX_BOOL Document::Collab(IJS_Context* cc, |
1523 CJS_PropValue& vp, | 1523 CJS_PropValue& vp, |
1524 CFX_WideString& sError) { | 1524 CFX_WideString& sError) { |
1525 return TRUE; | 1525 return TRUE; |
1526 } | 1526 } |
1527 | 1527 |
1528 FX_BOOL Document::getPageNthWord(IFXJS_Context* cc, | 1528 FX_BOOL Document::getPageNthWord(IJS_Context* cc, |
1529 const CJS_Parameters& params, | 1529 const CJS_Parameters& params, |
1530 CJS_Value& vRet, | 1530 CJS_Value& vRet, |
1531 CFX_WideString& sError) { | 1531 CFX_WideString& sError) { |
1532 ASSERT(m_pDocument != NULL); | 1532 ASSERT(m_pDocument != NULL); |
1533 | 1533 |
1534 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) | 1534 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) |
1535 return FALSE; | 1535 return FALSE; |
1536 | 1536 |
1537 int nPageNo = params.GetSize() > 0 ? params[0].ToInt() : 0; | 1537 int nPageNo = params.GetSize() > 0 ? params[0].ToInt() : 0; |
1538 int nWordNo = params.GetSize() > 1 ? params[1].ToInt() : 0; | 1538 int nWordNo = params.GetSize() > 1 ? params[1].ToInt() : 0; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1580 | 1580 |
1581 if (bStrip) { | 1581 if (bStrip) { |
1582 swRet.TrimLeft(); | 1582 swRet.TrimLeft(); |
1583 swRet.TrimRight(); | 1583 swRet.TrimRight(); |
1584 } | 1584 } |
1585 | 1585 |
1586 vRet = swRet.c_str(); | 1586 vRet = swRet.c_str(); |
1587 return TRUE; | 1587 return TRUE; |
1588 } | 1588 } |
1589 | 1589 |
1590 FX_BOOL Document::getPageNthWordQuads(IFXJS_Context* cc, | 1590 FX_BOOL Document::getPageNthWordQuads(IJS_Context* cc, |
1591 const CJS_Parameters& params, | 1591 const CJS_Parameters& params, |
1592 CJS_Value& vRet, | 1592 CJS_Value& vRet, |
1593 CFX_WideString& sError) { | 1593 CFX_WideString& sError) { |
1594 ASSERT(m_pDocument != NULL); | 1594 ASSERT(m_pDocument != NULL); |
1595 | 1595 |
1596 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) | 1596 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) |
1597 return FALSE; | 1597 return FALSE; |
1598 | 1598 |
1599 return FALSE; | 1599 return FALSE; |
1600 } | 1600 } |
1601 | 1601 |
1602 FX_BOOL Document::getPageNumWords(IFXJS_Context* cc, | 1602 FX_BOOL Document::getPageNumWords(IJS_Context* cc, |
1603 const CJS_Parameters& params, | 1603 const CJS_Parameters& params, |
1604 CJS_Value& vRet, | 1604 CJS_Value& vRet, |
1605 CFX_WideString& sError) { | 1605 CFX_WideString& sError) { |
1606 ASSERT(m_pDocument != NULL); | 1606 ASSERT(m_pDocument != NULL); |
1607 | 1607 |
1608 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) | 1608 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) |
1609 return FALSE; | 1609 return FALSE; |
1610 | 1610 |
1611 int nPageNo = params.GetSize() > 0 ? params[0].ToInt() : 0; | 1611 int nPageNo = params.GetSize() > 0 ? params[0].ToInt() : 0; |
1612 | 1612 |
(...skipping 26 matching lines...) Expand all Loading... |
1639 nWords += CountWords(pTextObj); | 1639 nWords += CountWords(pTextObj); |
1640 } | 1640 } |
1641 } | 1641 } |
1642 } | 1642 } |
1643 | 1643 |
1644 vRet = nWords; | 1644 vRet = nWords; |
1645 | 1645 |
1646 return TRUE; | 1646 return TRUE; |
1647 } | 1647 } |
1648 | 1648 |
1649 FX_BOOL Document::getPrintParams(IFXJS_Context* cc, | 1649 FX_BOOL Document::getPrintParams(IJS_Context* cc, |
1650 const CJS_Parameters& params, | 1650 const CJS_Parameters& params, |
1651 CJS_Value& vRet, | 1651 CJS_Value& vRet, |
1652 CFX_WideString& sError) { | 1652 CFX_WideString& sError) { |
1653 CJS_Context* pContext = (CJS_Context*)cc; | 1653 CJS_Context* pContext = (CJS_Context*)cc; |
1654 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 1654 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
1655 v8::Local<v8::Object> pRetObj = FXJS_NewFxDynamicObj( | 1655 v8::Local<v8::Object> pRetObj = FXJS_NewFxDynamicObj( |
1656 pRuntime->GetIsolate(), pContext, CJS_PrintParamsObj::g_nObjDefnID); | 1656 pRuntime->GetIsolate(), pContext, CJS_PrintParamsObj::g_nObjDefnID); |
1657 | 1657 |
1658 // Not implemented yet. | 1658 // Not implemented yet. |
1659 | 1659 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1728 nWords++; | 1728 nWords++; |
1729 } | 1729 } |
1730 | 1730 |
1731 if (nWords - 1 == nWordIndex) | 1731 if (nWords - 1 == nWordIndex) |
1732 swRet += unicode; | 1732 swRet += unicode; |
1733 } | 1733 } |
1734 | 1734 |
1735 return swRet; | 1735 return swRet; |
1736 } | 1736 } |
1737 | 1737 |
1738 FX_BOOL Document::zoom(IFXJS_Context* cc, | 1738 FX_BOOL Document::zoom(IJS_Context* cc, |
1739 CJS_PropValue& vp, | 1739 CJS_PropValue& vp, |
1740 CFX_WideString& sError) { | 1740 CFX_WideString& sError) { |
1741 return TRUE; | 1741 return TRUE; |
1742 } | 1742 } |
1743 | 1743 |
1744 /** | 1744 /** |
1745 (none, NoVary) | 1745 (none, NoVary) |
1746 (fitP, FitPage) | 1746 (fitP, FitPage) |
1747 (fitW, FitWidth) | 1747 (fitW, FitWidth) |
1748 (fitH, FitHeight) | 1748 (fitH, FitHeight) |
1749 (fitV, FitVisibleWidth) | 1749 (fitV, FitVisibleWidth) |
1750 (pref, Preferred) | 1750 (pref, Preferred) |
1751 (refW, ReflowWidth) | 1751 (refW, ReflowWidth) |
1752 */ | 1752 */ |
1753 | 1753 |
1754 FX_BOOL Document::zoomType(IFXJS_Context* cc, | 1754 FX_BOOL Document::zoomType(IJS_Context* cc, |
1755 CJS_PropValue& vp, | 1755 CJS_PropValue& vp, |
1756 CFX_WideString& sError) { | 1756 CFX_WideString& sError) { |
1757 return TRUE; | 1757 return TRUE; |
1758 } | 1758 } |
1759 | 1759 |
1760 FX_BOOL Document::deletePages(IFXJS_Context* cc, | 1760 FX_BOOL Document::deletePages(IJS_Context* cc, |
1761 const CJS_Parameters& params, | 1761 const CJS_Parameters& params, |
1762 CJS_Value& vRet, | 1762 CJS_Value& vRet, |
1763 CFX_WideString& sError) { | 1763 CFX_WideString& sError) { |
1764 // Unsafe, no supported. | 1764 // Unsafe, no supported. |
1765 return TRUE; | 1765 return TRUE; |
1766 } | 1766 } |
1767 | 1767 |
1768 FX_BOOL Document::extractPages(IFXJS_Context* cc, | 1768 FX_BOOL Document::extractPages(IJS_Context* cc, |
1769 const CJS_Parameters& params, | 1769 const CJS_Parameters& params, |
1770 CJS_Value& vRet, | 1770 CJS_Value& vRet, |
1771 CFX_WideString& sError) { | 1771 CFX_WideString& sError) { |
1772 // Unsafe, not supported. | 1772 // Unsafe, not supported. |
1773 return TRUE; | 1773 return TRUE; |
1774 } | 1774 } |
1775 | 1775 |
1776 FX_BOOL Document::insertPages(IFXJS_Context* cc, | 1776 FX_BOOL Document::insertPages(IJS_Context* cc, |
1777 const CJS_Parameters& params, | 1777 const CJS_Parameters& params, |
1778 CJS_Value& vRet, | 1778 CJS_Value& vRet, |
1779 CFX_WideString& sError) { | 1779 CFX_WideString& sError) { |
1780 // Unsafe, not supported. | 1780 // Unsafe, not supported. |
1781 return TRUE; | 1781 return TRUE; |
1782 } | 1782 } |
1783 | 1783 |
1784 FX_BOOL Document::replacePages(IFXJS_Context* cc, | 1784 FX_BOOL Document::replacePages(IJS_Context* cc, |
1785 const CJS_Parameters& params, | 1785 const CJS_Parameters& params, |
1786 CJS_Value& vRet, | 1786 CJS_Value& vRet, |
1787 CFX_WideString& sError) { | 1787 CFX_WideString& sError) { |
1788 // Unsafe, not supported. | 1788 // Unsafe, not supported. |
1789 return TRUE; | 1789 return TRUE; |
1790 } | 1790 } |
1791 | 1791 |
1792 FX_BOOL Document::getURL(IFXJS_Context* cc, | 1792 FX_BOOL Document::getURL(IJS_Context* cc, |
1793 const CJS_Parameters& params, | 1793 const CJS_Parameters& params, |
1794 CJS_Value& vRet, | 1794 CJS_Value& vRet, |
1795 CFX_WideString& sError) { | 1795 CFX_WideString& sError) { |
1796 // Unsafe, not supported. | 1796 // Unsafe, not supported. |
1797 return TRUE; | 1797 return TRUE; |
1798 } | 1798 } |
1799 | 1799 |
1800 void Document::AddDelayData(CJS_DelayData* pData) { | 1800 void Document::AddDelayData(CJS_DelayData* pData) { |
1801 m_DelayData.Add(pData); | 1801 m_DelayData.Add(pData); |
1802 } | 1802 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1838 CFX_DWordArray DelArray; | 1838 CFX_DWordArray DelArray; |
1839 | 1839 |
1840 for (int j = DelArray.GetSize() - 1; j >= 0; j--) { | 1840 for (int j = DelArray.GetSize() - 1; j >= 0; j--) { |
1841 m_DelayData.RemoveAt(DelArray[j]); | 1841 m_DelayData.RemoveAt(DelArray[j]); |
1842 } | 1842 } |
1843 } | 1843 } |
1844 | 1844 |
1845 CJS_Document* Document::GetCJSDoc() const { | 1845 CJS_Document* Document::GetCJSDoc() const { |
1846 return static_cast<CJS_Document*>(m_pJSObject); | 1846 return static_cast<CJS_Document*>(m_pJSObject); |
1847 } | 1847 } |
OLD | NEW |