| 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/fxfa/parser/xfa_script_layoutpseudomodel.h" | 7 #include "xfa/fxfa/parser/xfa_script_layoutpseudomodel.h" |
| 8 | 8 |
| 9 #include "xfa/fxfa/app/xfa_ffnotify.h" | 9 #include "xfa/fxfa/app/xfa_ffnotify.h" |
| 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" | 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 } | 67 } |
| 68 CXFA_Node* pNode = NULL; | 68 CXFA_Node* pNode = NULL; |
| 69 CFX_WideString wsUnit = FX_WSTRC(L"pt"); | 69 CFX_WideString wsUnit = FX_WSTRC(L"pt"); |
| 70 int32_t iIndex = 0; | 70 int32_t iIndex = 0; |
| 71 if (iLength >= 1) { | 71 if (iLength >= 1) { |
| 72 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); | 72 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
| 73 } | 73 } |
| 74 if (iLength >= 2) { | 74 if (iLength >= 2) { |
| 75 CFX_ByteString bsUnit = pArguments->GetUTF8String(1); | 75 CFX_ByteString bsUnit = pArguments->GetUTF8String(1); |
| 76 if (!bsUnit.IsEmpty()) { | 76 if (!bsUnit.IsEmpty()) { |
| 77 wsUnit = CFX_WideString::FromUTF8(bsUnit, bsUnit.GetLength()); | 77 wsUnit = CFX_WideString::FromUTF8(bsUnit.AsByteStringC()); |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 if (iLength >= 3) { | 80 if (iLength >= 3) { |
| 81 iIndex = pArguments->GetInt32(2); | 81 iIndex = pArguments->GetInt32(2); |
| 82 } | 82 } |
| 83 if (!pNode) { | 83 if (!pNode) { |
| 84 return; | 84 return; |
| 85 } | 85 } |
| 86 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); | 86 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); |
| 87 if (!pDocLayout) { | 87 if (!pDocLayout) { |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 return; | 360 return; |
| 361 } | 361 } |
| 362 int32_t iIndex = 0; | 362 int32_t iIndex = 0; |
| 363 CFX_WideString wsType; | 363 CFX_WideString wsType; |
| 364 FX_BOOL bOnPageArea = FALSE; | 364 FX_BOOL bOnPageArea = FALSE; |
| 365 if (iLength >= 1) { | 365 if (iLength >= 1) { |
| 366 iIndex = pArguments->GetInt32(0); | 366 iIndex = pArguments->GetInt32(0); |
| 367 } | 367 } |
| 368 if (iLength >= 2) { | 368 if (iLength >= 2) { |
| 369 CFX_ByteString bsType = pArguments->GetUTF8String(1); | 369 CFX_ByteString bsType = pArguments->GetUTF8String(1); |
| 370 wsType = CFX_WideString::FromUTF8(bsType, bsType.GetLength()); | 370 wsType = CFX_WideString::FromUTF8(bsType.AsByteStringC()); |
| 371 } | 371 } |
| 372 if (iLength >= 3) { | 372 if (iLength >= 3) { |
| 373 bOnPageArea = pArguments->GetInt32(2) == 0 ? FALSE : TRUE; | 373 bOnPageArea = pArguments->GetInt32(2) == 0 ? FALSE : TRUE; |
| 374 } | 374 } |
| 375 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 375 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 376 if (!pNotify) { | 376 if (!pNotify) { |
| 377 return; | 377 return; |
| 378 } | 378 } |
| 379 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); | 379 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); |
| 380 if (!pDocLayout) { | 380 if (!pDocLayout) { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); | 549 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); |
| 550 if (!pLayoutItem) { | 550 if (!pLayoutItem) { |
| 551 FXJSE_Value_SetInteger(hValue, -1); | 551 FXJSE_Value_SetInteger(hValue, -1); |
| 552 return; | 552 return; |
| 553 } | 553 } |
| 554 iPage = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); | 554 iPage = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); |
| 555 if (hValue) { | 555 if (hValue) { |
| 556 FXJSE_Value_SetInteger(hValue, bAbsPage ? iPage : iPage + 1); | 556 FXJSE_Value_SetInteger(hValue, bAbsPage ? iPage : iPage + 1); |
| 557 } | 557 } |
| 558 } | 558 } |
| OLD | NEW |