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 "xfa/src/foxitlib.h" | 7 #include "xfa/src/foxitlib.h" |
8 #include "xfa/src/fxfa/src/common/xfa_utils.h" | 8 #include "xfa/src/fxfa/src/common/xfa_utils.h" |
9 #include "xfa/src/fxfa/src/common/xfa_object.h" | 9 #include "xfa/src/fxfa/src/common/xfa_object.h" |
10 #include "xfa/src/fxfa/src/common/xfa_document.h" | 10 #include "xfa/src/fxfa/src/common/xfa_document.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 methodName = L"y"; | 57 methodName = L"y"; |
58 break; | 58 break; |
59 } | 59 } |
60 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, methodName); | 60 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, methodName); |
61 return; | 61 return; |
62 } | 62 } |
63 CXFA_Node* pNode = NULL; | 63 CXFA_Node* pNode = NULL; |
64 CFX_WideString wsUnit = FX_WSTRC(L"pt"); | 64 CFX_WideString wsUnit = FX_WSTRC(L"pt"); |
65 int32_t iIndex = 0; | 65 int32_t iIndex = 0; |
66 if (iLength >= 1) { | 66 if (iLength >= 1) { |
67 pNode = (CXFA_Node*)pArguments->GetObject(0); | 67 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
68 } | 68 } |
69 if (iLength >= 2) { | 69 if (iLength >= 2) { |
70 CFX_ByteString bsUnit = pArguments->GetUTF8String(1); | 70 CFX_ByteString bsUnit = pArguments->GetUTF8String(1); |
71 if (!bsUnit.IsEmpty()) { | 71 if (!bsUnit.IsEmpty()) { |
72 wsUnit = CFX_WideString::FromUTF8(bsUnit, bsUnit.GetLength()); | 72 wsUnit = CFX_WideString::FromUTF8(bsUnit, bsUnit.GetLength()); |
73 } | 73 } |
74 } | 74 } |
75 if (iLength >= 3) { | 75 if (iLength >= 3) { |
76 iIndex = pArguments->GetInt32(2); | 76 iIndex = pArguments->GetInt32(2); |
77 } | 77 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } | 169 } |
170 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageSpan( | 170 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageSpan( |
171 CFXJSE_Arguments* pArguments) { | 171 CFXJSE_Arguments* pArguments) { |
172 int32_t iLength = pArguments->GetLength(); | 172 int32_t iLength = pArguments->GetLength(); |
173 if (iLength != 1) { | 173 if (iLength != 1) { |
174 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"pageSpan"); | 174 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"pageSpan"); |
175 return; | 175 return; |
176 } | 176 } |
177 CXFA_Node* pNode = NULL; | 177 CXFA_Node* pNode = NULL; |
178 if (iLength >= 1) { | 178 if (iLength >= 1) { |
179 pNode = (CXFA_Node*)pArguments->GetObject(0); | 179 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
180 } | 180 } |
181 if (!pNode) { | 181 if (!pNode) { |
182 return; | 182 return; |
183 } | 183 } |
184 IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); | 184 IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); |
185 if (!pDocLayout) { | 185 if (!pDocLayout) { |
186 return; | 186 return; |
187 } | 187 } |
188 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 188 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); |
189 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); | 189 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageInBatch( | 433 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageInBatch( |
434 CFXJSE_Arguments* pArguments) { | 434 CFXJSE_Arguments* pArguments) { |
435 int32_t iLength = pArguments->GetLength(); | 435 int32_t iLength = pArguments->GetLength(); |
436 if (iLength != 1) { | 436 if (iLength != 1) { |
437 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 437 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
438 L"absPageInBatch"); | 438 L"absPageInBatch"); |
439 return; | 439 return; |
440 } | 440 } |
441 CXFA_Node* pNode = NULL; | 441 CXFA_Node* pNode = NULL; |
442 if (iLength >= 1) { | 442 if (iLength >= 1) { |
443 pNode = (CXFA_Node*)pArguments->GetObject(0); | 443 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
444 } | 444 } |
445 if (!pNode) { | 445 if (!pNode) { |
446 return; | 446 return; |
447 } | 447 } |
448 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); | 448 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); |
449 if (!pNotify) { | 449 if (!pNotify) { |
450 return; | 450 return; |
451 } | 451 } |
452 IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); | 452 IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); |
453 if (!pDocLayout) { | 453 if (!pDocLayout) { |
(...skipping 13 matching lines...) Expand all Loading... |
467 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetInBatch( | 467 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetInBatch( |
468 CFXJSE_Arguments* pArguments) { | 468 CFXJSE_Arguments* pArguments) { |
469 int32_t iLength = pArguments->GetLength(); | 469 int32_t iLength = pArguments->GetLength(); |
470 if (iLength != 1) { | 470 if (iLength != 1) { |
471 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 471 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
472 L"sheetInBatch"); | 472 L"sheetInBatch"); |
473 return; | 473 return; |
474 } | 474 } |
475 CXFA_Node* pNode = NULL; | 475 CXFA_Node* pNode = NULL; |
476 if (iLength >= 1) { | 476 if (iLength >= 1) { |
477 pNode = (CXFA_Node*)pArguments->GetObject(0); | 477 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
478 } | 478 } |
479 if (!pNode) { | 479 if (!pNode) { |
480 return; | 480 return; |
481 } | 481 } |
482 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); | 482 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); |
483 if (!pNotify) { | 483 if (!pNotify) { |
484 return; | 484 return; |
485 } | 485 } |
486 IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); | 486 IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); |
487 if (!pDocLayout) { | 487 if (!pDocLayout) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 if (bAbsPage) { | 521 if (bAbsPage) { |
522 methodName = L"absPage"; | 522 methodName = L"absPage"; |
523 } else { | 523 } else { |
524 methodName = L"page"; | 524 methodName = L"page"; |
525 } | 525 } |
526 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, methodName); | 526 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, methodName); |
527 return; | 527 return; |
528 } | 528 } |
529 CXFA_Node* pNode = NULL; | 529 CXFA_Node* pNode = NULL; |
530 if (iLength >= 1) { | 530 if (iLength >= 1) { |
531 pNode = (CXFA_Node*)pArguments->GetObject(0); | 531 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
532 } | 532 } |
533 int32_t iPage = 0; | 533 int32_t iPage = 0; |
534 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 534 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); |
535 if (!pNode && hValue) { | 535 if (!pNode && hValue) { |
536 FXJSE_Value_SetInteger(hValue, iPage); | 536 FXJSE_Value_SetInteger(hValue, iPage); |
537 } | 537 } |
538 IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); | 538 IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); |
539 if (!pDocLayout) { | 539 if (!pDocLayout) { |
540 return; | 540 return; |
541 } | 541 } |
542 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); | 542 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); |
543 if (!pLayoutItem) { | 543 if (!pLayoutItem) { |
544 FXJSE_Value_SetInteger(hValue, -1); | 544 FXJSE_Value_SetInteger(hValue, -1); |
545 return; | 545 return; |
546 } | 546 } |
547 iPage = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); | 547 iPage = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); |
548 if (hValue) { | 548 if (hValue) { |
549 FXJSE_Value_SetInteger(hValue, bAbsPage ? iPage : iPage + 1); | 549 FXJSE_Value_SetInteger(hValue, bAbsPage ? iPage : iPage + 1); |
550 } | 550 } |
551 } | 551 } |
OLD | NEW |