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.AsByteStringC()); | 77 wsUnit = CFX_WideString::FromUTF8(bsUnit.AsStringC()); |
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 22 matching lines...) Expand all Loading... |
110 case XFA_LAYOUTMODEL_W: | 110 case XFA_LAYOUTMODEL_W: |
111 measure.Set(rtRect.width, XFA_UNIT_Pt); | 111 measure.Set(rtRect.width, XFA_UNIT_Pt); |
112 break; | 112 break; |
113 case XFA_LAYOUTMODEL_X: | 113 case XFA_LAYOUTMODEL_X: |
114 measure.Set(rtRect.left, XFA_UNIT_Pt); | 114 measure.Set(rtRect.left, XFA_UNIT_Pt); |
115 break; | 115 break; |
116 case XFA_LAYOUTMODEL_Y: | 116 case XFA_LAYOUTMODEL_Y: |
117 measure.Set(rtRect.top, XFA_UNIT_Pt); | 117 measure.Set(rtRect.top, XFA_UNIT_Pt); |
118 break; | 118 break; |
119 } | 119 } |
120 XFA_UNIT unit = measure.GetUnit(wsUnit.AsWideStringC()); | 120 XFA_UNIT unit = measure.GetUnit(wsUnit.AsStringC()); |
121 FX_FLOAT fValue = measure.ToUnit(unit); | 121 FX_FLOAT fValue = measure.ToUnit(unit); |
122 fValue = FXSYS_round(fValue * 1000) / 1000.0f; | 122 fValue = FXSYS_round(fValue * 1000) / 1000.0f; |
123 if (hValue) { | 123 if (hValue) { |
124 FXJSE_Value_SetFloat(hValue, fValue); | 124 FXJSE_Value_SetFloat(hValue, fValue); |
125 } | 125 } |
126 } | 126 } |
127 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_H( | 127 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_H( |
128 CFXJSE_Arguments* pArguments) { | 128 CFXJSE_Arguments* pArguments) { |
129 Script_LayoutPseudoModel_HWXY(pArguments, XFA_LAYOUTMODEL_H); | 129 Script_LayoutPseudoModel_HWXY(pArguments, XFA_LAYOUTMODEL_H); |
130 } | 130 } |
(...skipping 229 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.AsByteStringC()); | 370 wsType = CFX_WideString::FromUTF8(bsType.AsStringC()); |
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 |