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 = | 804 CPDF_Dictionary* pDictionary = |
805 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); | 805 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); |
806 if (!pDictionary) | 806 if (!pDictionary) |
807 return FALSE; | 807 return FALSE; |
808 | 808 |
809 if (vp.IsGetting()) { | 809 if (vp.IsGetting()) { |
810 vp << pDictionary->GetUnicodeText("Author"); | 810 vp << pDictionary->GetUnicodeText("Author"); |
811 return TRUE; | 811 return TRUE; |
812 } else { | 812 } else { |
813 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) | 813 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) |
814 return FALSE; | 814 return FALSE; |
815 | 815 |
816 CFX_WideString csAuthor; | 816 CFX_WideString csAuthor; |
817 vp >> csAuthor; | 817 vp >> csAuthor; |
818 pDictionary->SetAtString("Author", PDF_EncodeText(csAuthor)); | 818 pDictionary->SetAtString("Author", PDF_EncodeText(csAuthor)); |
819 m_pDocument->SetChangeMark(); | 819 m_pDocument->SetChangeMark(); |
820 return TRUE; | 820 return TRUE; |
821 } | 821 } |
822 } | 822 } |
823 | 823 |
824 FX_BOOL Document::info(IFXJS_Context* cc, | 824 FX_BOOL Document::info(IJS_Context* cc, |
825 CJS_PropValue& vp, | 825 CJS_PropValue& vp, |
826 CFX_WideString& sError) { | 826 CFX_WideString& sError) { |
827 ASSERT(m_pDocument != NULL); | 827 ASSERT(m_pDocument != NULL); |
828 | 828 |
829 CPDF_Dictionary* pDictionary = | 829 CPDF_Dictionary* pDictionary = |
830 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); | 830 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); |
831 if (!pDictionary) | 831 if (!pDictionary) |
832 return FALSE; | 832 return FALSE; |
833 | 833 |
834 CFX_WideString cwAuthor = pDictionary->GetUnicodeText("Author"); | 834 CFX_WideString cwAuthor = pDictionary->GetUnicodeText("Author"); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 (bool)pValueObj->GetInteger()); | 876 (bool)pValueObj->GetInteger()); |
877 } | 877 } |
878 | 878 |
879 vp << pObj; | 879 vp << pObj; |
880 return TRUE; | 880 return TRUE; |
881 } else { | 881 } else { |
882 return TRUE; | 882 return TRUE; |
883 } | 883 } |
884 } | 884 } |
885 | 885 |
886 FX_BOOL Document::creationDate(IFXJS_Context* cc, | 886 FX_BOOL Document::creationDate(IJS_Context* cc, |
887 CJS_PropValue& vp, | 887 CJS_PropValue& vp, |
888 CFX_WideString& sError) { | 888 CFX_WideString& sError) { |
889 CPDF_Dictionary* pDictionary = | 889 CPDF_Dictionary* pDictionary = |
890 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); | 890 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); |
891 if (!pDictionary) | 891 if (!pDictionary) |
892 return FALSE; | 892 return FALSE; |
893 | 893 |
894 if (vp.IsGetting()) { | 894 if (vp.IsGetting()) { |
895 vp << pDictionary->GetUnicodeText("CreationDate"); | 895 vp << pDictionary->GetUnicodeText("CreationDate"); |
896 } else { | 896 } else { |
897 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) | 897 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) |
898 return FALSE; | 898 return FALSE; |
899 | 899 |
900 CFX_WideString csCreationDate; | 900 CFX_WideString csCreationDate; |
901 vp >> csCreationDate; | 901 vp >> csCreationDate; |
902 pDictionary->SetAtString("CreationDate", PDF_EncodeText(csCreationDate)); | 902 pDictionary->SetAtString("CreationDate", PDF_EncodeText(csCreationDate)); |
903 m_pDocument->SetChangeMark(); | 903 m_pDocument->SetChangeMark(); |
904 } | 904 } |
905 return TRUE; | 905 return TRUE; |
906 } | 906 } |
907 | 907 |
908 FX_BOOL Document::creator(IFXJS_Context* cc, | 908 FX_BOOL Document::creator(IJS_Context* cc, |
909 CJS_PropValue& vp, | 909 CJS_PropValue& vp, |
910 CFX_WideString& sError) { | 910 CFX_WideString& sError) { |
911 CPDF_Dictionary* pDictionary = | 911 CPDF_Dictionary* pDictionary = |
912 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); | 912 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); |
913 if (!pDictionary) | 913 if (!pDictionary) |
914 return FALSE; | 914 return FALSE; |
915 | 915 |
916 if (vp.IsGetting()) { | 916 if (vp.IsGetting()) { |
917 vp << pDictionary->GetUnicodeText("Creator"); | 917 vp << pDictionary->GetUnicodeText("Creator"); |
918 } else { | 918 } else { |
919 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) | 919 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) |
920 return FALSE; | 920 return FALSE; |
921 | 921 |
922 CFX_WideString csCreator; | 922 CFX_WideString csCreator; |
923 vp >> csCreator; | 923 vp >> csCreator; |
924 pDictionary->SetAtString("Creator", PDF_EncodeText(csCreator)); | 924 pDictionary->SetAtString("Creator", PDF_EncodeText(csCreator)); |
925 m_pDocument->SetChangeMark(); | 925 m_pDocument->SetChangeMark(); |
926 } | 926 } |
927 return TRUE; | 927 return TRUE; |
928 } | 928 } |
929 | 929 |
930 FX_BOOL Document::delay(IFXJS_Context* cc, | 930 FX_BOOL Document::delay(IJS_Context* cc, |
931 CJS_PropValue& vp, | 931 CJS_PropValue& vp, |
932 CFX_WideString& sError) { | 932 CFX_WideString& sError) { |
933 if (vp.IsGetting()) { | 933 if (vp.IsGetting()) { |
934 vp << m_bDelay; | 934 vp << m_bDelay; |
935 } else { | 935 } else { |
936 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) | 936 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) |
937 return FALSE; | 937 return FALSE; |
938 | 938 |
939 vp >> m_bDelay; | 939 vp >> m_bDelay; |
940 if (m_bDelay) { | 940 if (m_bDelay) { |
941 for (int i = 0, sz = m_DelayData.GetSize(); i < sz; i++) | 941 for (int i = 0, sz = m_DelayData.GetSize(); i < sz; i++) |
942 delete m_DelayData.GetAt(i); | 942 delete m_DelayData.GetAt(i); |
943 | 943 |
944 m_DelayData.RemoveAll(); | 944 m_DelayData.RemoveAll(); |
945 } else { | 945 } else { |
946 for (int i = 0, sz = m_DelayData.GetSize(); i < sz; i++) { | 946 for (int i = 0, sz = m_DelayData.GetSize(); i < sz; i++) { |
947 if (CJS_DelayData* pData = m_DelayData.GetAt(i)) { | 947 if (CJS_DelayData* pData = m_DelayData.GetAt(i)) { |
948 Field::DoDelay(m_pDocument, pData); | 948 Field::DoDelay(m_pDocument, pData); |
949 delete m_DelayData.GetAt(i); | 949 delete m_DelayData.GetAt(i); |
950 } | 950 } |
951 } | 951 } |
952 m_DelayData.RemoveAll(); | 952 m_DelayData.RemoveAll(); |
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 = | 961 CPDF_Dictionary* pDictionary = |
962 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); | 962 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); |
963 if (!pDictionary) | 963 if (!pDictionary) |
964 return FALSE; | 964 return FALSE; |
965 | 965 |
966 if (vp.IsGetting()) { | 966 if (vp.IsGetting()) { |
967 vp << pDictionary->GetUnicodeText("Keywords"); | 967 vp << pDictionary->GetUnicodeText("Keywords"); |
968 } else { | 968 } else { |
969 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) | 969 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) |
970 return FALSE; | 970 return FALSE; |
971 | 971 |
972 CFX_WideString csKeywords; | 972 CFX_WideString csKeywords; |
973 vp >> csKeywords; | 973 vp >> csKeywords; |
974 pDictionary->SetAtString("Keywords", PDF_EncodeText(csKeywords)); | 974 pDictionary->SetAtString("Keywords", PDF_EncodeText(csKeywords)); |
975 m_pDocument->SetChangeMark(); | 975 m_pDocument->SetChangeMark(); |
976 } | 976 } |
977 return TRUE; | 977 return TRUE; |
978 } | 978 } |
979 | 979 |
980 FX_BOOL Document::modDate(IFXJS_Context* cc, | 980 FX_BOOL Document::modDate(IJS_Context* cc, |
981 CJS_PropValue& vp, | 981 CJS_PropValue& vp, |
982 CFX_WideString& sError) { | 982 CFX_WideString& sError) { |
983 CPDF_Dictionary* pDictionary = | 983 CPDF_Dictionary* pDictionary = |
984 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); | 984 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); |
985 if (!pDictionary) | 985 if (!pDictionary) |
986 return FALSE; | 986 return FALSE; |
987 | 987 |
988 if (vp.IsGetting()) { | 988 if (vp.IsGetting()) { |
989 vp << pDictionary->GetUnicodeText("ModDate"); | 989 vp << pDictionary->GetUnicodeText("ModDate"); |
990 } else { | 990 } else { |
991 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) | 991 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) |
992 return FALSE; | 992 return FALSE; |
993 | 993 |
994 CFX_WideString csmodDate; | 994 CFX_WideString csmodDate; |
995 vp >> csmodDate; | 995 vp >> csmodDate; |
996 pDictionary->SetAtString("ModDate", PDF_EncodeText(csmodDate)); | 996 pDictionary->SetAtString("ModDate", PDF_EncodeText(csmodDate)); |
997 m_pDocument->SetChangeMark(); | 997 m_pDocument->SetChangeMark(); |
998 } | 998 } |
999 return TRUE; | 999 return TRUE; |
1000 } | 1000 } |
1001 | 1001 |
1002 FX_BOOL Document::producer(IFXJS_Context* cc, | 1002 FX_BOOL Document::producer(IJS_Context* cc, |
1003 CJS_PropValue& vp, | 1003 CJS_PropValue& vp, |
1004 CFX_WideString& sError) { | 1004 CFX_WideString& sError) { |
1005 CPDF_Dictionary* pDictionary = | 1005 CPDF_Dictionary* pDictionary = |
1006 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); | 1006 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); |
1007 if (!pDictionary) | 1007 if (!pDictionary) |
1008 return FALSE; | 1008 return FALSE; |
1009 | 1009 |
1010 if (vp.IsGetting()) { | 1010 if (vp.IsGetting()) { |
1011 vp << pDictionary->GetUnicodeText("Producer"); | 1011 vp << pDictionary->GetUnicodeText("Producer"); |
1012 } else { | 1012 } else { |
1013 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) | 1013 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) |
1014 return FALSE; | 1014 return FALSE; |
1015 | 1015 |
1016 CFX_WideString csproducer; | 1016 CFX_WideString csproducer; |
1017 vp >> csproducer; | 1017 vp >> csproducer; |
1018 pDictionary->SetAtString("Producer", PDF_EncodeText(csproducer)); | 1018 pDictionary->SetAtString("Producer", PDF_EncodeText(csproducer)); |
1019 m_pDocument->SetChangeMark(); | 1019 m_pDocument->SetChangeMark(); |
1020 } | 1020 } |
1021 return TRUE; | 1021 return TRUE; |
1022 } | 1022 } |
1023 | 1023 |
1024 FX_BOOL Document::subject(IFXJS_Context* cc, | 1024 FX_BOOL Document::subject(IJS_Context* cc, |
1025 CJS_PropValue& vp, | 1025 CJS_PropValue& vp, |
1026 CFX_WideString& sError) { | 1026 CFX_WideString& sError) { |
1027 CPDF_Dictionary* pDictionary = | 1027 CPDF_Dictionary* pDictionary = |
1028 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); | 1028 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); |
1029 if (!pDictionary) | 1029 if (!pDictionary) |
1030 return FALSE; | 1030 return FALSE; |
1031 | 1031 |
1032 if (vp.IsGetting()) { | 1032 if (vp.IsGetting()) { |
1033 vp << pDictionary->GetUnicodeText("Subject"); | 1033 vp << pDictionary->GetUnicodeText("Subject"); |
1034 } else { | 1034 } else { |
1035 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) | 1035 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) |
1036 return FALSE; | 1036 return FALSE; |
1037 | 1037 |
1038 CFX_WideString cssubject; | 1038 CFX_WideString cssubject; |
1039 vp >> cssubject; | 1039 vp >> cssubject; |
1040 pDictionary->SetAtString("Subject", PDF_EncodeText(cssubject)); | 1040 pDictionary->SetAtString("Subject", PDF_EncodeText(cssubject)); |
1041 m_pDocument->SetChangeMark(); | 1041 m_pDocument->SetChangeMark(); |
1042 } | 1042 } |
1043 return TRUE; | 1043 return TRUE; |
1044 } | 1044 } |
1045 | 1045 |
1046 FX_BOOL Document::title(IFXJS_Context* cc, | 1046 FX_BOOL Document::title(IJS_Context* cc, |
1047 CJS_PropValue& vp, | 1047 CJS_PropValue& vp, |
1048 CFX_WideString& sError) { | 1048 CFX_WideString& sError) { |
1049 if (m_pDocument == NULL || m_pDocument->GetDocument() == NULL) | 1049 if (m_pDocument == NULL || m_pDocument->GetDocument() == NULL) |
1050 return FALSE; | 1050 return FALSE; |
1051 | 1051 |
1052 CPDF_Dictionary* pDictionary = | 1052 CPDF_Dictionary* pDictionary = |
1053 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); | 1053 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); |
1054 if (!pDictionary) | 1054 if (!pDictionary) |
1055 return FALSE; | 1055 return FALSE; |
1056 | 1056 |
1057 if (vp.IsGetting()) { | 1057 if (vp.IsGetting()) { |
1058 vp << pDictionary->GetUnicodeText("Title"); | 1058 vp << pDictionary->GetUnicodeText("Title"); |
1059 } else { | 1059 } else { |
1060 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) | 1060 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) |
1061 return FALSE; | 1061 return FALSE; |
1062 | 1062 |
1063 CFX_WideString cstitle; | 1063 CFX_WideString cstitle; |
1064 vp >> cstitle; | 1064 vp >> cstitle; |
1065 pDictionary->SetAtString("Title", PDF_EncodeText(cstitle)); | 1065 pDictionary->SetAtString("Title", PDF_EncodeText(cstitle)); |
1066 m_pDocument->SetChangeMark(); | 1066 m_pDocument->SetChangeMark(); |
1067 } | 1067 } |
1068 return TRUE; | 1068 return TRUE; |
1069 } | 1069 } |
1070 | 1070 |
1071 FX_BOOL Document::numPages(IFXJS_Context* cc, | 1071 FX_BOOL Document::numPages(IJS_Context* cc, |
1072 CJS_PropValue& vp, | 1072 CJS_PropValue& vp, |
1073 CFX_WideString& sError) { | 1073 CFX_WideString& sError) { |
1074 if (vp.IsSetting()) { | 1074 if (vp.IsSetting()) { |
1075 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 1075 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
1076 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); | 1076 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); |
1077 return FALSE; | 1077 return FALSE; |
1078 } | 1078 } |
1079 vp << m_pDocument->GetPageCount(); | 1079 vp << m_pDocument->GetPageCount(); |
1080 return TRUE; | 1080 return TRUE; |
1081 } | 1081 } |
1082 | 1082 |
1083 FX_BOOL Document::external(IFXJS_Context* cc, | 1083 FX_BOOL Document::external(IJS_Context* cc, |
1084 CJS_PropValue& vp, | 1084 CJS_PropValue& vp, |
1085 CFX_WideString& sError) { | 1085 CFX_WideString& sError) { |
1086 // In Chrome case,should always return true. | 1086 // In Chrome case,should always return true. |
1087 if (vp.IsGetting()) { | 1087 if (vp.IsGetting()) { |
1088 vp << true; | 1088 vp << true; |
1089 } | 1089 } |
1090 return TRUE; | 1090 return TRUE; |
1091 } | 1091 } |
1092 | 1092 |
1093 FX_BOOL Document::filesize(IFXJS_Context* cc, | 1093 FX_BOOL Document::filesize(IJS_Context* cc, |
1094 CJS_PropValue& vp, | 1094 CJS_PropValue& vp, |
1095 CFX_WideString& sError) { | 1095 CFX_WideString& sError) { |
1096 if (vp.IsSetting()) { | 1096 if (vp.IsSetting()) { |
1097 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 1097 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
1098 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); | 1098 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); |
1099 return FALSE; | 1099 return FALSE; |
1100 } | 1100 } |
1101 vp << 0; | 1101 vp << 0; |
1102 return TRUE; | 1102 return TRUE; |
1103 } | 1103 } |
1104 | 1104 |
1105 FX_BOOL Document::mouseX(IFXJS_Context* cc, | 1105 FX_BOOL Document::mouseX(IJS_Context* cc, |
1106 CJS_PropValue& vp, | 1106 CJS_PropValue& vp, |
1107 CFX_WideString& sError) { | 1107 CFX_WideString& sError) { |
1108 return TRUE; | 1108 return TRUE; |
1109 } | 1109 } |
1110 | 1110 |
1111 FX_BOOL Document::mouseY(IFXJS_Context* cc, | 1111 FX_BOOL Document::mouseY(IJS_Context* cc, |
1112 CJS_PropValue& vp, | 1112 CJS_PropValue& vp, |
1113 CFX_WideString& sError) { | 1113 CFX_WideString& sError) { |
1114 return TRUE; | 1114 return TRUE; |
1115 } | 1115 } |
1116 | 1116 |
1117 FX_BOOL Document::baseURL(IFXJS_Context* cc, | 1117 FX_BOOL Document::baseURL(IJS_Context* cc, |
1118 CJS_PropValue& vp, | 1118 CJS_PropValue& vp, |
1119 CFX_WideString& sError) { | 1119 CFX_WideString& sError) { |
1120 if (vp.IsGetting()) { | 1120 if (vp.IsGetting()) { |
1121 vp << m_cwBaseURL; | 1121 vp << m_cwBaseURL; |
1122 } else { | 1122 } else { |
1123 vp >> m_cwBaseURL; | 1123 vp >> m_cwBaseURL; |
1124 } | 1124 } |
1125 return TRUE; | 1125 return TRUE; |
1126 } | 1126 } |
1127 | 1127 |
1128 FX_BOOL Document::calculate(IFXJS_Context* cc, | 1128 FX_BOOL Document::calculate(IJS_Context* cc, |
1129 CJS_PropValue& vp, | 1129 CJS_PropValue& vp, |
1130 CFX_WideString& sError) { | 1130 CFX_WideString& sError) { |
1131 ASSERT(m_pDocument != NULL); | 1131 ASSERT(m_pDocument != NULL); |
1132 | 1132 |
1133 CPDFSDK_InterForm* pInterForm = | 1133 CPDFSDK_InterForm* pInterForm = |
1134 (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); | 1134 (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); |
1135 ASSERT(pInterForm != NULL); | 1135 ASSERT(pInterForm != NULL); |
1136 | 1136 |
1137 if (vp.IsGetting()) { | 1137 if (vp.IsGetting()) { |
1138 if (pInterForm->IsCalculateEnabled()) | 1138 if (pInterForm->IsCalculateEnabled()) |
1139 vp << true; | 1139 vp << true; |
1140 else | 1140 else |
1141 vp << false; | 1141 vp << false; |
1142 } else { | 1142 } else { |
1143 bool bCalculate; | 1143 bool bCalculate; |
1144 vp >> bCalculate; | 1144 vp >> bCalculate; |
1145 | 1145 |
1146 pInterForm->EnableCalculate(bCalculate); | 1146 pInterForm->EnableCalculate(bCalculate); |
1147 } | 1147 } |
1148 | 1148 |
1149 return TRUE; | 1149 return TRUE; |
1150 } | 1150 } |
1151 | 1151 |
1152 FX_BOOL Document::documentFileName(IFXJS_Context* cc, | 1152 FX_BOOL Document::documentFileName(IJS_Context* cc, |
1153 CJS_PropValue& vp, | 1153 CJS_PropValue& vp, |
1154 CFX_WideString& sError) { | 1154 CFX_WideString& sError) { |
1155 if (vp.IsSetting()) { | 1155 if (vp.IsSetting()) { |
1156 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 1156 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
1157 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); | 1157 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); |
1158 return FALSE; | 1158 return FALSE; |
1159 } | 1159 } |
1160 CFX_WideString wsFilePath = m_pDocument->GetPath(); | 1160 CFX_WideString wsFilePath = m_pDocument->GetPath(); |
1161 int32_t i = wsFilePath.GetLength() - 1; | 1161 int32_t i = wsFilePath.GetLength() - 1; |
1162 for (; i >= 0; i--) { | 1162 for (; i >= 0; i--) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 } | 1206 } |
1207 pResult[iLength] = L'\0'; | 1207 pResult[iLength] = L'\0'; |
1208 | 1208 |
1209 cbFrom.ReleaseBuffer(); | 1209 cbFrom.ReleaseBuffer(); |
1210 CFX_WideString cbRet = CFX_WideString(pResult); | 1210 CFX_WideString cbRet = CFX_WideString(pResult); |
1211 free(pResult); | 1211 free(pResult); |
1212 pResult = NULL; | 1212 pResult = NULL; |
1213 return cbRet; | 1213 return cbRet; |
1214 } | 1214 } |
1215 | 1215 |
1216 FX_BOOL Document::path(IFXJS_Context* cc, | 1216 FX_BOOL Document::path(IJS_Context* cc, |
1217 CJS_PropValue& vp, | 1217 CJS_PropValue& vp, |
1218 CFX_WideString& sError) { | 1218 CFX_WideString& sError) { |
1219 if (vp.IsSetting()) { | 1219 if (vp.IsSetting()) { |
1220 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 1220 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
1221 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); | 1221 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); |
1222 return FALSE; | 1222 return FALSE; |
1223 } | 1223 } |
1224 vp << app::SysPathToPDFPath(m_pDocument->GetPath()); | 1224 vp << app::SysPathToPDFPath(m_pDocument->GetPath()); |
1225 return TRUE; | 1225 return TRUE; |
1226 } | 1226 } |
1227 | 1227 |
1228 FX_BOOL Document::pageWindowRect(IFXJS_Context* cc, | 1228 FX_BOOL Document::pageWindowRect(IJS_Context* cc, |
1229 CJS_PropValue& vp, | 1229 CJS_PropValue& vp, |
1230 CFX_WideString& sError) { | 1230 CFX_WideString& sError) { |
1231 return TRUE; | 1231 return TRUE; |
1232 } | 1232 } |
1233 | 1233 |
1234 FX_BOOL Document::layout(IFXJS_Context* cc, | 1234 FX_BOOL Document::layout(IJS_Context* cc, |
1235 CJS_PropValue& vp, | 1235 CJS_PropValue& vp, |
1236 CFX_WideString& sError) { | 1236 CFX_WideString& sError) { |
1237 return TRUE; | 1237 return TRUE; |
1238 } | 1238 } |
1239 | 1239 |
1240 FX_BOOL Document::addLink(IFXJS_Context* cc, | 1240 FX_BOOL Document::addLink(IJS_Context* cc, |
1241 const CJS_Parameters& params, | 1241 const CJS_Parameters& params, |
1242 CJS_Value& vRet, | 1242 CJS_Value& vRet, |
1243 CFX_WideString& sError) { | 1243 CFX_WideString& sError) { |
1244 return TRUE; | 1244 return TRUE; |
1245 } | 1245 } |
1246 | 1246 |
1247 FX_BOOL Document::closeDoc(IFXJS_Context* cc, | 1247 FX_BOOL Document::closeDoc(IJS_Context* cc, |
1248 const CJS_Parameters& params, | 1248 const CJS_Parameters& params, |
1249 CJS_Value& vRet, | 1249 CJS_Value& vRet, |
1250 CFX_WideString& sError) { | 1250 CFX_WideString& sError) { |
1251 ASSERT(m_pDocument != NULL); | 1251 ASSERT(m_pDocument != NULL); |
1252 return TRUE; | 1252 return TRUE; |
1253 } | 1253 } |
1254 | 1254 |
1255 FX_BOOL Document::getPageBox(IFXJS_Context* cc, | 1255 FX_BOOL Document::getPageBox(IJS_Context* cc, |
1256 const CJS_Parameters& params, | 1256 const CJS_Parameters& params, |
1257 CJS_Value& vRet, | 1257 CJS_Value& vRet, |
1258 CFX_WideString& sError) { | 1258 CFX_WideString& sError) { |
1259 return TRUE; | 1259 return TRUE; |
1260 } | 1260 } |
1261 | 1261 |
1262 FX_BOOL Document::getAnnot(IFXJS_Context* cc, | 1262 FX_BOOL Document::getAnnot(IJS_Context* cc, |
1263 const CJS_Parameters& params, | 1263 const CJS_Parameters& params, |
1264 CJS_Value& vRet, | 1264 CJS_Value& vRet, |
1265 CFX_WideString& sError) { | 1265 CFX_WideString& sError) { |
1266 return TRUE; | 1266 return TRUE; |
1267 } | 1267 } |
1268 | 1268 |
1269 FX_BOOL Document::getAnnots(IFXJS_Context* cc, | 1269 FX_BOOL Document::getAnnots(IJS_Context* cc, |
1270 const CJS_Parameters& params, | 1270 const CJS_Parameters& params, |
1271 CJS_Value& vRet, | 1271 CJS_Value& vRet, |
1272 CFX_WideString& sError) { | 1272 CFX_WideString& sError) { |
1273 vRet.SetNull(); | 1273 vRet.SetNull(); |
1274 return TRUE; | 1274 return TRUE; |
1275 } | 1275 } |
1276 | 1276 |
1277 FX_BOOL Document::getAnnot3D(IFXJS_Context* cc, | 1277 FX_BOOL Document::getAnnot3D(IJS_Context* cc, |
1278 const CJS_Parameters& params, | 1278 const CJS_Parameters& params, |
1279 CJS_Value& vRet, | 1279 CJS_Value& vRet, |
1280 CFX_WideString& sError) { | 1280 CFX_WideString& sError) { |
1281 vRet.SetNull(); | 1281 vRet.SetNull(); |
1282 return TRUE; | 1282 return TRUE; |
1283 } | 1283 } |
1284 | 1284 |
1285 FX_BOOL Document::getAnnots3D(IFXJS_Context* cc, | 1285 FX_BOOL Document::getAnnots3D(IJS_Context* cc, |
1286 const CJS_Parameters& params, | 1286 const CJS_Parameters& params, |
1287 CJS_Value& vRet, | 1287 CJS_Value& vRet, |
1288 CFX_WideString& sError) { | 1288 CFX_WideString& sError) { |
1289 vRet = CJS_Value::VT_undefined; | 1289 vRet = CJS_Value::VT_undefined; |
1290 return TRUE; | 1290 return TRUE; |
1291 } | 1291 } |
1292 | 1292 |
1293 FX_BOOL Document::getOCGs(IFXJS_Context* cc, | 1293 FX_BOOL Document::getOCGs(IJS_Context* cc, |
1294 const CJS_Parameters& params, | 1294 const CJS_Parameters& params, |
1295 CJS_Value& vRet, | 1295 CJS_Value& vRet, |
1296 CFX_WideString& sError) { | 1296 CFX_WideString& sError) { |
1297 return TRUE; | 1297 return TRUE; |
1298 } | 1298 } |
1299 | 1299 |
1300 FX_BOOL Document::getLinks(IFXJS_Context* cc, | 1300 FX_BOOL Document::getLinks(IJS_Context* cc, |
1301 const CJS_Parameters& params, | 1301 const CJS_Parameters& params, |
1302 CJS_Value& vRet, | 1302 CJS_Value& vRet, |
1303 CFX_WideString& sError) { | 1303 CFX_WideString& sError) { |
1304 return TRUE; | 1304 return TRUE; |
1305 } | 1305 } |
1306 | 1306 |
1307 bool Document::IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect) { | 1307 bool Document::IsEnclosedInRect(CFX_FloatRect rect, CFX_FloatRect LinkRect) { |
1308 return (rect.left <= LinkRect.left && rect.top <= LinkRect.top && | 1308 return (rect.left <= LinkRect.left && rect.top <= LinkRect.top && |
1309 rect.right >= LinkRect.right && rect.bottom >= LinkRect.bottom); | 1309 rect.right >= LinkRect.right && rect.bottom >= LinkRect.bottom); |
1310 } | 1310 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1381 pElement = NULL; | 1381 pElement = NULL; |
1382 } | 1382 } |
1383 | 1383 |
1384 continue; | 1384 continue; |
1385 } | 1385 } |
1386 | 1386 |
1387 pTemp = pTemp->NextIcon; | 1387 pTemp = pTemp->NextIcon; |
1388 } | 1388 } |
1389 } | 1389 } |
1390 | 1390 |
1391 FX_BOOL Document::addIcon(IFXJS_Context* cc, | 1391 FX_BOOL Document::addIcon(IJS_Context* cc, |
1392 const CJS_Parameters& params, | 1392 const CJS_Parameters& params, |
1393 CJS_Value& vRet, | 1393 CJS_Value& vRet, |
1394 CFX_WideString& sError) { | 1394 CFX_WideString& sError) { |
1395 CJS_Context* pContext = (CJS_Context*)cc; | 1395 CJS_Context* pContext = (CJS_Context*)cc; |
1396 if (params.size() != 2) { | 1396 if (params.size() != 2) { |
1397 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); | 1397 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); |
1398 return FALSE; | 1398 return FALSE; |
1399 } | 1399 } |
1400 CFX_WideString swIconName = params[0].ToCFXWideString(); | 1400 CFX_WideString swIconName = params[0].ToCFXWideString(); |
1401 | 1401 |
(...skipping 19 matching lines...) Expand all Loading... |
1421 m_pIconTree = new IconTree(); | 1421 m_pIconTree = new IconTree(); |
1422 | 1422 |
1423 IconElement* pNewIcon = new IconElement(); | 1423 IconElement* pNewIcon = new IconElement(); |
1424 pNewIcon->IconName = swIconName; | 1424 pNewIcon->IconName = swIconName; |
1425 pNewIcon->NextIcon = NULL; | 1425 pNewIcon->NextIcon = NULL; |
1426 pNewIcon->IconStream = pIcon; | 1426 pNewIcon->IconStream = pIcon; |
1427 m_pIconTree->InsertIconElement(pNewIcon); | 1427 m_pIconTree->InsertIconElement(pNewIcon); |
1428 return TRUE; | 1428 return TRUE; |
1429 } | 1429 } |
1430 | 1430 |
1431 FX_BOOL Document::icons(IFXJS_Context* cc, | 1431 FX_BOOL Document::icons(IJS_Context* cc, |
1432 CJS_PropValue& vp, | 1432 CJS_PropValue& vp, |
1433 CFX_WideString& sError) { | 1433 CFX_WideString& sError) { |
1434 if (vp.IsSetting()) { | 1434 if (vp.IsSetting()) { |
1435 CJS_Context* pContext = static_cast<CJS_Context*>(cc); | 1435 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
1436 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); | 1436 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); |
1437 return FALSE; | 1437 return FALSE; |
1438 } | 1438 } |
1439 | 1439 |
1440 if (!m_pIconTree) { | 1440 if (!m_pIconTree) { |
1441 vp.SetNull(); | 1441 vp.SetNull(); |
(...skipping 25 matching lines...) Expand all Loading... |
1467 | 1467 |
1468 pIcon->SetStream(pIconElement->IconStream->GetStream()); | 1468 pIcon->SetStream(pIconElement->IconStream->GetStream()); |
1469 pIcon->SetIconName(pIconElement->IconName); | 1469 pIcon->SetIconName(pIconElement->IconName); |
1470 Icons.SetElement(i, CJS_Value(m_isolate, pJS_Icon)); | 1470 Icons.SetElement(i, CJS_Value(m_isolate, pJS_Icon)); |
1471 } | 1471 } |
1472 | 1472 |
1473 vp << Icons; | 1473 vp << Icons; |
1474 return TRUE; | 1474 return TRUE; |
1475 } | 1475 } |
1476 | 1476 |
1477 FX_BOOL Document::getIcon(IFXJS_Context* cc, | 1477 FX_BOOL Document::getIcon(IJS_Context* cc, |
1478 const CJS_Parameters& params, | 1478 const CJS_Parameters& params, |
1479 CJS_Value& vRet, | 1479 CJS_Value& vRet, |
1480 CFX_WideString& sError) { | 1480 CFX_WideString& sError) { |
1481 CJS_Context* pContext = (CJS_Context*)cc; | 1481 CJS_Context* pContext = (CJS_Context*)cc; |
1482 if (params.size() != 1) { | 1482 if (params.size() != 1) { |
1483 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); | 1483 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); |
1484 return FALSE; | 1484 return FALSE; |
1485 } | 1485 } |
1486 | 1486 |
1487 if (!m_pIconTree) | 1487 if (!m_pIconTree) |
(...skipping 23 matching lines...) Expand all Loading... |
1511 pIcon->SetIconName(swIconName); | 1511 pIcon->SetIconName(swIconName); |
1512 pIcon->SetStream(pRetIcon->GetStream()); | 1512 pIcon->SetStream(pRetIcon->GetStream()); |
1513 vRet = pJS_Icon; | 1513 vRet = pJS_Icon; |
1514 return TRUE; | 1514 return TRUE; |
1515 } | 1515 } |
1516 } | 1516 } |
1517 | 1517 |
1518 return FALSE; | 1518 return FALSE; |
1519 } | 1519 } |
1520 | 1520 |
1521 FX_BOOL Document::removeIcon(IFXJS_Context* cc, | 1521 FX_BOOL Document::removeIcon(IJS_Context* cc, |
1522 const CJS_Parameters& params, | 1522 const CJS_Parameters& params, |
1523 CJS_Value& vRet, | 1523 CJS_Value& vRet, |
1524 CFX_WideString& sError) { | 1524 CFX_WideString& sError) { |
1525 CJS_Context* pContext = (CJS_Context*)cc; | 1525 CJS_Context* pContext = (CJS_Context*)cc; |
1526 if (params.size() != 1) { | 1526 if (params.size() != 1) { |
1527 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); | 1527 sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR); |
1528 return FALSE; | 1528 return FALSE; |
1529 } | 1529 } |
1530 | 1530 |
1531 if (!m_pIconTree) | 1531 if (!m_pIconTree) |
1532 return FALSE; | 1532 return FALSE; |
1533 CFX_WideString swIconName = params[0].ToCFXWideString(); | 1533 CFX_WideString swIconName = params[0].ToCFXWideString(); |
1534 return TRUE; | 1534 return TRUE; |
1535 } | 1535 } |
1536 | 1536 |
1537 FX_BOOL Document::createDataObject(IFXJS_Context* cc, | 1537 FX_BOOL Document::createDataObject(IJS_Context* cc, |
1538 const CJS_Parameters& params, | 1538 const CJS_Parameters& params, |
1539 CJS_Value& vRet, | 1539 CJS_Value& vRet, |
1540 CFX_WideString& sError) { | 1540 CFX_WideString& sError) { |
1541 // Unsafe, not implemented. | 1541 // Unsafe, not implemented. |
1542 return TRUE; | 1542 return TRUE; |
1543 } | 1543 } |
1544 | 1544 |
1545 FX_BOOL Document::media(IFXJS_Context* cc, | 1545 FX_BOOL Document::media(IJS_Context* cc, |
1546 CJS_PropValue& vp, | 1546 CJS_PropValue& vp, |
1547 CFX_WideString& sError) { | 1547 CFX_WideString& sError) { |
1548 return TRUE; | 1548 return TRUE; |
1549 } | 1549 } |
1550 | 1550 |
1551 FX_BOOL Document::calculateNow(IFXJS_Context* cc, | 1551 FX_BOOL Document::calculateNow(IJS_Context* cc, |
1552 const CJS_Parameters& params, | 1552 const CJS_Parameters& params, |
1553 CJS_Value& vRet, | 1553 CJS_Value& vRet, |
1554 CFX_WideString& sError) { | 1554 CFX_WideString& sError) { |
1555 ASSERT(m_pDocument != NULL); | 1555 ASSERT(m_pDocument != NULL); |
1556 | 1556 |
1557 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || | 1557 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || |
1558 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || | 1558 m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) || |
1559 m_pDocument->GetPermissions(FPDFPERM_FILL_FORM))) | 1559 m_pDocument->GetPermissions(FPDFPERM_FILL_FORM))) |
1560 return FALSE; | 1560 return FALSE; |
1561 | 1561 |
1562 CPDFSDK_InterForm* pInterForm = | 1562 CPDFSDK_InterForm* pInterForm = |
1563 (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); | 1563 (CPDFSDK_InterForm*)m_pDocument->GetInterForm(); |
1564 ASSERT(pInterForm != NULL); | 1564 ASSERT(pInterForm != NULL); |
1565 pInterForm->OnCalculate(); | 1565 pInterForm->OnCalculate(); |
1566 return TRUE; | 1566 return TRUE; |
1567 } | 1567 } |
1568 | 1568 |
1569 FX_BOOL Document::Collab(IFXJS_Context* cc, | 1569 FX_BOOL Document::Collab(IJS_Context* cc, |
1570 CJS_PropValue& vp, | 1570 CJS_PropValue& vp, |
1571 CFX_WideString& sError) { | 1571 CFX_WideString& sError) { |
1572 return TRUE; | 1572 return TRUE; |
1573 } | 1573 } |
1574 | 1574 |
1575 FX_BOOL Document::getPageNthWord(IFXJS_Context* cc, | 1575 FX_BOOL Document::getPageNthWord(IJS_Context* cc, |
1576 const CJS_Parameters& params, | 1576 const CJS_Parameters& params, |
1577 CJS_Value& vRet, | 1577 CJS_Value& vRet, |
1578 CFX_WideString& sError) { | 1578 CFX_WideString& sError) { |
1579 ASSERT(m_pDocument != NULL); | 1579 ASSERT(m_pDocument != NULL); |
1580 | 1580 |
1581 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) | 1581 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) |
1582 return FALSE; | 1582 return FALSE; |
1583 | 1583 |
1584 int nPageNo = params.GetSize() > 0 ? params[0].ToInt() : 0; | 1584 int nPageNo = params.GetSize() > 0 ? params[0].ToInt() : 0; |
1585 int nWordNo = params.GetSize() > 1 ? params[1].ToInt() : 0; | 1585 int nWordNo = params.GetSize() > 1 ? params[1].ToInt() : 0; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1627 | 1627 |
1628 if (bStrip) { | 1628 if (bStrip) { |
1629 swRet.TrimLeft(); | 1629 swRet.TrimLeft(); |
1630 swRet.TrimRight(); | 1630 swRet.TrimRight(); |
1631 } | 1631 } |
1632 | 1632 |
1633 vRet = swRet.c_str(); | 1633 vRet = swRet.c_str(); |
1634 return TRUE; | 1634 return TRUE; |
1635 } | 1635 } |
1636 | 1636 |
1637 FX_BOOL Document::getPageNthWordQuads(IFXJS_Context* cc, | 1637 FX_BOOL Document::getPageNthWordQuads(IJS_Context* cc, |
1638 const CJS_Parameters& params, | 1638 const CJS_Parameters& params, |
1639 CJS_Value& vRet, | 1639 CJS_Value& vRet, |
1640 CFX_WideString& sError) { | 1640 CFX_WideString& sError) { |
1641 ASSERT(m_pDocument != NULL); | 1641 ASSERT(m_pDocument != NULL); |
1642 | 1642 |
1643 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) | 1643 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) |
1644 return FALSE; | 1644 return FALSE; |
1645 | 1645 |
1646 return FALSE; | 1646 return FALSE; |
1647 } | 1647 } |
1648 | 1648 |
1649 FX_BOOL Document::getPageNumWords(IFXJS_Context* cc, | 1649 FX_BOOL Document::getPageNumWords(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 ASSERT(m_pDocument != NULL); | 1653 ASSERT(m_pDocument != NULL); |
1654 | 1654 |
1655 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) | 1655 if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) |
1656 return FALSE; | 1656 return FALSE; |
1657 | 1657 |
1658 int nPageNo = params.GetSize() > 0 ? params[0].ToInt() : 0; | 1658 int nPageNo = params.GetSize() > 0 ? params[0].ToInt() : 0; |
1659 CPDF_Document* pDocument = m_pDocument->GetDocument()->GetPDFDoc(); | 1659 CPDF_Document* pDocument = m_pDocument->GetDocument()->GetPDFDoc(); |
(...skipping 23 matching lines...) Expand all Loading... |
1683 nWords += CountWords(pTextObj); | 1683 nWords += CountWords(pTextObj); |
1684 } | 1684 } |
1685 } | 1685 } |
1686 } | 1686 } |
1687 | 1687 |
1688 vRet = nWords; | 1688 vRet = nWords; |
1689 | 1689 |
1690 return TRUE; | 1690 return TRUE; |
1691 } | 1691 } |
1692 | 1692 |
1693 FX_BOOL Document::getPrintParams(IFXJS_Context* cc, | 1693 FX_BOOL Document::getPrintParams(IJS_Context* cc, |
1694 const CJS_Parameters& params, | 1694 const CJS_Parameters& params, |
1695 CJS_Value& vRet, | 1695 CJS_Value& vRet, |
1696 CFX_WideString& sError) { | 1696 CFX_WideString& sError) { |
1697 CJS_Context* pContext = (CJS_Context*)cc; | 1697 CJS_Context* pContext = (CJS_Context*)cc; |
1698 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 1698 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
1699 v8::Local<v8::Object> pRetObj = FXJS_NewFxDynamicObj( | 1699 v8::Local<v8::Object> pRetObj = FXJS_NewFxDynamicObj( |
1700 pRuntime->GetIsolate(), pContext, CJS_PrintParamsObj::g_nObjDefnID); | 1700 pRuntime->GetIsolate(), pContext, CJS_PrintParamsObj::g_nObjDefnID); |
1701 | 1701 |
1702 // Not implemented yet. | 1702 // Not implemented yet. |
1703 | 1703 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1772 nWords++; | 1772 nWords++; |
1773 } | 1773 } |
1774 | 1774 |
1775 if (nWords - 1 == nWordIndex) | 1775 if (nWords - 1 == nWordIndex) |
1776 swRet += unicode; | 1776 swRet += unicode; |
1777 } | 1777 } |
1778 | 1778 |
1779 return swRet; | 1779 return swRet; |
1780 } | 1780 } |
1781 | 1781 |
1782 FX_BOOL Document::zoom(IFXJS_Context* cc, | 1782 FX_BOOL Document::zoom(IJS_Context* cc, |
1783 CJS_PropValue& vp, | 1783 CJS_PropValue& vp, |
1784 CFX_WideString& sError) { | 1784 CFX_WideString& sError) { |
1785 return TRUE; | 1785 return TRUE; |
1786 } | 1786 } |
1787 | 1787 |
1788 /** | 1788 /** |
1789 (none, NoVary) | 1789 (none, NoVary) |
1790 (fitP, FitPage) | 1790 (fitP, FitPage) |
1791 (fitW, FitWidth) | 1791 (fitW, FitWidth) |
1792 (fitH, FitHeight) | 1792 (fitH, FitHeight) |
1793 (fitV, FitVisibleWidth) | 1793 (fitV, FitVisibleWidth) |
1794 (pref, Preferred) | 1794 (pref, Preferred) |
1795 (refW, ReflowWidth) | 1795 (refW, ReflowWidth) |
1796 */ | 1796 */ |
1797 | 1797 |
1798 FX_BOOL Document::zoomType(IFXJS_Context* cc, | 1798 FX_BOOL Document::zoomType(IJS_Context* cc, |
1799 CJS_PropValue& vp, | 1799 CJS_PropValue& vp, |
1800 CFX_WideString& sError) { | 1800 CFX_WideString& sError) { |
1801 return TRUE; | 1801 return TRUE; |
1802 } | 1802 } |
1803 | 1803 |
1804 FX_BOOL Document::deletePages(IFXJS_Context* cc, | 1804 FX_BOOL Document::deletePages(IJS_Context* cc, |
1805 const CJS_Parameters& params, | 1805 const CJS_Parameters& params, |
1806 CJS_Value& vRet, | 1806 CJS_Value& vRet, |
1807 CFX_WideString& sError) { | 1807 CFX_WideString& sError) { |
1808 v8::Isolate* isolate = GetIsolate(cc); | 1808 v8::Isolate* isolate = GetIsolate(cc); |
1809 ASSERT(m_pDocument != NULL); | 1809 ASSERT(m_pDocument != NULL); |
1810 | 1810 |
1811 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || | 1811 if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) || |
1812 m_pDocument->GetPermissions(FPDFPERM_ASSEMBLE))) | 1812 m_pDocument->GetPermissions(FPDFPERM_ASSEMBLE))) |
1813 return FALSE; | 1813 return FALSE; |
1814 | 1814 |
(...skipping 30 matching lines...) Expand all Loading... |
1845 nEnd = 0; | 1845 nEnd = 0; |
1846 if (nEnd >= nTotal) | 1846 if (nEnd >= nTotal) |
1847 nEnd = nTotal - 1; | 1847 nEnd = nTotal - 1; |
1848 | 1848 |
1849 if (nEnd < nStart) | 1849 if (nEnd < nStart) |
1850 nEnd = nStart; | 1850 nEnd = nStart; |
1851 | 1851 |
1852 return TRUE; | 1852 return TRUE; |
1853 } | 1853 } |
1854 | 1854 |
1855 FX_BOOL Document::extractPages(IFXJS_Context* cc, | 1855 FX_BOOL Document::extractPages(IJS_Context* cc, |
1856 const CJS_Parameters& params, | 1856 const CJS_Parameters& params, |
1857 CJS_Value& vRet, | 1857 CJS_Value& vRet, |
1858 CFX_WideString& sError) { | 1858 CFX_WideString& sError) { |
1859 // Unsafe, not supported. | 1859 // Unsafe, not supported. |
1860 return TRUE; | 1860 return TRUE; |
1861 } | 1861 } |
1862 | 1862 |
1863 FX_BOOL Document::insertPages(IFXJS_Context* cc, | 1863 FX_BOOL Document::insertPages(IJS_Context* cc, |
1864 const CJS_Parameters& params, | 1864 const CJS_Parameters& params, |
1865 CJS_Value& vRet, | 1865 CJS_Value& vRet, |
1866 CFX_WideString& sError) { | 1866 CFX_WideString& sError) { |
1867 // Unsafe, not supported. | 1867 // Unsafe, not supported. |
1868 return TRUE; | 1868 return TRUE; |
1869 } | 1869 } |
1870 | 1870 |
1871 FX_BOOL Document::replacePages(IFXJS_Context* cc, | 1871 FX_BOOL Document::replacePages(IJS_Context* cc, |
1872 const CJS_Parameters& params, | 1872 const CJS_Parameters& params, |
1873 CJS_Value& vRet, | 1873 CJS_Value& vRet, |
1874 CFX_WideString& sError) { | 1874 CFX_WideString& sError) { |
1875 // Unsafe, not supported. | 1875 // Unsafe, not supported. |
1876 return TRUE; | 1876 return TRUE; |
1877 } | 1877 } |
1878 | 1878 |
1879 FX_BOOL Document::getURL(IFXJS_Context* cc, | 1879 FX_BOOL Document::getURL(IJS_Context* cc, |
1880 const CJS_Parameters& params, | 1880 const CJS_Parameters& params, |
1881 CJS_Value& vRet, | 1881 CJS_Value& vRet, |
1882 CFX_WideString& sError) { | 1882 CFX_WideString& sError) { |
1883 // Unsafe, not supported. | 1883 // Unsafe, not supported. |
1884 return TRUE; | 1884 return TRUE; |
1885 } | 1885 } |
1886 | 1886 |
1887 void Document::AddDelayData(CJS_DelayData* pData) { | 1887 void Document::AddDelayData(CJS_DelayData* pData) { |
1888 m_DelayData.Add(pData); | 1888 m_DelayData.Add(pData); |
1889 } | 1889 } |
(...skipping 27 matching lines...) Expand all Loading... |
1917 CFX_DWordArray DelArray; | 1917 CFX_DWordArray DelArray; |
1918 | 1918 |
1919 for (int j = DelArray.GetSize() - 1; j >= 0; j--) { | 1919 for (int j = DelArray.GetSize() - 1; j >= 0; j--) { |
1920 m_DelayData.RemoveAt(DelArray[j]); | 1920 m_DelayData.RemoveAt(DelArray[j]); |
1921 } | 1921 } |
1922 } | 1922 } |
1923 | 1923 |
1924 CJS_Document* Document::GetCJSDoc() const { | 1924 CJS_Document* Document::GetCJSDoc() const { |
1925 return static_cast<CJS_Document*>(m_pJSObject); | 1925 return static_cast<CJS_Document*>(m_pJSObject); |
1926 } | 1926 } |
OLD | NEW |