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 <set> | 9 #include <set> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 XFA_ATTRIBUTE eAttribute) { | 34 XFA_ATTRIBUTE eAttribute) { |
35 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 35 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
36 if (!pNotify) { | 36 if (!pNotify) { |
37 return; | 37 return; |
38 } | 38 } |
39 if (bSetting) { | 39 if (bSetting) { |
40 ThrowException(XFA_IDS_UNABLE_SET_READY); | 40 ThrowException(XFA_IDS_UNABLE_SET_READY); |
41 return; | 41 return; |
42 } | 42 } |
43 int32_t iStatus = pNotify->GetLayoutStatus(); | 43 int32_t iStatus = pNotify->GetLayoutStatus(); |
44 FXJSE_Value_SetBoolean(pValue, iStatus >= 2); | 44 pValue->SetBoolean(iStatus >= 2); |
45 } | 45 } |
46 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_HWXY( | 46 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_HWXY( |
47 CFXJSE_Arguments* pArguments, | 47 CFXJSE_Arguments* pArguments, |
48 XFA_LAYOUTMODEL_HWXY layoutModel) { | 48 XFA_LAYOUTMODEL_HWXY layoutModel) { |
49 int32_t iLength = pArguments->GetLength(); | 49 int32_t iLength = pArguments->GetLength(); |
50 if (iLength < 1 || iLength > 3) { | 50 if (iLength < 1 || iLength > 3) { |
51 const FX_WCHAR* methodName = NULL; | 51 const FX_WCHAR* methodName = NULL; |
52 switch (layoutModel) { | 52 switch (layoutModel) { |
53 case XFA_LAYOUTMODEL_H: | 53 case XFA_LAYOUTMODEL_H: |
54 methodName = L"h"; | 54 methodName = L"h"; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); | 93 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); |
94 if (!pLayoutItem) { | 94 if (!pLayoutItem) { |
95 return; | 95 return; |
96 } | 96 } |
97 while (iIndex > 0 && pLayoutItem) { | 97 while (iIndex > 0 && pLayoutItem) { |
98 pLayoutItem = pLayoutItem->GetNext(); | 98 pLayoutItem = pLayoutItem->GetNext(); |
99 iIndex--; | 99 iIndex--; |
100 } | 100 } |
101 CFXJSE_Value* pValue = pArguments->GetReturnValue(); | 101 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
102 if (!pLayoutItem) { | 102 if (!pLayoutItem) { |
103 FXJSE_Value_SetFloat(pValue, 0); | 103 pValue->SetFloat(0); |
104 return; | 104 return; |
105 } | 105 } |
106 pLayoutItem->GetRect(rtRect, TRUE); | 106 pLayoutItem->GetRect(rtRect, TRUE); |
107 switch (layoutModel) { | 107 switch (layoutModel) { |
108 case XFA_LAYOUTMODEL_H: | 108 case XFA_LAYOUTMODEL_H: |
109 measure.Set(rtRect.height, XFA_UNIT_Pt); | 109 measure.Set(rtRect.height, XFA_UNIT_Pt); |
110 break; | 110 break; |
111 case XFA_LAYOUTMODEL_W: | 111 case XFA_LAYOUTMODEL_W: |
112 measure.Set(rtRect.width, XFA_UNIT_Pt); | 112 measure.Set(rtRect.width, XFA_UNIT_Pt); |
113 break; | 113 break; |
114 case XFA_LAYOUTMODEL_X: | 114 case XFA_LAYOUTMODEL_X: |
115 measure.Set(rtRect.left, XFA_UNIT_Pt); | 115 measure.Set(rtRect.left, XFA_UNIT_Pt); |
116 break; | 116 break; |
117 case XFA_LAYOUTMODEL_Y: | 117 case XFA_LAYOUTMODEL_Y: |
118 measure.Set(rtRect.top, XFA_UNIT_Pt); | 118 measure.Set(rtRect.top, XFA_UNIT_Pt); |
119 break; | 119 break; |
120 } | 120 } |
121 XFA_UNIT unit = measure.GetUnit(wsUnit.AsStringC()); | 121 XFA_UNIT unit = measure.GetUnit(wsUnit.AsStringC()); |
122 FX_FLOAT fValue = measure.ToUnit(unit); | 122 FX_FLOAT fValue = measure.ToUnit(unit); |
123 fValue = FXSYS_round(fValue * 1000) / 1000.0f; | 123 fValue = FXSYS_round(fValue * 1000) / 1000.0f; |
124 if (pValue) { | 124 if (pValue) |
125 FXJSE_Value_SetFloat(pValue, fValue); | 125 pValue->SetFloat(fValue); |
126 } | |
127 } | 126 } |
128 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_H( | 127 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_H( |
129 CFXJSE_Arguments* pArguments) { | 128 CFXJSE_Arguments* pArguments) { |
130 Script_LayoutPseudoModel_HWXY(pArguments, XFA_LAYOUTMODEL_H); | 129 Script_LayoutPseudoModel_HWXY(pArguments, XFA_LAYOUTMODEL_H); |
131 } | 130 } |
132 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_W( | 131 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_W( |
133 CFXJSE_Arguments* pArguments) { | 132 CFXJSE_Arguments* pArguments) { |
134 Script_LayoutPseudoModel_HWXY(pArguments, XFA_LAYOUTMODEL_W); | 133 Script_LayoutPseudoModel_HWXY(pArguments, XFA_LAYOUTMODEL_W); |
135 } | 134 } |
136 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_X( | 135 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_X( |
(...skipping 21 matching lines...) Expand all Loading... |
158 } | 157 } |
159 CXFA_Node* pMasterPage = pLayoutPage->GetMasterPage(); | 158 CXFA_Node* pMasterPage = pLayoutPage->GetMasterPage(); |
160 if (pMasterPage->GetInteger(XFA_ATTRIBUTE_Numbered)) { | 159 if (pMasterPage->GetInteger(XFA_ATTRIBUTE_Numbered)) { |
161 iPageCount++; | 160 iPageCount++; |
162 } | 161 } |
163 } | 162 } |
164 } else { | 163 } else { |
165 iPageCount = iPageNum; | 164 iPageCount = iPageNum; |
166 } | 165 } |
167 CFXJSE_Value* pValue = pArguments->GetReturnValue(); | 166 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
168 if (pValue) { | 167 if (pValue) |
169 FXJSE_Value_SetInteger(pValue, iPageCount); | 168 pValue->SetInteger(iPageCount); |
170 } | |
171 } | 169 } |
172 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageCount( | 170 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageCount( |
173 CFXJSE_Arguments* pArguments) { | 171 CFXJSE_Arguments* pArguments) { |
174 Script_LayoutPseudoModel_NumberedPageCount(pArguments, TRUE); | 172 Script_LayoutPseudoModel_NumberedPageCount(pArguments, TRUE); |
175 } | 173 } |
176 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageSpan( | 174 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageSpan( |
177 CFXJSE_Arguments* pArguments) { | 175 CFXJSE_Arguments* pArguments) { |
178 int32_t iLength = pArguments->GetLength(); | 176 int32_t iLength = pArguments->GetLength(); |
179 if (iLength != 1) { | 177 if (iLength != 1) { |
180 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"pageSpan"); | 178 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"pageSpan"); |
181 return; | 179 return; |
182 } | 180 } |
183 CXFA_Node* pNode = NULL; | 181 CXFA_Node* pNode = NULL; |
184 if (iLength >= 1) { | 182 if (iLength >= 1) { |
185 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); | 183 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
186 } | 184 } |
187 if (!pNode) { | 185 if (!pNode) { |
188 return; | 186 return; |
189 } | 187 } |
190 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); | 188 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); |
191 if (!pDocLayout) { | 189 if (!pDocLayout) { |
192 return; | 190 return; |
193 } | 191 } |
194 CFXJSE_Value* pValue = pArguments->GetReturnValue(); | 192 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
195 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); | 193 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); |
196 if (!pLayoutItem) { | 194 if (!pLayoutItem) { |
197 FXJSE_Value_SetInteger(pValue, -1); | 195 pValue->SetInteger(-1); |
198 return; | 196 return; |
199 } | 197 } |
200 int32_t iLast = pLayoutItem->GetLast()->GetPage()->GetPageIndex(); | 198 int32_t iLast = pLayoutItem->GetLast()->GetPage()->GetPageIndex(); |
201 int32_t iFirst = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); | 199 int32_t iFirst = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); |
202 int32_t iPageSpan = iLast - iFirst + 1; | 200 int32_t iPageSpan = iLast - iFirst + 1; |
203 if (pValue) { | 201 if (pValue) |
204 FXJSE_Value_SetInteger(pValue, iPageSpan); | 202 pValue->SetInteger(iPageSpan); |
205 } | |
206 } | 203 } |
207 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Page( | 204 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Page( |
208 CFXJSE_Arguments* pArguments) { | 205 CFXJSE_Arguments* pArguments) { |
209 Script_LayoutPseudoModel_PageImp(pArguments, FALSE); | 206 Script_LayoutPseudoModel_PageImp(pArguments, FALSE); |
210 } | 207 } |
211 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( | 208 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( |
212 CXFA_LayoutProcessor* pDocLayout, | 209 CXFA_LayoutProcessor* pDocLayout, |
213 int32_t iPageNo, | 210 int32_t iPageNo, |
214 const CFX_WideString& wsType, | 211 const CFX_WideString& wsType, |
215 FX_BOOL bOnPageArea, | 212 FX_BOOL bOnPageArea, |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 } | 368 } |
372 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); | 369 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); |
373 if (!pDocLayout) { | 370 if (!pDocLayout) { |
374 return; | 371 return; |
375 } | 372 } |
376 CXFA_NodeArray retArray; | 373 CXFA_NodeArray retArray; |
377 Script_LayoutPseudoModel_GetObjArray(pDocLayout, iIndex, wsType, bOnPageArea, | 374 Script_LayoutPseudoModel_GetObjArray(pDocLayout, iIndex, wsType, bOnPageArea, |
378 retArray); | 375 retArray); |
379 CXFA_ArrayNodeList* pArrayNodeList = new CXFA_ArrayNodeList(m_pDocument); | 376 CXFA_ArrayNodeList* pArrayNodeList = new CXFA_ArrayNodeList(m_pDocument); |
380 pArrayNodeList->SetArrayNodeList(retArray); | 377 pArrayNodeList->SetArrayNodeList(retArray); |
381 FXJSE_Value_SetObject(pArguments->GetReturnValue(), | 378 pArguments->GetReturnValue()->SetObject( |
382 (CXFA_Object*)pArrayNodeList, | 379 (CXFA_Object*)pArrayNodeList, |
383 m_pDocument->GetScriptContext()->GetJseNormalClass()); | 380 m_pDocument->GetScriptContext()->GetJseNormalClass()); |
384 } | 381 } |
385 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageCount( | 382 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageCount( |
386 CFXJSE_Arguments* pArguments) { | 383 CFXJSE_Arguments* pArguments) { |
387 Script_LayoutPseudoModel_NumberedPageCount(pArguments, FALSE); | 384 Script_LayoutPseudoModel_NumberedPageCount(pArguments, FALSE); |
388 } | 385 } |
389 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageCountInBatch( | 386 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageCountInBatch( |
390 CFXJSE_Arguments* pArguments) { | 387 CFXJSE_Arguments* pArguments) { |
391 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 388 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
392 if (!pNotify) { | 389 if (!pNotify) { |
393 return; | 390 return; |
394 } | 391 } |
395 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 392 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
396 int32_t iPageCount = pNotify->GetDocProvider()->AbsPageCountInBatch(hDoc); | 393 int32_t iPageCount = pNotify->GetDocProvider()->AbsPageCountInBatch(hDoc); |
397 CFXJSE_Value* pValue = pArguments->GetReturnValue(); | 394 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
398 if (pValue) { | 395 if (pValue) |
399 FXJSE_Value_SetInteger(pValue, iPageCount); | 396 pValue->SetInteger(iPageCount); |
400 } | |
401 } | 397 } |
402 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetCountInBatch( | 398 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetCountInBatch( |
403 CFXJSE_Arguments* pArguments) { | 399 CFXJSE_Arguments* pArguments) { |
404 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 400 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
405 if (!pNotify) { | 401 if (!pNotify) { |
406 return; | 402 return; |
407 } | 403 } |
408 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 404 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
409 int32_t iPageCount = pNotify->GetDocProvider()->SheetCountInBatch(hDoc); | 405 int32_t iPageCount = pNotify->GetDocProvider()->SheetCountInBatch(hDoc); |
410 CFXJSE_Value* pValue = pArguments->GetReturnValue(); | 406 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
411 if (pValue) { | 407 if (pValue) |
412 FXJSE_Value_SetInteger(pValue, iPageCount); | 408 pValue->SetInteger(iPageCount); |
413 } | |
414 } | 409 } |
415 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Relayout( | 410 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Relayout( |
416 CFXJSE_Arguments* pArguments) { | 411 CFXJSE_Arguments* pArguments) { |
417 CXFA_Node* pRootNode = m_pDocument->GetRoot(); | 412 CXFA_Node* pRootNode = m_pDocument->GetRoot(); |
418 CXFA_Node* pFormRoot = pRootNode->GetFirstChildByClass(XFA_ELEMENT_Form); | 413 CXFA_Node* pFormRoot = pRootNode->GetFirstChildByClass(XFA_ELEMENT_Form); |
419 ASSERT(pFormRoot); | 414 ASSERT(pFormRoot); |
420 CXFA_Node* pContentRootNode = pFormRoot->GetNodeItem(XFA_NODEITEM_FirstChild); | 415 CXFA_Node* pContentRootNode = pFormRoot->GetNodeItem(XFA_NODEITEM_FirstChild); |
421 CXFA_LayoutProcessor* pLayoutProcessor = m_pDocument->GetLayoutProcessor(); | 416 CXFA_LayoutProcessor* pLayoutProcessor = m_pDocument->GetLayoutProcessor(); |
422 if (pContentRootNode) { | 417 if (pContentRootNode) { |
423 pLayoutProcessor->AddChangedContainer(pContentRootNode); | 418 pLayoutProcessor->AddChangedContainer(pContentRootNode); |
(...skipping 27 matching lines...) Expand all Loading... |
451 return; | 446 return; |
452 } | 447 } |
453 CXFA_FFWidget* hWidget = | 448 CXFA_FFWidget* hWidget = |
454 pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); | 449 pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); |
455 if (!hWidget) { | 450 if (!hWidget) { |
456 return; | 451 return; |
457 } | 452 } |
458 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 453 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
459 int32_t iPageCount = pNotify->GetDocProvider()->AbsPageInBatch(hDoc, hWidget); | 454 int32_t iPageCount = pNotify->GetDocProvider()->AbsPageInBatch(hDoc, hWidget); |
460 CFXJSE_Value* pValue = pArguments->GetReturnValue(); | 455 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
461 if (pValue) { | 456 if (pValue) |
462 FXJSE_Value_SetInteger(pValue, iPageCount); | 457 pValue->SetInteger(iPageCount); |
463 } | |
464 } | 458 } |
465 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetInBatch( | 459 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetInBatch( |
466 CFXJSE_Arguments* pArguments) { | 460 CFXJSE_Arguments* pArguments) { |
467 int32_t iLength = pArguments->GetLength(); | 461 int32_t iLength = pArguments->GetLength(); |
468 if (iLength != 1) { | 462 if (iLength != 1) { |
469 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sheetInBatch"); | 463 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sheetInBatch"); |
470 return; | 464 return; |
471 } | 465 } |
472 CXFA_Node* pNode = NULL; | 466 CXFA_Node* pNode = NULL; |
473 if (iLength >= 1) { | 467 if (iLength >= 1) { |
(...skipping 11 matching lines...) Expand all Loading... |
485 return; | 479 return; |
486 } | 480 } |
487 CXFA_FFWidget* hWidget = | 481 CXFA_FFWidget* hWidget = |
488 pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); | 482 pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); |
489 if (!hWidget) { | 483 if (!hWidget) { |
490 return; | 484 return; |
491 } | 485 } |
492 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 486 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
493 int32_t iPageCount = pNotify->GetDocProvider()->SheetInBatch(hDoc, hWidget); | 487 int32_t iPageCount = pNotify->GetDocProvider()->SheetInBatch(hDoc, hWidget); |
494 CFXJSE_Value* pValue = pArguments->GetReturnValue(); | 488 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
495 if (pValue) { | 489 if (pValue) |
496 FXJSE_Value_SetInteger(pValue, iPageCount); | 490 pValue->SetInteger(iPageCount); |
497 } | |
498 } | 491 } |
499 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Sheet( | 492 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Sheet( |
500 CFXJSE_Arguments* pArguments) { | 493 CFXJSE_Arguments* pArguments) { |
501 Script_LayoutPseudoModel_PageImp(pArguments, TRUE); | 494 Script_LayoutPseudoModel_PageImp(pArguments, TRUE); |
502 } | 495 } |
503 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_RelayoutPageArea( | 496 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_RelayoutPageArea( |
504 CFXJSE_Arguments* pArguments) {} | 497 CFXJSE_Arguments* pArguments) {} |
505 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetCount( | 498 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetCount( |
506 CFXJSE_Arguments* pArguments) { | 499 CFXJSE_Arguments* pArguments) { |
507 Script_LayoutPseudoModel_NumberedPageCount(pArguments, FALSE); | 500 Script_LayoutPseudoModel_NumberedPageCount(pArguments, FALSE); |
(...skipping 15 matching lines...) Expand all Loading... |
523 } | 516 } |
524 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, methodName); | 517 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, methodName); |
525 return; | 518 return; |
526 } | 519 } |
527 CXFA_Node* pNode = NULL; | 520 CXFA_Node* pNode = NULL; |
528 if (iLength >= 1) { | 521 if (iLength >= 1) { |
529 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); | 522 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
530 } | 523 } |
531 int32_t iPage = 0; | 524 int32_t iPage = 0; |
532 CFXJSE_Value* pValue = pArguments->GetReturnValue(); | 525 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
533 if (!pNode && pValue) { | 526 if (!pNode && pValue) |
534 FXJSE_Value_SetInteger(pValue, iPage); | 527 pValue->SetInteger(iPage); |
535 } | 528 |
536 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); | 529 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); |
537 if (!pDocLayout) { | 530 if (!pDocLayout) { |
538 return; | 531 return; |
539 } | 532 } |
540 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); | 533 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); |
541 if (!pLayoutItem) { | 534 if (!pLayoutItem) { |
542 FXJSE_Value_SetInteger(pValue, -1); | 535 pValue->SetInteger(-1); |
543 return; | 536 return; |
544 } | 537 } |
545 iPage = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); | 538 iPage = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); |
546 if (pValue) { | 539 if (pValue) |
547 FXJSE_Value_SetInteger(pValue, bAbsPage ? iPage : iPage + 1); | 540 pValue->SetInteger(bAbsPage ? iPage : iPage + 1); |
548 } | |
549 } | 541 } |
OLD | NEW |