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 "../../include/javascript/JavaScript.h" | 7 #include "../../include/javascript/JavaScript.h" |
8 #include "../../include/javascript/IJavaScript.h" | 8 #include "../../include/javascript/IJavaScript.h" |
9 #include "../../include/javascript/JS_Define.h" | 9 #include "../../include/javascript/JS_Define.h" |
10 #include "../../include/javascript/JS_Object.h" | 10 #include "../../include/javascript/JS_Object.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 m_DelayData.SetAt(i, NULL); | 183 m_DelayData.SetAt(i, NULL); |
184 | 184 |
185 } | 185 } |
186 } | 186 } |
187 | 187 |
188 m_DelayData.RemoveAll(); | 188 m_DelayData.RemoveAll(); |
189 m_DelayAnnotData.RemoveAll(); | 189 m_DelayAnnotData.RemoveAll(); |
190 } | 190 } |
191 | 191 |
192 //the total number of fileds in document. | 192 //the total number of fileds in document. |
193 FX_BOOL Document::numFields(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString
& sError) | 193 FX_BOOL Document::numFields(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString
& sError) |
194 { | 194 { |
195 if (vp.IsSetting()) { | 195 if (vp.IsSetting()) { |
196 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 196 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
197 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); | 197 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); |
198 return FALSE; | 198 return FALSE; |
199 } | 199 } |
200 CPDFSDK_InterForm *pInterForm = m_pDocument->GetInterForm(); | 200 CPDFSDK_InterForm *pInterForm = m_pDocument->GetInterForm(); |
201 CPDF_InterForm *pPDFForm = pInterForm->GetInterForm(); | 201 CPDF_InterForm *pPDFForm = pInterForm->GetInterForm(); |
202 vp << (int)pPDFForm->CountFields(); | 202 vp << (int)pPDFForm->CountFields(); |
203 return TRUE; | 203 return TRUE; |
204 } | 204 } |
205 | 205 |
206 FX_BOOL Document::dirty(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sE
rror) | 206 FX_BOOL Document::dirty(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror) |
207 { | 207 { |
208 ASSERT(m_pDocument != NULL); | 208 ASSERT(m_pDocument != NULL); |
209 | 209 |
210 if (vp.IsGetting()) | 210 if (vp.IsGetting()) |
211 { | 211 { |
212 if (m_pDocument->GetChangeMark()) | 212 if (m_pDocument->GetChangeMark()) |
213 vp << true; | 213 vp << true; |
214 else | 214 else |
215 vp << false; | 215 vp << false; |
216 } | 216 } |
217 else | 217 else |
218 { | 218 { |
219 bool bChanged = false; | 219 bool bChanged = false; |
220 | 220 |
221 vp >> bChanged; | 221 vp >> bChanged; |
222 | 222 |
223 if (bChanged) | 223 if (bChanged) |
224 m_pDocument->SetChangeMark(); | 224 m_pDocument->SetChangeMark(); |
225 else | 225 else |
226 m_pDocument->ClearChangeMark(); | 226 m_pDocument->ClearChangeMark(); |
227 } | 227 } |
228 | 228 |
229 return TRUE; | 229 return TRUE; |
230 } | 230 } |
231 | 231 |
232 FX_BOOL Document::ADBE(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sEr
ror) | 232 FX_BOOL Document::ADBE(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr
ror) |
233 { | 233 { |
234 ASSERT(m_pDocument != NULL); | 234 ASSERT(m_pDocument != NULL); |
235 | 235 |
236 if (vp.IsGetting()) | 236 if (vp.IsGetting()) |
237 { | 237 { |
238 vp.SetNull(); | 238 vp.SetNull(); |
239 } | 239 } |
240 else | 240 else |
241 { | 241 { |
242 } | 242 } |
243 | 243 |
244 return TRUE; | 244 return TRUE; |
245 } | 245 } |
246 | 246 |
247 FX_BOOL Document::pageNum(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString&
sError) | 247 FX_BOOL Document::pageNum(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) |
248 { | 248 { |
249 ASSERT(m_pDocument != NULL); | 249 ASSERT(m_pDocument != NULL); |
250 | 250 |
251 if (vp.IsGetting()) | 251 if (vp.IsGetting()) |
252 { | 252 { |
253 if (CPDFSDK_PageView* pPageView = m_pDocument->GetCurrentView()) | 253 if (CPDFSDK_PageView* pPageView = m_pDocument->GetCurrentView()) |
254 { | 254 { |
255 vp << pPageView->GetPageIndex(); | 255 vp << pPageView->GetPageIndex(); |
256 } | 256 } |
257 } | 257 } |
258 else | 258 else |
259 { | 259 { |
260 int iPageCount = m_pDocument->GetPageCount(); | 260 int iPageCount = m_pDocument->GetPageCount(); |
261 | |
262 int iPageNum = 0; | 261 int iPageNum = 0; |
263 vp >> iPageNum; | 262 vp >> iPageNum; |
264 | 263 |
265 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); | 264 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); |
266 if(!pEnv) | |
267 return FALSE; | |
268 | |
269 if (iPageNum >= 0 && iPageNum < iPageCount) | 265 if (iPageNum >= 0 && iPageNum < iPageCount) |
270 { | 266 { |
271 pEnv->JS_docgotoPage(iPageNum); | 267 pEnv->JS_docgotoPage(iPageNum); |
272 } | 268 } |
273 else if (iPageNum >= iPageCount) | 269 else if (iPageNum >= iPageCount) |
274 { | 270 { |
275 pEnv->JS_docgotoPage(iPageCount-1); | 271 pEnv->JS_docgotoPage(iPageCount-1); |
276 } | 272 } |
277 else if (iPageNum < 0) | 273 else if (iPageNum < 0) |
278 { | 274 { |
279 pEnv->JS_docgotoPage(0); | 275 pEnv->JS_docgotoPage(0); |
280 } | 276 } |
281 } | 277 } |
282 | 278 |
283 return TRUE; | 279 return TRUE; |
284 } | 280 } |
285 | 281 |
286 FX_BOOL Document::ParserParams(JSObject* pObj,CJS_AnnotObj& annotobj) | 282 FX_BOOL Document::ParserParams(JSObject* pObj,CJS_AnnotObj& annotobj) |
287 { | 283 { |
288 // Not supported. | 284 // Not supported. |
289 return TRUE; | 285 return TRUE; |
290 } | 286 } |
291 | 287 |
292 FX_BOOL Document::addAnnot(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, JS_ErrorString& sError) | 288 FX_BOOL Document::addAnnot(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, CFX_WideString& sError) |
293 { | 289 { |
294 // Not supported. | 290 // Not supported. |
295 return TRUE; | 291 return TRUE; |
296 } | 292 } |
297 | 293 |
298 FX_BOOL Document::addField(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, JS_ErrorString& sError) | 294 FX_BOOL Document::addField(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, CFX_WideString& sError) |
299 { | 295 { |
300 // Not supported. | 296 // Not supported. |
301 return TRUE; | 297 return TRUE; |
302 } | 298 } |
303 | 299 |
304 FX_BOOL Document::exportAsText(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, JS_ErrorString& sError) | 300 FX_BOOL Document::exportAsText(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, CFX_WideString& sError) |
305 { | 301 { |
306 // Unsafe, not supported. | 302 // Unsafe, not supported. |
307 return TRUE; | 303 return TRUE; |
308 } | 304 } |
309 | 305 |
310 FX_BOOL Document::exportAsFDF(IFXJS_Context* cc, const CJS_Parameters& params, C
JS_Value& vRet, JS_ErrorString& sError) | 306 FX_BOOL Document::exportAsFDF(IFXJS_Context* cc, const CJS_Parameters& params, C
JS_Value& vRet, CFX_WideString& sError) |
311 { | 307 { |
312 // Unsafe, not supported. | 308 // Unsafe, not supported. |
313 return TRUE; | 309 return TRUE; |
314 } | 310 } |
315 | 311 |
316 FX_BOOL Document::exportAsXFDF(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, JS_ErrorString& sError) | 312 FX_BOOL Document::exportAsXFDF(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, CFX_WideString& sError) |
317 { | 313 { |
318 // Unsafe, not supported. | 314 // Unsafe, not supported. |
319 return TRUE; | 315 return TRUE; |
320 } | 316 } |
321 | 317 |
322 //Maps a field object in PDF document to a JavaScript variable | 318 //Maps a field object in PDF document to a JavaScript variable |
323 //comment: | 319 //comment: |
324 //note: the paremter cName, this is clue how to treat if the cName is not a vali
able filed name in this document | 320 //note: the paremter cName, this is clue how to treat if the cName is not a vali
able filed name in this document |
325 | 321 |
326 FX_BOOL Document::getField(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, JS_ErrorString& sError) | 322 FX_BOOL Document::getField(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, CFX_WideString& sError) |
327 { | 323 { |
328 v8::Isolate* isolate = GetIsolate(cc); | 324 v8::Isolate* isolate = GetIsolate(cc); |
329 ASSERT(m_pDocument != NULL); | 325 ASSERT(m_pDocument != NULL); |
330 | 326 |
331 if (params.size() < 1) return FALSE; | 327 if (params.size() < 1) return FALSE; |
332 | 328 |
333 CFX_WideString wideName = params[0].operator CFX_WideString(); | 329 CFX_WideString wideName = params[0].operator CFX_WideString(); |
334 | 330 |
335 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); | 331 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); |
336 ASSERT(pInterForm != NULL); | 332 ASSERT(pInterForm != NULL); |
(...skipping 20 matching lines...) Expand all Loading... |
357 Field * pField = (Field *)pJSField->GetEmbedObject(); | 353 Field * pField = (Field *)pJSField->GetEmbedObject(); |
358 ASSERT(pField != NULL); | 354 ASSERT(pField != NULL); |
359 | 355 |
360 pField->AttachField(this, wideName); | 356 pField->AttachField(this, wideName); |
361 vRet = pJSField; | 357 vRet = pJSField; |
362 | 358 |
363 return TRUE; | 359 return TRUE; |
364 } | 360 } |
365 | 361 |
366 //Gets the name of the nth field in the document | 362 //Gets the name of the nth field in the document |
367 FX_BOOL Document::getNthFieldName(IFXJS_Context* cc, const CJS_Parameters& param
s, CJS_Value& vRet, JS_ErrorString& sError) | 363 FX_BOOL Document::getNthFieldName(IFXJS_Context* cc, const CJS_Parameters& param
s, CJS_Value& vRet, CFX_WideString& sError) |
368 { | 364 { |
369 ASSERT(m_pDocument != NULL); | 365 ASSERT(m_pDocument != NULL); |
370 | 366 |
371 int nIndex = params.size() > 0 ? (int)params[0] : -1; | 367 int nIndex = params.size() > 0 ? (int)params[0] : -1; |
372 if (nIndex == -1) return FALSE; | 368 if (nIndex == -1) return FALSE; |
373 | 369 |
374 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); | 370 CPDFSDK_InterForm* pInterForm = m_pDocument->GetInterForm(); |
375 ASSERT(pInterForm != NULL); | 371 ASSERT(pInterForm != NULL); |
376 | 372 |
377 CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); | 373 CPDF_InterForm* pPDFForm = pInterForm->GetInterForm(); |
378 ASSERT(pPDFForm != NULL); | 374 ASSERT(pPDFForm != NULL); |
379 | 375 |
380 CPDF_FormField* pField = pPDFForm->GetField(nIndex); | 376 CPDF_FormField* pField = pPDFForm->GetField(nIndex); |
381 if (!pField) | 377 if (!pField) |
382 return FALSE; | 378 return FALSE; |
383 | 379 |
384 vRet = pField->GetFullName(); | 380 vRet = pField->GetFullName(); |
385 return TRUE; | 381 return TRUE; |
386 } | 382 } |
387 | 383 |
388 FX_BOOL Document::importAnFDF(IFXJS_Context* cc, const CJS_Parameters& params, C
JS_Value& vRet, JS_ErrorString& sError) | 384 FX_BOOL Document::importAnFDF(IFXJS_Context* cc, const CJS_Parameters& params, C
JS_Value& vRet, CFX_WideString& sError) |
389 { | 385 { |
390 // Unsafe, not supported. | 386 // Unsafe, not supported. |
391 return TRUE; | 387 return TRUE; |
392 } | 388 } |
393 | 389 |
394 FX_BOOL Document::importAnXFDF(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, JS_ErrorString& sError) | 390 FX_BOOL Document::importAnXFDF(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, CFX_WideString& sError) |
395 { | 391 { |
396 // Unsafe, not supported. | 392 // Unsafe, not supported. |
397 return TRUE; | 393 return TRUE; |
398 } | 394 } |
399 | 395 |
400 FX_BOOL Document::importTextData(IFXJS_Context* cc, const CJS_Parameters& params
, CJS_Value& vRet, JS_ErrorString& sError) | 396 FX_BOOL Document::importTextData(IFXJS_Context* cc, const CJS_Parameters& params
, CJS_Value& vRet, CFX_WideString& sError) |
401 { | 397 { |
402 // Unsafe, not supported. | 398 // Unsafe, not supported. |
403 return TRUE; | 399 return TRUE; |
404 } | 400 } |
405 | 401 |
406 //exports the form data and mails the resulting fdf file as an attachment to all
recipients. | 402 //exports the form data and mails the resulting fdf file as an attachment to all
recipients. |
407 //comment: need reader supports | 403 //comment: need reader supports |
408 //note: | 404 //note: |
409 //int CPDFSDK_Document::mailForm(FX_BOOL bUI,String cto,string ccc,string cbcc,s
tring cSubject,string cms); | 405 //int CPDFSDK_Document::mailForm(FX_BOOL bUI,String cto,string ccc,string cbcc,s
tring cSubject,string cms); |
410 | 406 |
411 FX_BOOL Document::mailForm(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, JS_ErrorString& sError) | 407 FX_BOOL Document::mailForm(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, CFX_WideString& sError) |
412 { | 408 { |
413 ASSERT(m_pDocument != NULL); | 409 ASSERT(m_pDocument != NULL); |
414 | 410 |
415 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE; | 411 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE; |
416 | 412 |
417 int iLength = params.size(); | 413 int iLength = params.size(); |
418 | 414 |
419 FX_BOOL bUI = iLength > 0 ? (FX_BOOL)params[0] : TRUE; | 415 FX_BOOL bUI = iLength > 0 ? (FX_BOOL)params[0] : TRUE; |
420 CFX_WideString cTo = iLength > 1 ? (FX_LPCWSTR)params[1].operator CFX_Wi
deString() : L""; | 416 CFX_WideString cTo = iLength > 1 ? (FX_LPCWSTR)params[1].operator CFX_Wi
deString() : L""; |
421 CFX_WideString cCc = iLength > 2 ? (FX_LPCWSTR)params[2].operator CFX_Wi
deString() : L""; | 417 CFX_WideString cCc = iLength > 2 ? (FX_LPCWSTR)params[2].operator CFX_Wi
deString() : L""; |
(...skipping 14 matching lines...) Expand all Loading... |
436 ASSERT(pEnv != NULL); | 432 ASSERT(pEnv != NULL); |
437 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 433 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
438 ASSERT(pRuntime != NULL); | 434 ASSERT(pRuntime != NULL); |
439 | 435 |
440 pRuntime->BeginBlock(); | 436 pRuntime->BeginBlock(); |
441 pEnv->JS_docmailForm(textBuf.GetBuffer(), textBuf.GetLength(), bUI, cTo.
c_str(), cSubject.c_str(), cCc.c_str(), cBcc.c_str(), cMsg.c_str()); | 437 pEnv->JS_docmailForm(textBuf.GetBuffer(), textBuf.GetLength(), bUI, cTo.
c_str(), cSubject.c_str(), cCc.c_str(), cBcc.c_str(), cMsg.c_str()); |
442 pRuntime->EndBlock(); | 438 pRuntime->EndBlock(); |
443 return TRUE; | 439 return TRUE; |
444 } | 440 } |
445 | 441 |
446 FX_BOOL Document::print(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val
ue& vRet, JS_ErrorString& sError) | 442 FX_BOOL Document::print(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Val
ue& vRet, CFX_WideString& sError) |
447 { | 443 { |
448 CJS_Context* pContext = (CJS_Context*)cc; | 444 CJS_Context* pContext = (CJS_Context*)cc; |
449 ASSERT(pContext != NULL); | 445 ASSERT(pContext != NULL); |
450 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 446 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
451 ASSERT(pRuntime != NULL); | 447 ASSERT(pRuntime != NULL); |
452 | 448 |
453 FX_BOOL bUI = TRUE; | 449 FX_BOOL bUI = TRUE; |
454 int nStart = 0; | 450 int nStart = 0; |
455 int nEnd = 0; | 451 int nEnd = 0; |
456 FX_BOOL bSilent = FALSE; | 452 FX_BOOL bSilent = FALSE; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 pEnv->JS_docprint(bUI, nStart, nEnd, bSilent, bShrinkToFit, bPri
ntAsImage, bReverse, bAnnotations); | 509 pEnv->JS_docprint(bUI, nStart, nEnd, bSilent, bShrinkToFit, bPri
ntAsImage, bReverse, bAnnotations); |
514 return TRUE; | 510 return TRUE; |
515 } | 511 } |
516 return FALSE; | 512 return FALSE; |
517 } | 513 } |
518 | 514 |
519 //removes the specified field from the document. | 515 //removes the specified field from the document. |
520 //comment: | 516 //comment: |
521 //note: if the filed name is not retional, adobe is dumb for it. | 517 //note: if the filed name is not retional, adobe is dumb for it. |
522 | 518 |
523 FX_BOOL Document::removeField(IFXJS_Context* cc, const CJS_Parameters& params, C
JS_Value& vRet, JS_ErrorString& sError) | 519 FX_BOOL Document::removeField(IFXJS_Context* cc, const CJS_Parameters& params, C
JS_Value& vRet, CFX_WideString& sError) |
524 { | 520 { |
525 ASSERT(m_pDocument != NULL); | 521 ASSERT(m_pDocument != NULL); |
526 | 522 |
527 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || | 523 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || |
528 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM))) return FALSE; | 524 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM))) return FALSE; |
529 | 525 |
530 if (params.size() < 1) | 526 if (params.size() < 1) |
531 return TRUE; | 527 return TRUE; |
532 | 528 |
533 CFX_WideString sFieldName = params[0].operator CFX_WideString(); | 529 CFX_WideString sFieldName = params[0].operator CFX_WideString(); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 m_pDocument->SetChangeMark(); | 563 m_pDocument->SetChangeMark(); |
568 } | 564 } |
569 | 565 |
570 return TRUE; | 566 return TRUE; |
571 } | 567 } |
572 | 568 |
573 //reset filed values within a document. | 569 //reset filed values within a document. |
574 //comment: | 570 //comment: |
575 //note: if the fields names r not rational, aodbe is dumb for it. | 571 //note: if the fields names r not rational, aodbe is dumb for it. |
576 | 572 |
577 FX_BOOL Document::resetForm(IFXJS_Context* cc, const CJS_Parameters& params, CJS
_Value& vRet, JS_ErrorString& sError) | 573 FX_BOOL Document::resetForm(IFXJS_Context* cc, const CJS_Parameters& params, CJS
_Value& vRet, CFX_WideString& sError) |
578 { | 574 { |
579 ASSERT(m_pDocument != NULL); | 575 ASSERT(m_pDocument != NULL); |
580 | 576 |
581 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || | 577 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || |
582 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || | 578 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || |
583 m_pDocument->GetPermissions(FPDFPERM_FILL_FORM))) return FALSE; | 579 m_pDocument->GetPermissions(FPDFPERM_FILL_FORM))) return FALSE; |
584 | 580 |
585 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte
rForm(); | 581 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte
rForm(); |
586 ASSERT(pInterForm != NULL); | 582 ASSERT(pInterForm != NULL); |
587 | 583 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 { | 624 { |
629 pPDFForm->ResetForm(TRUE); | 625 pPDFForm->ResetForm(TRUE); |
630 m_pDocument->SetChangeMark(); | 626 m_pDocument->SetChangeMark(); |
631 | 627 |
632 } | 628 } |
633 | 629 |
634 return TRUE; | 630 return TRUE; |
635 } | 631 } |
636 | 632 |
637 | 633 |
638 FX_BOOL Document::saveAs(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
lue& vRet, JS_ErrorString& sError) | 634 FX_BOOL Document::saveAs(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
lue& vRet, CFX_WideString& sError) |
639 { | 635 { |
640 // Unsafe, not supported. | 636 // Unsafe, not supported. |
641 return TRUE; | 637 return TRUE; |
642 } | 638 } |
643 | 639 |
644 | 640 |
645 FX_BOOL Document::submitForm(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, JS_ErrorString& sError) | 641 FX_BOOL Document::submitForm(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, CFX_WideString& sError) |
646 { | 642 { |
647 ASSERT(m_pDocument != NULL); | 643 ASSERT(m_pDocument != NULL); |
648 | 644 |
649 // if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE; | 645 // if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE; |
650 | 646 |
651 int nSize = params.size(); | 647 int nSize = params.size(); |
652 if (nSize < 1) return FALSE; | 648 if (nSize < 1) return FALSE; |
653 | 649 |
654 CFX_WideString strURL; | 650 CFX_WideString strURL; |
655 FX_BOOL bFDF = TRUE; | 651 FX_BOOL bFDF = TRUE; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 FX_BOOL Document::ExtractFileName(CPDFSDK_Document *pDoc,CFX_ByteString &strFile
Name) | 758 FX_BOOL Document::ExtractFileName(CPDFSDK_Document *pDoc,CFX_ByteString &strFile
Name) |
763 { | 759 { |
764 return FALSE; | 760 return FALSE; |
765 } | 761 } |
766 | 762 |
767 FX_BOOL Document::ExtractFolderName(CPDFSDK_Document *pDoc,CFX_ByteString &strFo
lderName) | 763 FX_BOOL Document::ExtractFolderName(CPDFSDK_Document *pDoc,CFX_ByteString &strFo
lderName) |
768 { | 764 { |
769 return FALSE; | 765 return FALSE; |
770 } | 766 } |
771 | 767 |
772 FX_BOOL Document::bookmarkRoot(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorStr
ing& sError) | 768 FX_BOOL Document::bookmarkRoot(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStr
ing& sError) |
773 { | 769 { |
774 return TRUE; | 770 return TRUE; |
775 } | 771 } |
776 | 772 |
777 FX_BOOL Document::mailDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, JS_ErrorString& sError) | 773 FX_BOOL Document::mailDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, CFX_WideString& sError) |
778 { | 774 { |
779 ASSERT(m_pDocument != NULL); | 775 ASSERT(m_pDocument != NULL); |
780 | 776 |
781 FX_BOOL bUI = TRUE; | 777 FX_BOOL bUI = TRUE; |
782 CFX_WideString cTo = L""; | 778 CFX_WideString cTo = L""; |
783 CFX_WideString cCc = L""; | 779 CFX_WideString cCc = L""; |
784 CFX_WideString cBcc = L""; | 780 CFX_WideString cBcc = L""; |
785 CFX_WideString cSubject = L""; | 781 CFX_WideString cSubject = L""; |
786 CFX_WideString cMsg = L""; | 782 CFX_WideString cMsg = L""; |
787 | 783 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 ASSERT(pRuntime != NULL); | 821 ASSERT(pRuntime != NULL); |
826 | 822 |
827 pRuntime->BeginBlock(); | 823 pRuntime->BeginBlock(); |
828 CPDFDoc_Environment* pEnv = pRuntime->GetReaderApp(); | 824 CPDFDoc_Environment* pEnv = pRuntime->GetReaderApp(); |
829 pEnv->JS_docmailForm(NULL, 0, bUI, cTo.c_str(), cSubject.c_str(), cCc.c_
str(), cBcc.c_str(), cMsg.c_str()); | 825 pEnv->JS_docmailForm(NULL, 0, bUI, cTo.c_str(), cSubject.c_str(), cCc.c_
str(), cBcc.c_str(), cMsg.c_str()); |
830 pRuntime->EndBlock(); | 826 pRuntime->EndBlock(); |
831 | 827 |
832 return TRUE; | 828 return TRUE; |
833 } | 829 } |
834 | 830 |
835 FX_BOOL Document::author(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& s
Error) | 831 FX_BOOL Document::author(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error) |
836 { | 832 { |
837 ASSERT(m_pDocument != NULL); | 833 ASSERT(m_pDocument != NULL); |
838 | 834 |
839 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetPDFDoc()->
GetInfo(); | 835 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetPDFDoc()->
GetInfo(); |
840 if (!pDictionary)return FALSE; | 836 if (!pDictionary)return FALSE; |
841 | 837 |
842 if (vp.IsGetting()) | 838 if (vp.IsGetting()) |
843 { | 839 { |
844 vp << pDictionary->GetUnicodeText("Author"); | 840 vp << pDictionary->GetUnicodeText("Author"); |
845 return TRUE; | 841 return TRUE; |
846 } | 842 } |
847 else | 843 else |
848 { | 844 { |
849 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) return FALSE; | 845 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) return FALSE; |
850 | 846 |
851 CFX_WideString csAuthor; | 847 CFX_WideString csAuthor; |
852 vp >> csAuthor; | 848 vp >> csAuthor; |
853 pDictionary->SetAtString("Author", PDF_EncodeText(csAuthor)); | 849 pDictionary->SetAtString("Author", PDF_EncodeText(csAuthor)); |
854 m_pDocument->SetChangeMark(); | 850 m_pDocument->SetChangeMark(); |
855 return TRUE; | 851 return TRUE; |
856 } | 852 } |
857 } | 853 } |
858 | 854 |
859 FX_BOOL Document::info(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sEr
ror) | 855 FX_BOOL Document::info(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr
ror) |
860 { | 856 { |
861 ASSERT(m_pDocument != NULL); | 857 ASSERT(m_pDocument != NULL); |
862 | 858 |
863 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetPDFDoc()->
GetInfo(); | 859 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetPDFDoc()->
GetInfo(); |
864 if (!pDictionary)return FALSE; | 860 if (!pDictionary)return FALSE; |
865 | 861 |
866 CFX_WideString cwAuthor = pDictionary->GetUnicodeText("A
uthor"); | 862 CFX_WideString cwAuthor = pDictionary->GetUnicodeText("A
uthor"); |
867 CFX_WideString cwTitle = pDictionary->GetUnicodeText("T
itle"); | 863 CFX_WideString cwTitle = pDictionary->GetUnicodeText("T
itle"); |
868 CFX_WideString cwSubject = pDictionary->GetUnicodeText("S
ubject"); | 864 CFX_WideString cwSubject = pDictionary->GetUnicodeText("S
ubject"); |
869 CFX_WideString cwKeywords = pDictionary->GetUnicodeText("K
eywords"); | 865 CFX_WideString cwKeywords = pDictionary->GetUnicodeText("K
eywords"); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 | 904 |
909 vp << pObj; | 905 vp << pObj; |
910 return TRUE; | 906 return TRUE; |
911 } | 907 } |
912 else | 908 else |
913 { | 909 { |
914 return TRUE; | 910 return TRUE; |
915 } | 911 } |
916 } | 912 } |
917 | 913 |
918 FX_BOOL Document::creationDate(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorStr
ing& sError) | 914 FX_BOOL Document::creationDate(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideStr
ing& sError) |
919 { | 915 { |
920 ASSERT(m_pDocument != NULL); | 916 ASSERT(m_pDocument != NULL); |
921 | 917 |
922 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetPDFDoc()->
GetInfo(); | 918 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetPDFDoc()->
GetInfo(); |
923 if (!pDictionary)return FALSE; | 919 if (!pDictionary)return FALSE; |
924 | 920 |
925 if (vp.IsGetting()) | 921 if (vp.IsGetting()) |
926 { | 922 { |
927 vp << pDictionary->GetUnicodeText("CreationDate"); | 923 vp << pDictionary->GetUnicodeText("CreationDate"); |
928 return TRUE; | 924 return TRUE; |
929 } | 925 } |
930 else | 926 else |
931 { | 927 { |
932 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) return FALSE; | 928 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) return FALSE; |
933 | 929 |
934 CFX_WideString csCreationDate; | 930 CFX_WideString csCreationDate; |
935 vp >> csCreationDate; | 931 vp >> csCreationDate; |
936 pDictionary->SetAtString("CreationDate", PDF_EncodeText(csCreati
onDate)); | 932 pDictionary->SetAtString("CreationDate", PDF_EncodeText(csCreati
onDate)); |
937 m_pDocument->SetChangeMark(); | 933 m_pDocument->SetChangeMark(); |
938 | 934 |
939 return TRUE; | 935 return TRUE; |
940 } | 936 } |
941 } | 937 } |
942 | 938 |
943 FX_BOOL Document::creator(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString&
sError) | 939 FX_BOOL Document::creator(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) |
944 { | 940 { |
945 ASSERT(m_pDocument != NULL); | 941 ASSERT(m_pDocument != NULL); |
946 | 942 |
947 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetPDFDoc()->
GetInfo(); | 943 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetPDFDoc()->
GetInfo(); |
948 if (!pDictionary)return FALSE; | 944 if (!pDictionary)return FALSE; |
949 | 945 |
950 if (vp.IsGetting()) | 946 if (vp.IsGetting()) |
951 { | 947 { |
952 vp << pDictionary->GetUnicodeText("Creator"); | 948 vp << pDictionary->GetUnicodeText("Creator"); |
953 return TRUE; | 949 return TRUE; |
954 } | 950 } |
955 else | 951 else |
956 { | 952 { |
957 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) return FALSE; | 953 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) return FALSE; |
958 | 954 |
959 CFX_WideString csCreator; | 955 CFX_WideString csCreator; |
960 vp >> csCreator; | 956 vp >> csCreator; |
961 pDictionary->SetAtString("Creator", PDF_EncodeText(csCreator)); | 957 pDictionary->SetAtString("Creator", PDF_EncodeText(csCreator)); |
962 m_pDocument->SetChangeMark(); | 958 m_pDocument->SetChangeMark(); |
963 return TRUE; | 959 return TRUE; |
964 } | 960 } |
965 } | 961 } |
966 | 962 |
967 FX_BOOL Document::delay(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sE
rror) | 963 FX_BOOL Document::delay(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror) |
968 { | 964 { |
969 if (vp.IsGetting()) | 965 if (vp.IsGetting()) |
970 { | 966 { |
971 vp << m_bDelay; | 967 vp << m_bDelay; |
972 return TRUE; | 968 return TRUE; |
973 } | 969 } |
974 else | 970 else |
975 { | 971 { |
976 ASSERT(m_pDocument != NULL); | 972 ASSERT(m_pDocument != NULL); |
977 | 973 |
(...skipping 21 matching lines...) Expand all Loading... |
999 delete m_DelayData.GetAt(i); | 995 delete m_DelayData.GetAt(i); |
1000 } | 996 } |
1001 } | 997 } |
1002 m_DelayData.RemoveAll(); | 998 m_DelayData.RemoveAll(); |
1003 } | 999 } |
1004 | 1000 |
1005 return TRUE; | 1001 return TRUE; |
1006 } | 1002 } |
1007 } | 1003 } |
1008 | 1004 |
1009 FX_BOOL Document::keywords(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString&
sError) | 1005 FX_BOOL Document::keywords(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) |
1010 { | 1006 { |
1011 ASSERT(m_pDocument != NULL); | 1007 ASSERT(m_pDocument != NULL); |
1012 | 1008 |
1013 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetPDFDoc()->
GetInfo(); | 1009 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetPDFDoc()->
GetInfo(); |
1014 if (!pDictionary)return FALSE; | 1010 if (!pDictionary)return FALSE; |
1015 | 1011 |
1016 if (vp.IsGetting()) | 1012 if (vp.IsGetting()) |
1017 { | 1013 { |
1018 vp << pDictionary->GetUnicodeText("Keywords"); | 1014 vp << pDictionary->GetUnicodeText("Keywords"); |
1019 return TRUE; | 1015 return TRUE; |
1020 } | 1016 } |
1021 else | 1017 else |
1022 { | 1018 { |
1023 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) return FALSE; | 1019 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) return FALSE; |
1024 | 1020 |
1025 CFX_WideString csKeywords; | 1021 CFX_WideString csKeywords; |
1026 vp >> csKeywords; | 1022 vp >> csKeywords; |
1027 pDictionary->SetAtString("Keywords", PDF_EncodeText(csKeywords))
; | 1023 pDictionary->SetAtString("Keywords", PDF_EncodeText(csKeywords))
; |
1028 m_pDocument->SetChangeMark(); | 1024 m_pDocument->SetChangeMark(); |
1029 return TRUE; | 1025 return TRUE; |
1030 } | 1026 } |
1031 } | 1027 } |
1032 | 1028 |
1033 FX_BOOL Document::modDate(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString&
sError) | 1029 FX_BOOL Document::modDate(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) |
1034 { | 1030 { |
1035 ASSERT(m_pDocument != NULL); | 1031 ASSERT(m_pDocument != NULL); |
1036 | 1032 |
1037 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetPDFDoc()->
GetInfo(); | 1033 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetPDFDoc()->
GetInfo(); |
1038 if (!pDictionary)return FALSE; | 1034 if (!pDictionary)return FALSE; |
1039 | 1035 |
1040 if (vp.IsGetting()) | 1036 if (vp.IsGetting()) |
1041 { | 1037 { |
1042 vp << pDictionary->GetUnicodeText("ModDate"); | 1038 vp << pDictionary->GetUnicodeText("ModDate"); |
1043 return TRUE; | 1039 return TRUE; |
1044 } | 1040 } |
1045 else | 1041 else |
1046 { | 1042 { |
1047 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) return FALSE; | 1043 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) return FALSE; |
1048 | 1044 |
1049 CFX_WideString csmodDate; | 1045 CFX_WideString csmodDate; |
1050 vp >> csmodDate; | 1046 vp >> csmodDate; |
1051 pDictionary->SetAtString("ModDate", PDF_EncodeText(csmodDate)); | 1047 pDictionary->SetAtString("ModDate", PDF_EncodeText(csmodDate)); |
1052 m_pDocument->SetChangeMark(); | 1048 m_pDocument->SetChangeMark(); |
1053 return TRUE; | 1049 return TRUE; |
1054 } | 1050 } |
1055 } | 1051 } |
1056 | 1052 |
1057 FX_BOOL Document::producer(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString&
sError) | 1053 FX_BOOL Document::producer(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) |
1058 { | 1054 { |
1059 ASSERT(m_pDocument != NULL); | 1055 ASSERT(m_pDocument != NULL); |
1060 | 1056 |
1061 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetPDFDoc()->
GetInfo(); | 1057 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetPDFDoc()->
GetInfo(); |
1062 if (!pDictionary)return FALSE; | 1058 if (!pDictionary)return FALSE; |
1063 | 1059 |
1064 if (vp.IsGetting()) | 1060 if (vp.IsGetting()) |
1065 { | 1061 { |
1066 vp << pDictionary->GetUnicodeText("Producer"); | 1062 vp << pDictionary->GetUnicodeText("Producer"); |
1067 return TRUE; | 1063 return TRUE; |
1068 } | 1064 } |
1069 else | 1065 else |
1070 { | 1066 { |
1071 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) return FALSE; | 1067 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) return FALSE; |
1072 | 1068 |
1073 CFX_WideString csproducer; | 1069 CFX_WideString csproducer; |
1074 vp >> csproducer; | 1070 vp >> csproducer; |
1075 pDictionary->SetAtString("Producer", PDF_EncodeText(csproducer))
; | 1071 pDictionary->SetAtString("Producer", PDF_EncodeText(csproducer))
; |
1076 m_pDocument->SetChangeMark(); | 1072 m_pDocument->SetChangeMark(); |
1077 return TRUE; | 1073 return TRUE; |
1078 } | 1074 } |
1079 } | 1075 } |
1080 | 1076 |
1081 FX_BOOL Document::subject(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString&
sError) | 1077 FX_BOOL Document::subject(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) |
1082 { | 1078 { |
1083 ASSERT(m_pDocument != NULL); | 1079 ASSERT(m_pDocument != NULL); |
1084 | 1080 |
1085 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetPDFDoc()->
GetInfo(); | 1081 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetPDFDoc()->
GetInfo(); |
1086 if (!pDictionary)return FALSE; | 1082 if (!pDictionary)return FALSE; |
1087 | 1083 |
1088 if (vp.IsGetting()) | 1084 if (vp.IsGetting()) |
1089 { | 1085 { |
1090 vp << pDictionary->GetUnicodeText("Subject"); | 1086 vp << pDictionary->GetUnicodeText("Subject"); |
1091 return TRUE; | 1087 return TRUE; |
1092 } | 1088 } |
1093 else | 1089 else |
1094 { | 1090 { |
1095 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) return FALSE; | 1091 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) return FALSE; |
1096 | 1092 |
1097 CFX_WideString cssubject; | 1093 CFX_WideString cssubject; |
1098 vp >> cssubject; | 1094 vp >> cssubject; |
1099 pDictionary->SetAtString("Subject", PDF_EncodeText(cssubject)); | 1095 pDictionary->SetAtString("Subject", PDF_EncodeText(cssubject)); |
1100 m_pDocument->SetChangeMark(); | 1096 m_pDocument->SetChangeMark(); |
1101 return TRUE; | 1097 return TRUE; |
1102 } | 1098 } |
1103 } | 1099 } |
1104 | 1100 |
1105 FX_BOOL Document::title(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sE
rror) | 1101 FX_BOOL Document::title(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror) |
1106 { | 1102 { |
1107 ASSERT(m_pDocument != NULL); | 1103 ASSERT(m_pDocument != NULL); |
1108 | 1104 |
1109 if (m_pDocument == NULL || m_pDocument->GetDocument() == NULL) | 1105 if (m_pDocument == NULL || m_pDocument->GetDocument() == NULL) |
1110 return FALSE; | 1106 return FALSE; |
1111 | 1107 |
1112 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetPDFDoc()->
GetInfo(); | 1108 CPDF_Dictionary* pDictionary = m_pDocument->GetDocument()->GetPDFDoc()->
GetInfo(); |
1113 if (!pDictionary)return FALSE; | 1109 if (!pDictionary)return FALSE; |
1114 | 1110 |
1115 if (vp.IsGetting()) | 1111 if (vp.IsGetting()) |
1116 { | 1112 { |
1117 vp << pDictionary->GetUnicodeText("Title"); | 1113 vp << pDictionary->GetUnicodeText("Title"); |
1118 return TRUE; | 1114 return TRUE; |
1119 } | 1115 } |
1120 else | 1116 else |
1121 { | 1117 { |
1122 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) return FALSE; | 1118 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) return FALSE; |
1123 | 1119 |
1124 CFX_WideString cstitle; | 1120 CFX_WideString cstitle; |
1125 vp >> cstitle; | 1121 vp >> cstitle; |
1126 pDictionary->SetAtString("Title", PDF_EncodeText(cstitle)); | 1122 pDictionary->SetAtString("Title", PDF_EncodeText(cstitle)); |
1127 m_pDocument->SetChangeMark(); | 1123 m_pDocument->SetChangeMark(); |
1128 return TRUE; | 1124 return TRUE; |
1129 } | 1125 } |
1130 } | 1126 } |
1131 | 1127 |
1132 FX_BOOL Document::numPages(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString&
sError) | 1128 FX_BOOL Document::numPages(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) |
1133 { | 1129 { |
1134 if (vp.IsSetting()) { | 1130 if (vp.IsSetting()) { |
1135 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 1131 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
1136 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); | 1132 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); |
1137 return FALSE; | 1133 return FALSE; |
1138 } | 1134 } |
1139 vp << m_pDocument->GetPageCount(); | 1135 vp << m_pDocument->GetPageCount(); |
1140 return TRUE; | 1136 return TRUE; |
1141 } | 1137 } |
1142 | 1138 |
1143 FX_BOOL Document::external(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString&
sError) | 1139 FX_BOOL Document::external(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) |
1144 { | 1140 { |
1145 //In Chrome case,should always return true. | 1141 //In Chrome case,should always return true. |
1146 vp << TRUE; | 1142 vp << TRUE; |
1147 return TRUE; | 1143 return TRUE; |
1148 } | 1144 } |
1149 | 1145 |
1150 FX_BOOL Document::filesize(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString&
sError) | 1146 FX_BOOL Document::filesize(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) |
1151 { | 1147 { |
1152 if (vp.IsSetting()) { | 1148 if (vp.IsSetting()) { |
1153 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 1149 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
1154 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); | 1150 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); |
1155 return FALSE; | 1151 return FALSE; |
1156 } | 1152 } |
1157 vp << 0; | 1153 vp << 0; |
1158 return TRUE; | 1154 return TRUE; |
1159 } | 1155 } |
1160 | 1156 |
1161 FX_BOOL Document::mouseX(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& s
Error) | 1157 FX_BOOL Document::mouseX(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error) |
1162 { | 1158 { |
1163 return TRUE; | 1159 return TRUE; |
1164 } | 1160 } |
1165 | 1161 |
1166 FX_BOOL Document::mouseY(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& s
Error) | 1162 FX_BOOL Document::mouseY(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error) |
1167 { | 1163 { |
1168 return TRUE; | 1164 return TRUE; |
1169 } | 1165 } |
1170 | 1166 |
1171 FX_BOOL Document::baseURL(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString&
sError) | 1167 FX_BOOL Document::baseURL(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) |
1172 { | 1168 { |
1173 if (vp.IsGetting()) | 1169 if (vp.IsGetting()) |
1174 { | 1170 { |
1175 vp << m_cwBaseURL; | 1171 vp << m_cwBaseURL; |
1176 return TRUE; | 1172 return TRUE; |
1177 } | 1173 } |
1178 else | 1174 else |
1179 { | 1175 { |
1180 vp >> m_cwBaseURL; | 1176 vp >> m_cwBaseURL; |
1181 return TRUE; | 1177 return TRUE; |
1182 } | 1178 } |
1183 } | 1179 } |
1184 | 1180 |
1185 FX_BOOL Document::calculate(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString
& sError) | 1181 FX_BOOL Document::calculate(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString
& sError) |
1186 { | 1182 { |
1187 ASSERT(m_pDocument != NULL); | 1183 ASSERT(m_pDocument != NULL); |
1188 | 1184 |
1189 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte
rForm(); | 1185 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte
rForm(); |
1190 ASSERT(pInterForm != NULL); | 1186 ASSERT(pInterForm != NULL); |
1191 | 1187 |
1192 if (vp.IsGetting()) | 1188 if (vp.IsGetting()) |
1193 { | 1189 { |
1194 if (pInterForm->IsCalculateEnabled()) | 1190 if (pInterForm->IsCalculateEnabled()) |
1195 vp << true; | 1191 vp << true; |
1196 else | 1192 else |
1197 vp << false; | 1193 vp << false; |
1198 } | 1194 } |
1199 else | 1195 else |
1200 { | 1196 { |
1201 bool bCalculate; | 1197 bool bCalculate; |
1202 vp >> bCalculate; | 1198 vp >> bCalculate; |
1203 | 1199 |
1204 pInterForm->EnableCalculate(bCalculate); | 1200 pInterForm->EnableCalculate(bCalculate); |
1205 } | 1201 } |
1206 | 1202 |
1207 return TRUE; | 1203 return TRUE; |
1208 } | 1204 } |
1209 | 1205 |
1210 FX_BOOL Document::documentFileName(IFXJS_Context* cc, CJS_PropValue& vp, JS_Erro
rString& sError) | 1206 FX_BOOL Document::documentFileName(IFXJS_Context* cc, CJS_PropValue& vp, CFX_Wid
eString& sError) |
1211 { | 1207 { |
1212 if (vp.IsSetting()) { | 1208 if (vp.IsSetting()) { |
1213 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 1209 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
1214 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); | 1210 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); |
1215 return FALSE; | 1211 return FALSE; |
1216 } | 1212 } |
1217 CFX_WideString wsFilePath = m_pDocument->GetPath(); | 1213 CFX_WideString wsFilePath = m_pDocument->GetPath(); |
1218 FX_INT32 i = wsFilePath.GetLength() - 1; | 1214 FX_INT32 i = wsFilePath.GetLength() - 1; |
1219 for ( ; i >= 0; i-- ) | 1215 for ( ; i >= 0; i-- ) |
1220 { | 1216 { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1270 } | 1266 } |
1271 pResult[iLength] = L'\0'; | 1267 pResult[iLength] = L'\0'; |
1272 | 1268 |
1273 cbFrom.ReleaseBuffer(); | 1269 cbFrom.ReleaseBuffer(); |
1274 CFX_WideString cbRet = CFX_WideString(pResult); | 1270 CFX_WideString cbRet = CFX_WideString(pResult); |
1275 free(pResult); | 1271 free(pResult); |
1276 pResult = NULL; | 1272 pResult = NULL; |
1277 return cbRet; | 1273 return cbRet; |
1278 } | 1274 } |
1279 | 1275 |
1280 FX_BOOL Document::path(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sEr
ror) | 1276 FX_BOOL Document::path(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr
ror) |
1281 { | 1277 { |
1282 if (vp.IsSetting()) { | 1278 if (vp.IsSetting()) { |
1283 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 1279 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
1284 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); | 1280 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); |
1285 return FALSE; | 1281 return FALSE; |
1286 } | 1282 } |
1287 vp << app::SysPathToPDFPath(m_pDocument->GetPath()); | 1283 vp << app::SysPathToPDFPath(m_pDocument->GetPath()); |
1288 return TRUE; | 1284 return TRUE; |
1289 } | 1285 } |
1290 | 1286 |
1291 FX_BOOL Document::pageWindowRect(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorS
tring& sError) | 1287 FX_BOOL Document::pageWindowRect(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideS
tring& sError) |
1292 { | 1288 { |
1293 return TRUE; | 1289 return TRUE; |
1294 } | 1290 } |
1295 | 1291 |
1296 FX_BOOL Document::layout(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& s
Error) | 1292 FX_BOOL Document::layout(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error) |
1297 { | 1293 { |
1298 return TRUE; | 1294 return TRUE; |
1299 } | 1295 } |
1300 | 1296 |
1301 FX_BOOL Document::addLink(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, JS_ErrorString& sError) | 1297 FX_BOOL Document::addLink(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, CFX_WideString& sError) |
1302 { | 1298 { |
1303 return TRUE; | 1299 return TRUE; |
1304 } | 1300 } |
1305 | 1301 |
1306 FX_BOOL Document::closeDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, JS_ErrorString& sError) | 1302 FX_BOOL Document::closeDoc(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, CFX_WideString& sError) |
1307 { | 1303 { |
1308 ASSERT(m_pDocument != NULL); | 1304 ASSERT(m_pDocument != NULL); |
1309 | 1305 |
1310 | 1306 |
1311 | 1307 |
1312 | 1308 |
1313 | 1309 |
1314 return TRUE; | 1310 return TRUE; |
1315 } | 1311 } |
1316 | 1312 |
1317 FX_BOOL Document::getPageBox(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, JS_ErrorString& sError) | 1313 FX_BOOL Document::getPageBox(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, CFX_WideString& sError) |
1318 { | 1314 { |
1319 return TRUE; | 1315 return TRUE; |
1320 } | 1316 } |
1321 | 1317 |
1322 | 1318 |
1323 FX_BOOL Document::getAnnot(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, JS_ErrorString& sError) | 1319 FX_BOOL Document::getAnnot(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, CFX_WideString& sError) |
1324 { | 1320 { |
1325 return TRUE; | 1321 return TRUE; |
1326 } | 1322 } |
1327 | 1323 |
1328 FX_BOOL Document::getAnnots(IFXJS_Context* cc, const CJS_Parameters& params, CJS
_Value& vRet, JS_ErrorString& sError) | 1324 FX_BOOL Document::getAnnots(IFXJS_Context* cc, const CJS_Parameters& params, CJS
_Value& vRet, CFX_WideString& sError) |
1329 { | 1325 { |
1330 vRet.SetNull(); | 1326 vRet.SetNull(); |
1331 return TRUE; | 1327 return TRUE; |
1332 } | 1328 } |
1333 | 1329 |
1334 FX_BOOL Document::getAnnot3D(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, JS_ErrorString& sError) | 1330 FX_BOOL Document::getAnnot3D(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, CFX_WideString& sError) |
1335 { | 1331 { |
1336 vRet.SetNull(); | 1332 vRet.SetNull(); |
1337 return TRUE; | 1333 return TRUE; |
1338 } | 1334 } |
1339 | 1335 |
1340 FX_BOOL Document::getAnnots3D(IFXJS_Context* cc, const CJS_Parameters& params, C
JS_Value& vRet, JS_ErrorString& sError) | 1336 FX_BOOL Document::getAnnots3D(IFXJS_Context* cc, const CJS_Parameters& params, C
JS_Value& vRet, CFX_WideString& sError) |
1341 { | 1337 { |
1342 vRet = VT_undefined; | 1338 vRet = VT_undefined; |
1343 return TRUE; | 1339 return TRUE; |
1344 } | 1340 } |
1345 | 1341 |
1346 FX_BOOL Document::getOCGs(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, JS_ErrorString& sError) | 1342 FX_BOOL Document::getOCGs(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, CFX_WideString& sError) |
1347 { | 1343 { |
1348 return TRUE; | 1344 return TRUE; |
1349 } | 1345 } |
1350 | 1346 |
1351 FX_BOOL Document::getLinks(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, JS_ErrorString& sError) | 1347 FX_BOOL Document::getLinks(IFXJS_Context* cc, const CJS_Parameters& params, CJS_
Value& vRet, CFX_WideString& sError) |
1352 { | 1348 { |
1353 return TRUE; | 1349 return TRUE; |
1354 } | 1350 } |
1355 | 1351 |
1356 bool Document::IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect) | 1352 bool Document::IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect) |
1357 { | 1353 { |
1358 if (rect.left <= LinkRect.left | 1354 if (rect.left <= LinkRect.left |
1359 && rect.top <= LinkRect.top | 1355 && rect.top <= LinkRect.top |
1360 && rect.right >= LinkRect.right | 1356 && rect.right >= LinkRect.right |
1361 && rect.bottom >= LinkRect.bottom) | 1357 && rect.bottom >= LinkRect.bottom) |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1452 pElement = NULL; | 1448 pElement = NULL; |
1453 } | 1449 } |
1454 | 1450 |
1455 continue; | 1451 continue; |
1456 } | 1452 } |
1457 | 1453 |
1458 pTemp = pTemp->NextIcon; | 1454 pTemp = pTemp->NextIcon; |
1459 } | 1455 } |
1460 } | 1456 } |
1461 | 1457 |
1462 FX_BOOL Document::addIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, JS_ErrorString& sError) | 1458 FX_BOOL Document::addIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, CFX_WideString& sError) |
1463 { | 1459 { |
1464 if (params.size() != 2)return FALSE; | 1460 if (params.size() != 2)return FALSE; |
1465 | 1461 |
1466 CJS_Context* pContext = (CJS_Context*)cc; | 1462 CJS_Context* pContext = (CJS_Context*)cc; |
1467 ASSERT(pContext != NULL); | 1463 ASSERT(pContext != NULL); |
1468 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 1464 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
1469 ASSERT(pRuntime != NULL); | 1465 ASSERT(pRuntime != NULL); |
1470 | 1466 |
1471 CFX_WideString swIconName = params[0].operator CFX_WideString(); | 1467 CFX_WideString swIconName = params[0].operator CFX_WideString(); |
1472 | 1468 |
1473 JSFXObject pJSIcon = (JSFXObject)params[1]; | 1469 JSFXObject pJSIcon = (JSFXObject)params[1]; |
1474 if (JS_GetObjDefnID(pJSIcon) != JS_GetObjDefnID(*pRuntime, L"Icon")) ret
urn FALSE; | 1470 if (JS_GetObjDefnID(pJSIcon) != JS_GetObjDefnID(*pRuntime, L"Icon")) ret
urn FALSE; |
1475 | 1471 |
1476 CJS_EmbedObj* pEmbedObj = ((CJS_Object*)params[1])->GetEmbedObject(); | 1472 CJS_EmbedObj* pEmbedObj = ((CJS_Object*)params[1])->GetEmbedObject(); |
1477 if (!pEmbedObj)return FALSE; | 1473 if (!pEmbedObj)return FALSE; |
1478 Icon* pIcon = (Icon*)pEmbedObj; | 1474 Icon* pIcon = (Icon*)pEmbedObj; |
1479 | 1475 |
1480 if (!m_pIconTree) | 1476 if (!m_pIconTree) |
1481 m_pIconTree = new IconTree(); | 1477 m_pIconTree = new IconTree(); |
1482 | 1478 |
1483 IconElement* pNewIcon = new IconElement(); | 1479 IconElement* pNewIcon = new IconElement(); |
1484 pNewIcon->IconName = swIconName; | 1480 pNewIcon->IconName = swIconName; |
1485 pNewIcon->NextIcon = NULL; | 1481 pNewIcon->NextIcon = NULL; |
1486 pNewIcon->IconStream = pIcon; | 1482 pNewIcon->IconStream = pIcon; |
1487 m_pIconTree->InsertIconElement(pNewIcon); | 1483 m_pIconTree->InsertIconElement(pNewIcon); |
1488 return TRUE; | 1484 return TRUE; |
1489 } | 1485 } |
1490 | 1486 |
1491 FX_BOOL Document::icons(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sE
rror) | 1487 FX_BOOL Document::icons(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror) |
1492 { | 1488 { |
1493 if (vp.IsSetting()) { | 1489 if (vp.IsSetting()) { |
1494 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 1490 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
1495 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); | 1491 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); |
1496 return FALSE; | 1492 return FALSE; |
1497 } | 1493 } |
1498 | 1494 |
1499 if (!m_pIconTree) | 1495 if (!m_pIconTree) |
1500 { | 1496 { |
1501 vp.SetNull(); | 1497 vp.SetNull(); |
(...skipping 22 matching lines...) Expand all Loading... |
1524 | 1520 |
1525 pIcon->SetStream(pIconElement->IconStream->GetStream()); | 1521 pIcon->SetStream(pIconElement->IconStream->GetStream()); |
1526 pIcon->SetIconName(pIconElement->IconName); | 1522 pIcon->SetIconName(pIconElement->IconName); |
1527 Icons.SetElement(i, CJS_Value(m_isolate,pJS_Icon)); | 1523 Icons.SetElement(i, CJS_Value(m_isolate,pJS_Icon)); |
1528 } | 1524 } |
1529 | 1525 |
1530 vp << Icons; | 1526 vp << Icons; |
1531 return TRUE; | 1527 return TRUE; |
1532 } | 1528 } |
1533 | 1529 |
1534 FX_BOOL Document::getIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, JS_ErrorString& sError) | 1530 FX_BOOL Document::getIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJS_V
alue& vRet, CFX_WideString& sError) |
1535 { | 1531 { |
1536 if (params.size() != 1)return FALSE; | 1532 if (params.size() != 1)return FALSE; |
1537 if(!m_pIconTree) | 1533 if(!m_pIconTree) |
1538 return FALSE; | 1534 return FALSE; |
1539 CFX_WideString swIconName = params[0].operator CFX_WideString(); | 1535 CFX_WideString swIconName = params[0].operator CFX_WideString(); |
1540 int iIconCounts = m_pIconTree->GetLength(); | 1536 int iIconCounts = m_pIconTree->GetLength(); |
1541 | 1537 |
1542 CJS_Context* pContext = (CJS_Context *)cc; | 1538 CJS_Context* pContext = (CJS_Context *)cc; |
1543 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 1539 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
1544 | 1540 |
(...skipping 15 matching lines...) Expand all Loading... |
1560 pIcon->SetIconName(swIconName); | 1556 pIcon->SetIconName(swIconName); |
1561 pIcon->SetStream(pRetIcon->GetStream()); | 1557 pIcon->SetStream(pRetIcon->GetStream()); |
1562 vRet = pJS_Icon; | 1558 vRet = pJS_Icon; |
1563 return TRUE; | 1559 return TRUE; |
1564 } | 1560 } |
1565 } | 1561 } |
1566 | 1562 |
1567 return FALSE; | 1563 return FALSE; |
1568 } | 1564 } |
1569 | 1565 |
1570 FX_BOOL Document::removeIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, JS_ErrorString& sError) | 1566 FX_BOOL Document::removeIcon(IFXJS_Context* cc, const CJS_Parameters& params, CJ
S_Value& vRet, CFX_WideString& sError) |
1571 { | 1567 { |
1572 if (params.size() != 1)return FALSE; | 1568 if (params.size() != 1)return FALSE; |
1573 if(!m_pIconTree) | 1569 if(!m_pIconTree) |
1574 return FALSE; | 1570 return FALSE; |
1575 CFX_WideString swIconName = params[0].operator CFX_WideString(); | 1571 CFX_WideString swIconName = params[0].operator CFX_WideString(); |
1576 return TRUE; | 1572 return TRUE; |
1577 } | 1573 } |
1578 | 1574 |
1579 FX_BOOL Document::createDataObject(IFXJS_Context* cc, const CJS_Parameters& para
ms, CJS_Value& vRet, JS_ErrorString& sError) | 1575 FX_BOOL Document::createDataObject(IFXJS_Context* cc, const CJS_Parameters& para
ms, CJS_Value& vRet, CFX_WideString& sError) |
1580 { | 1576 { |
1581 // Unsafe, not implemented. | 1577 // Unsafe, not implemented. |
1582 return TRUE; | 1578 return TRUE; |
1583 } | 1579 } |
1584 | 1580 |
1585 FX_BOOL Document::media(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sE
rror) | 1581 FX_BOOL Document::media(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sE
rror) |
1586 { | 1582 { |
1587 return TRUE; | 1583 return TRUE; |
1588 } | 1584 } |
1589 | 1585 |
1590 FX_BOOL Document::calculateNow(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, JS_ErrorString& sError) | 1586 FX_BOOL Document::calculateNow(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, CFX_WideString& sError) |
1591 { | 1587 { |
1592 ASSERT(m_pDocument != NULL); | 1588 ASSERT(m_pDocument != NULL); |
1593 | 1589 |
1594 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || | 1590 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || |
1595 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || | 1591 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || |
1596 m_pDocument->GetPermissions(FPDFPERM_FILL_FORM))) return FALSE; | 1592 m_pDocument->GetPermissions(FPDFPERM_FILL_FORM))) return FALSE; |
1597 | 1593 |
1598 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte
rForm(); | 1594 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInte
rForm(); |
1599 ASSERT(pInterForm != NULL); | 1595 ASSERT(pInterForm != NULL); |
1600 pInterForm->OnCalculate(); | 1596 pInterForm->OnCalculate(); |
1601 return TRUE; | 1597 return TRUE; |
1602 } | 1598 } |
1603 | 1599 |
1604 FX_BOOL Document::Collab(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& s
Error) | 1600 FX_BOOL Document::Collab(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& s
Error) |
1605 { | 1601 { |
1606 return TRUE; | 1602 return TRUE; |
1607 } | 1603 } |
1608 | 1604 |
1609 FX_BOOL Document::getPageNthWord(IFXJS_Context* cc, const CJS_Parameters& params
, CJS_Value& vRet, JS_ErrorString& sError) | 1605 FX_BOOL Document::getPageNthWord(IFXJS_Context* cc, const CJS_Parameters& params
, CJS_Value& vRet, CFX_WideString& sError) |
1610 { | 1606 { |
1611 ASSERT(m_pDocument != NULL); | 1607 ASSERT(m_pDocument != NULL); |
1612 | 1608 |
1613 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE; | 1609 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE; |
1614 | 1610 |
1615 int nPageNo = params.GetSize() > 0 ? (int)params[0] : 0; | 1611 int nPageNo = params.GetSize() > 0 ? (int)params[0] : 0; |
1616 int nWordNo = params.GetSize() > 1 ? (int)params[1] : 0; | 1612 int nWordNo = params.GetSize() > 1 ? (int)params[1] : 0; |
1617 bool bStrip = params.GetSize() > 2 ? (bool)params[2] : true; | 1613 bool bStrip = params.GetSize() > 2 ? (bool)params[2] : true; |
1618 | 1614 |
1619 CPDF_Document* pDocument = m_pDocument->GetDocument()->GetPDFDoc(); | 1615 CPDF_Document* pDocument = m_pDocument->GetDocument()->GetPDFDoc(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1662 if (bStrip) | 1658 if (bStrip) |
1663 { | 1659 { |
1664 swRet.TrimLeft(); | 1660 swRet.TrimLeft(); |
1665 swRet.TrimRight(); | 1661 swRet.TrimRight(); |
1666 } | 1662 } |
1667 | 1663 |
1668 vRet = swRet; | 1664 vRet = swRet; |
1669 return TRUE; | 1665 return TRUE; |
1670 } | 1666 } |
1671 | 1667 |
1672 FX_BOOL Document::getPageNthWordQuads(IFXJS_Context* cc, const CJS_Parameters& p
arams, CJS_Value& vRet, JS_ErrorString& sError) | 1668 FX_BOOL Document::getPageNthWordQuads(IFXJS_Context* cc, const CJS_Parameters& p
arams, CJS_Value& vRet, CFX_WideString& sError) |
1673 { | 1669 { |
1674 ASSERT(m_pDocument != NULL); | 1670 ASSERT(m_pDocument != NULL); |
1675 | 1671 |
1676 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE; | 1672 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE; |
1677 | 1673 |
1678 return FALSE; | 1674 return FALSE; |
1679 } | 1675 } |
1680 | 1676 |
1681 FX_BOOL Document::getPageNumWords(IFXJS_Context* cc, const CJS_Parameters& param
s, CJS_Value& vRet, JS_ErrorString& sError) | 1677 FX_BOOL Document::getPageNumWords(IFXJS_Context* cc, const CJS_Parameters& param
s, CJS_Value& vRet, CFX_WideString& sError) |
1682 { | 1678 { |
1683 ASSERT(m_pDocument != NULL); | 1679 ASSERT(m_pDocument != NULL); |
1684 | 1680 |
1685 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE; | 1681 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE; |
1686 | 1682 |
1687 int nPageNo = params.GetSize() > 0 ? (int)params[0] : 0; | 1683 int nPageNo = params.GetSize() > 0 ? (int)params[0] : 0; |
1688 | 1684 |
1689 CPDF_Document* pDocument = m_pDocument->GetDocument()->GetPDFDoc(); | 1685 CPDF_Document* pDocument = m_pDocument->GetDocument()->GetPDFDoc(); |
1690 ASSERT(pDocument != NULL); | 1686 ASSERT(pDocument != NULL); |
1691 | 1687 |
(...skipping 26 matching lines...) Expand all Loading... |
1718 nWords += CountWords(pTextObj); | 1714 nWords += CountWords(pTextObj); |
1719 } | 1715 } |
1720 } | 1716 } |
1721 } | 1717 } |
1722 | 1718 |
1723 vRet = nWords; | 1719 vRet = nWords; |
1724 | 1720 |
1725 return TRUE; | 1721 return TRUE; |
1726 } | 1722 } |
1727 | 1723 |
1728 FX_BOOL Document::getPrintParams(IFXJS_Context* cc, const CJS_Parameters& params
, CJS_Value& vRet, JS_ErrorString& sError) | 1724 FX_BOOL Document::getPrintParams(IFXJS_Context* cc, const CJS_Parameters& params
, CJS_Value& vRet, CFX_WideString& sError) |
1729 { | 1725 { |
1730 CJS_Context* pContext = (CJS_Context*)cc; | 1726 CJS_Context* pContext = (CJS_Context*)cc; |
1731 ASSERT(pContext != NULL); | 1727 ASSERT(pContext != NULL); |
1732 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 1728 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
1733 ASSERT(pRuntime != NULL); | 1729 ASSERT(pRuntime != NULL); |
1734 JSFXObject pRetObj = JS_NewFxDynamicObj(*pRuntime, pContext, JS_GetObjDe
fnID(*pRuntime, L"PrintParamsObj")); | 1730 JSFXObject pRetObj = JS_NewFxDynamicObj(*pRuntime, pContext, JS_GetObjDe
fnID(*pRuntime, L"PrintParamsObj")); |
1735 //not implemented yet. | 1731 //not implemented yet. |
1736 vRet = pRetObj; | 1732 vRet = pRetObj; |
1737 | 1733 |
1738 return TRUE; | 1734 return TRUE; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1808 nWords++; | 1804 nWords++; |
1809 } | 1805 } |
1810 | 1806 |
1811 if (nWords-1 == nWordIndex) | 1807 if (nWords-1 == nWordIndex) |
1812 swRet += unicode; | 1808 swRet += unicode; |
1813 } | 1809 } |
1814 | 1810 |
1815 return swRet; | 1811 return swRet; |
1816 } | 1812 } |
1817 | 1813 |
1818 FX_BOOL Document::zoom(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString& sEr
ror) | 1814 FX_BOOL Document::zoom(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sEr
ror) |
1819 { | 1815 { |
1820 | 1816 |
1821 return TRUE; | 1817 return TRUE; |
1822 } | 1818 } |
1823 | 1819 |
1824 /** | 1820 /** |
1825 (none, NoVary) | 1821 (none, NoVary) |
1826 (fitP, FitPage) | 1822 (fitP, FitPage) |
1827 (fitW, FitWidth) | 1823 (fitW, FitWidth) |
1828 (fitH, FitHeight) | 1824 (fitH, FitHeight) |
1829 (fitV, FitVisibleWidth) | 1825 (fitV, FitVisibleWidth) |
1830 (pref, Preferred) | 1826 (pref, Preferred) |
1831 (refW, ReflowWidth) | 1827 (refW, ReflowWidth) |
1832 */ | 1828 */ |
1833 | 1829 |
1834 FX_BOOL Document::zoomType(IFXJS_Context* cc, CJS_PropValue& vp, JS_ErrorString&
sError) | 1830 FX_BOOL Document::zoomType(IFXJS_Context* cc, CJS_PropValue& vp, CFX_WideString&
sError) |
1835 { | 1831 { |
1836 return TRUE; | 1832 return TRUE; |
1837 } | 1833 } |
1838 | 1834 |
1839 FX_BOOL Document::deletePages(IFXJS_Context* cc, const CJS_Parameters& params, C
JS_Value& vRet, JS_ErrorString& sError) | 1835 FX_BOOL Document::deletePages(IFXJS_Context* cc, const CJS_Parameters& params, C
JS_Value& vRet, CFX_WideString& sError) |
1840 { | 1836 { |
1841 v8::Isolate* isolate = GetIsolate(cc); | 1837 v8::Isolate* isolate = GetIsolate(cc); |
1842 ASSERT(m_pDocument != NULL); | 1838 ASSERT(m_pDocument != NULL); |
1843 | 1839 |
1844 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || | 1840 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || |
1845 m_pDocument->GetPermissions(FPDFPERM_ASSEMBLE))) return FALSE; | 1841 m_pDocument->GetPermissions(FPDFPERM_ASSEMBLE))) return FALSE; |
1846 | 1842 |
1847 int iSize = params.size(); | 1843 int iSize = params.size(); |
1848 | 1844 |
1849 int nStart = 0; | 1845 int nStart = 0; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1882 if (nEnd < 0) nEnd = 0; | 1878 if (nEnd < 0) nEnd = 0; |
1883 if (nEnd >= nTotal) nEnd = nTotal - 1; | 1879 if (nEnd >= nTotal) nEnd = nTotal - 1; |
1884 | 1880 |
1885 if (nEnd < nStart) nEnd = nStart; | 1881 if (nEnd < nStart) nEnd = nStart; |
1886 | 1882 |
1887 | 1883 |
1888 | 1884 |
1889 return TRUE; | 1885 return TRUE; |
1890 } | 1886 } |
1891 | 1887 |
1892 FX_BOOL Document::extractPages(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, JS_ErrorString& sError) | 1888 FX_BOOL Document::extractPages(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, CFX_WideString& sError) |
1893 { | 1889 { |
1894 // Unsafe, not supported. | 1890 // Unsafe, not supported. |
1895 return TRUE; | 1891 return TRUE; |
1896 } | 1892 } |
1897 | 1893 |
1898 FX_BOOL Document::insertPages(IFXJS_Context* cc, const CJS_Parameters& params, C
JS_Value& vRet, JS_ErrorString& sError) | 1894 FX_BOOL Document::insertPages(IFXJS_Context* cc, const CJS_Parameters& params, C
JS_Value& vRet, CFX_WideString& sError) |
1899 { | 1895 { |
1900 // Unsafe, not supported. | 1896 // Unsafe, not supported. |
1901 return TRUE; | 1897 return TRUE; |
1902 } | 1898 } |
1903 | 1899 |
1904 FX_BOOL Document::replacePages(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, JS_ErrorString& sError) | 1900 FX_BOOL Document::replacePages(IFXJS_Context* cc, const CJS_Parameters& params,
CJS_Value& vRet, CFX_WideString& sError) |
1905 { | 1901 { |
1906 // Unsafe, not supported. | 1902 // Unsafe, not supported. |
1907 return TRUE; | 1903 return TRUE; |
1908 } | 1904 } |
1909 | 1905 |
1910 FX_BOOL Document::getURL(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
lue& vRet, JS_ErrorString& sError) | 1906 FX_BOOL Document::getURL(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
lue& vRet, CFX_WideString& sError) |
1911 { | 1907 { |
1912 // Unsafe, not supported. | 1908 // Unsafe, not supported. |
1913 return TRUE; | 1909 return TRUE; |
1914 } | 1910 } |
1915 | 1911 |
1916 void Document::AddDelayData(CJS_DelayData* pData) | 1912 void Document::AddDelayData(CJS_DelayData* pData) |
1917 { | 1913 { |
1918 m_DelayData.Add(pData); | 1914 m_DelayData.Add(pData); |
1919 } | 1915 } |
1920 | 1916 |
(...skipping 28 matching lines...) Expand all Loading... |
1949 | 1945 |
1950 void Document::DoAnnotDelay() | 1946 void Document::DoAnnotDelay() |
1951 { | 1947 { |
1952 CFX_DWordArray DelArray; | 1948 CFX_DWordArray DelArray; |
1953 | 1949 |
1954 for (int j=DelArray.GetSize()-1; j>=0; j--) | 1950 for (int j=DelArray.GetSize()-1; j>=0; j--) |
1955 { | 1951 { |
1956 m_DelayData.RemoveAt(DelArray[j]); | 1952 m_DelayData.RemoveAt(DelArray[j]); |
1957 } | 1953 } |
1958 } | 1954 } |
OLD | NEW |