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/fm2js/xfa_fm2jsapi.h" | 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
10 #include "xfa/fxfa/parser/xfa_docdata.h" | 11 #include "xfa/fxfa/parser/xfa_docdata.h" |
11 #include "xfa/fxfa/parser/xfa_doclayout.h" | 12 #include "xfa/fxfa/parser/xfa_doclayout.h" |
12 #include "xfa/fxfa/parser/xfa_document.h" | 13 #include "xfa/fxfa/parser/xfa_document.h" |
13 #include "xfa/fxfa/parser/xfa_document_layout_imp.h" | 14 #include "xfa/fxfa/parser/xfa_document_layout_imp.h" |
14 #include "xfa/fxfa/parser/xfa_layout_appadapter.h" | 15 #include "xfa/fxfa/parser/xfa_layout_appadapter.h" |
15 #include "xfa/fxfa/parser/xfa_localemgr.h" | 16 #include "xfa/fxfa/parser/xfa_localemgr.h" |
16 #include "xfa/fxfa/parser/xfa_object.h" | 17 #include "xfa/fxfa/parser/xfa_object.h" |
17 #include "xfa/fxfa/parser/xfa_parser.h" | 18 #include "xfa/fxfa/parser/xfa_parser.h" |
| 19 #include "xfa/fxfa/parser/xfa_parser_imp.h" |
18 #include "xfa/fxfa/parser/xfa_script.h" | 20 #include "xfa/fxfa/parser/xfa_script.h" |
| 21 #include "xfa/fxfa/parser/xfa_script_imp.h" |
19 #include "xfa/fxfa/parser/xfa_utils.h" | 22 #include "xfa/fxfa/parser/xfa_utils.h" |
20 #include "xfa/fxjse/cfxjse_arguments.h" | 23 #include "xfa/fxjse/cfxjse_arguments.h" |
21 | 24 |
22 CScript_LayoutPseudoModel::CScript_LayoutPseudoModel(CXFA_Document* pDocument) | 25 CScript_LayoutPseudoModel::CScript_LayoutPseudoModel(CXFA_Document* pDocument) |
23 : CXFA_OrdinaryObject(pDocument, XFA_ELEMENT_LayoutPseudoModel) { | 26 : CXFA_OrdinaryObject(pDocument, XFA_ELEMENT_LayoutPseudoModel) { |
24 m_uScriptHash = XFA_HASHCODE_Layout; | 27 m_uScriptHash = XFA_HASHCODE_Layout; |
25 } | 28 } |
26 CScript_LayoutPseudoModel::~CScript_LayoutPseudoModel() {} | 29 CScript_LayoutPseudoModel::~CScript_LayoutPseudoModel() {} |
27 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Ready( | 30 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Ready( |
28 FXJSE_HVALUE hValue, | 31 FXJSE_HVALUE hValue, |
29 FX_BOOL bSetting, | 32 FX_BOOL bSetting, |
30 XFA_ATTRIBUTE eAttribute) { | 33 XFA_ATTRIBUTE eAttribute) { |
31 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); | 34 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
32 if (!pNotify) { | 35 if (!pNotify) { |
33 return; | 36 return; |
34 } | 37 } |
35 if (bSetting) { | 38 if (bSetting) { |
36 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_READY); | 39 ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_READY); |
37 return; | 40 return; |
38 } | 41 } |
39 int32_t iStatus = pNotify->GetLayoutStatus(); | 42 int32_t iStatus = pNotify->GetLayoutStatus(); |
40 FXJSE_Value_SetBoolean(hValue, iStatus >= 2); | 43 FXJSE_Value_SetBoolean(hValue, iStatus >= 2); |
41 } | 44 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 if (!bsUnit.IsEmpty()) { | 76 if (!bsUnit.IsEmpty()) { |
74 wsUnit = CFX_WideString::FromUTF8(bsUnit, bsUnit.GetLength()); | 77 wsUnit = CFX_WideString::FromUTF8(bsUnit, bsUnit.GetLength()); |
75 } | 78 } |
76 } | 79 } |
77 if (iLength >= 3) { | 80 if (iLength >= 3) { |
78 iIndex = pArguments->GetInt32(2); | 81 iIndex = pArguments->GetInt32(2); |
79 } | 82 } |
80 if (!pNode) { | 83 if (!pNode) { |
81 return; | 84 return; |
82 } | 85 } |
83 IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); | 86 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); |
84 if (!pDocLayout) { | 87 if (!pDocLayout) { |
85 return; | 88 return; |
86 } | 89 } |
87 CFX_RectF rtRect; | 90 CFX_RectF rtRect; |
88 CXFA_Measurement measure; | 91 CXFA_Measurement measure; |
89 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); | 92 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); |
90 if (!pLayoutItem) { | 93 if (!pLayoutItem) { |
91 return; | 94 return; |
92 } | 95 } |
93 while (iIndex > 0 && pLayoutItem) { | 96 while (iIndex > 0 && pLayoutItem) { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 CFXJSE_Arguments* pArguments) { | 136 CFXJSE_Arguments* pArguments) { |
134 Script_LayoutPseudoModel_HWXY(pArguments, XFA_LAYOUTMODEL_X); | 137 Script_LayoutPseudoModel_HWXY(pArguments, XFA_LAYOUTMODEL_X); |
135 } | 138 } |
136 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Y( | 139 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Y( |
137 CFXJSE_Arguments* pArguments) { | 140 CFXJSE_Arguments* pArguments) { |
138 Script_LayoutPseudoModel_HWXY(pArguments, XFA_LAYOUTMODEL_Y); | 141 Script_LayoutPseudoModel_HWXY(pArguments, XFA_LAYOUTMODEL_Y); |
139 } | 142 } |
140 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_NumberedPageCount( | 143 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_NumberedPageCount( |
141 CFXJSE_Arguments* pArguments, | 144 CFXJSE_Arguments* pArguments, |
142 FX_BOOL bNumbered) { | 145 FX_BOOL bNumbered) { |
143 IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); | 146 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); |
144 if (!pDocLayout) { | 147 if (!pDocLayout) { |
145 return; | 148 return; |
146 } | 149 } |
147 int32_t iPageCount = 0; | 150 int32_t iPageCount = 0; |
148 int32_t iPageNum = pDocLayout->CountPages(); | 151 int32_t iPageNum = pDocLayout->CountPages(); |
149 if (bNumbered) { | 152 if (bNumbered) { |
150 for (int32_t i = 0; i < iPageNum; i++) { | 153 for (int32_t i = 0; i < iPageNum; i++) { |
151 IXFA_LayoutPage* pLayoutPage = pDocLayout->GetPage(i); | 154 CXFA_ContainerLayoutItem* pLayoutPage = pDocLayout->GetPage(i); |
152 if (!pLayoutPage) { | 155 if (!pLayoutPage) { |
153 continue; | 156 continue; |
154 } | 157 } |
155 CXFA_Node* pMasterPage = pLayoutPage->GetMasterPage(); | 158 CXFA_Node* pMasterPage = pLayoutPage->GetMasterPage(); |
156 if (pMasterPage->GetInteger(XFA_ATTRIBUTE_Numbered)) { | 159 if (pMasterPage->GetInteger(XFA_ATTRIBUTE_Numbered)) { |
157 iPageCount++; | 160 iPageCount++; |
158 } | 161 } |
159 } | 162 } |
160 } else { | 163 } else { |
161 iPageCount = iPageNum; | 164 iPageCount = iPageNum; |
(...skipping 14 matching lines...) Expand all Loading... |
176 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"pageSpan"); | 179 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"pageSpan"); |
177 return; | 180 return; |
178 } | 181 } |
179 CXFA_Node* pNode = NULL; | 182 CXFA_Node* pNode = NULL; |
180 if (iLength >= 1) { | 183 if (iLength >= 1) { |
181 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); | 184 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
182 } | 185 } |
183 if (!pNode) { | 186 if (!pNode) { |
184 return; | 187 return; |
185 } | 188 } |
186 IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); | 189 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); |
187 if (!pDocLayout) { | 190 if (!pDocLayout) { |
188 return; | 191 return; |
189 } | 192 } |
190 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 193 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); |
191 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); | 194 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); |
192 if (!pLayoutItem) { | 195 if (!pLayoutItem) { |
193 FXJSE_Value_SetInteger(hValue, -1); | 196 FXJSE_Value_SetInteger(hValue, -1); |
194 return; | 197 return; |
195 } | 198 } |
196 int32_t iLast = pLayoutItem->GetLast()->GetPage()->GetPageIndex(); | 199 int32_t iLast = pLayoutItem->GetLast()->GetPage()->GetPageIndex(); |
197 int32_t iFirst = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); | 200 int32_t iFirst = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); |
198 int32_t iPageSpan = iLast - iFirst + 1; | 201 int32_t iPageSpan = iLast - iFirst + 1; |
199 if (hValue) { | 202 if (hValue) { |
200 FXJSE_Value_SetInteger(hValue, iPageSpan); | 203 FXJSE_Value_SetInteger(hValue, iPageSpan); |
201 } | 204 } |
202 } | 205 } |
203 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Page( | 206 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Page( |
204 CFXJSE_Arguments* pArguments) { | 207 CFXJSE_Arguments* pArguments) { |
205 Script_LayoutPseudoModel_PageImp(pArguments, FALSE); | 208 Script_LayoutPseudoModel_PageImp(pArguments, FALSE); |
206 } | 209 } |
207 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( | 210 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( |
208 IXFA_DocLayout* pDocLayout, | 211 CXFA_LayoutProcessor* pDocLayout, |
209 int32_t iPageNo, | 212 int32_t iPageNo, |
210 const CFX_WideString& wsType, | 213 const CFX_WideString& wsType, |
211 FX_BOOL bOnPageArea, | 214 FX_BOOL bOnPageArea, |
212 CXFA_NodeArray& retArray) { | 215 CXFA_NodeArray& retArray) { |
213 CXFA_ContainerLayoutItem* pLayoutPage = | 216 CXFA_ContainerLayoutItem* pLayoutPage = |
214 (CXFA_ContainerLayoutItem*)pDocLayout->GetPage(iPageNo); | 217 (CXFA_ContainerLayoutItem*)pDocLayout->GetPage(iPageNo); |
215 if (!pLayoutPage) { | 218 if (!pLayoutPage) { |
216 return; | 219 return; |
217 } | 220 } |
218 if (wsType == FX_WSTRC(L"pageArea")) { | 221 if (wsType == FX_WSTRC(L"pageArea")) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 if (iLength >= 1) { | 365 if (iLength >= 1) { |
363 iIndex = pArguments->GetInt32(0); | 366 iIndex = pArguments->GetInt32(0); |
364 } | 367 } |
365 if (iLength >= 2) { | 368 if (iLength >= 2) { |
366 CFX_ByteString bsType = pArguments->GetUTF8String(1); | 369 CFX_ByteString bsType = pArguments->GetUTF8String(1); |
367 wsType = CFX_WideString::FromUTF8(bsType, bsType.GetLength()); | 370 wsType = CFX_WideString::FromUTF8(bsType, bsType.GetLength()); |
368 } | 371 } |
369 if (iLength >= 3) { | 372 if (iLength >= 3) { |
370 bOnPageArea = pArguments->GetInt32(2) == 0 ? FALSE : TRUE; | 373 bOnPageArea = pArguments->GetInt32(2) == 0 ? FALSE : TRUE; |
371 } | 374 } |
372 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); | 375 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
373 if (!pNotify) { | 376 if (!pNotify) { |
374 return; | 377 return; |
375 } | 378 } |
376 IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); | 379 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); |
377 if (!pDocLayout) { | 380 if (!pDocLayout) { |
378 return; | 381 return; |
379 } | 382 } |
380 CXFA_NodeArray retArray; | 383 CXFA_NodeArray retArray; |
381 Script_LayoutPseudoModel_GetObjArray(pDocLayout, iIndex, wsType, bOnPageArea, | 384 Script_LayoutPseudoModel_GetObjArray(pDocLayout, iIndex, wsType, bOnPageArea, |
382 retArray); | 385 retArray); |
383 CXFA_ArrayNodeList* pArrayNodeList = new CXFA_ArrayNodeList(m_pDocument); | 386 CXFA_ArrayNodeList* pArrayNodeList = new CXFA_ArrayNodeList(m_pDocument); |
384 pArrayNodeList->SetArrayNodeList(retArray); | 387 pArrayNodeList->SetArrayNodeList(retArray); |
385 FXJSE_Value_SetObject(pArguments->GetReturnValue(), | 388 FXJSE_Value_SetObject(pArguments->GetReturnValue(), |
386 (CXFA_Object*)pArrayNodeList, | 389 (CXFA_Object*)pArrayNodeList, |
387 m_pDocument->GetScriptContext()->GetJseNormalClass()); | 390 m_pDocument->GetScriptContext()->GetJseNormalClass()); |
388 } | 391 } |
389 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageCount( | 392 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageCount( |
390 CFXJSE_Arguments* pArguments) { | 393 CFXJSE_Arguments* pArguments) { |
391 Script_LayoutPseudoModel_NumberedPageCount(pArguments, FALSE); | 394 Script_LayoutPseudoModel_NumberedPageCount(pArguments, FALSE); |
392 } | 395 } |
393 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageCountInBatch( | 396 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageCountInBatch( |
394 CFXJSE_Arguments* pArguments) { | 397 CFXJSE_Arguments* pArguments) { |
395 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); | 398 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
396 if (!pNotify) { | 399 if (!pNotify) { |
397 return; | 400 return; |
398 } | 401 } |
399 IXFA_Doc* hDoc = pNotify->GetHDOC(); | 402 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
400 int32_t iPageCount = pNotify->GetDocProvider()->AbsPageCountInBatch(hDoc); | 403 int32_t iPageCount = pNotify->GetDocProvider()->AbsPageCountInBatch(hDoc); |
401 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 404 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); |
402 if (hValue) { | 405 if (hValue) { |
403 FXJSE_Value_SetInteger(hValue, iPageCount); | 406 FXJSE_Value_SetInteger(hValue, iPageCount); |
404 } | 407 } |
405 } | 408 } |
406 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetCountInBatch( | 409 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetCountInBatch( |
407 CFXJSE_Arguments* pArguments) { | 410 CFXJSE_Arguments* pArguments) { |
408 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); | 411 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
409 if (!pNotify) { | 412 if (!pNotify) { |
410 return; | 413 return; |
411 } | 414 } |
412 IXFA_Doc* hDoc = pNotify->GetHDOC(); | 415 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
413 int32_t iPageCount = pNotify->GetDocProvider()->SheetCountInBatch(hDoc); | 416 int32_t iPageCount = pNotify->GetDocProvider()->SheetCountInBatch(hDoc); |
414 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 417 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); |
415 if (hValue) { | 418 if (hValue) { |
416 FXJSE_Value_SetInteger(hValue, iPageCount); | 419 FXJSE_Value_SetInteger(hValue, iPageCount); |
417 } | 420 } |
418 } | 421 } |
419 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Relayout( | 422 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Relayout( |
420 CFXJSE_Arguments* pArguments) { | 423 CFXJSE_Arguments* pArguments) { |
421 CXFA_Node* pRootNode = m_pDocument->GetRoot(); | 424 CXFA_Node* pRootNode = m_pDocument->GetRoot(); |
422 CXFA_Node* pFormRoot = pRootNode->GetFirstChildByClass(XFA_ELEMENT_Form); | 425 CXFA_Node* pFormRoot = pRootNode->GetFirstChildByClass(XFA_ELEMENT_Form); |
(...skipping 17 matching lines...) Expand all Loading... |
440 L"absPageInBatch"); | 443 L"absPageInBatch"); |
441 return; | 444 return; |
442 } | 445 } |
443 CXFA_Node* pNode = NULL; | 446 CXFA_Node* pNode = NULL; |
444 if (iLength >= 1) { | 447 if (iLength >= 1) { |
445 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); | 448 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
446 } | 449 } |
447 if (!pNode) { | 450 if (!pNode) { |
448 return; | 451 return; |
449 } | 452 } |
450 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); | 453 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
451 if (!pNotify) { | 454 if (!pNotify) { |
452 return; | 455 return; |
453 } | 456 } |
454 IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); | 457 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); |
455 if (!pDocLayout) { | 458 if (!pDocLayout) { |
456 return; | 459 return; |
457 } | 460 } |
458 IXFA_Widget* hWidget = pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); | 461 CXFA_FFWidget* hWidget = |
| 462 pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); |
459 if (!hWidget) { | 463 if (!hWidget) { |
460 return; | 464 return; |
461 } | 465 } |
462 IXFA_Doc* hDoc = pNotify->GetHDOC(); | 466 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
463 int32_t iPageCount = pNotify->GetDocProvider()->AbsPageInBatch(hDoc, hWidget); | 467 int32_t iPageCount = pNotify->GetDocProvider()->AbsPageInBatch(hDoc, hWidget); |
464 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 468 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); |
465 if (hValue) { | 469 if (hValue) { |
466 FXJSE_Value_SetInteger(hValue, iPageCount); | 470 FXJSE_Value_SetInteger(hValue, iPageCount); |
467 } | 471 } |
468 } | 472 } |
469 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetInBatch( | 473 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetInBatch( |
470 CFXJSE_Arguments* pArguments) { | 474 CFXJSE_Arguments* pArguments) { |
471 int32_t iLength = pArguments->GetLength(); | 475 int32_t iLength = pArguments->GetLength(); |
472 if (iLength != 1) { | 476 if (iLength != 1) { |
473 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, | 477 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, |
474 L"sheetInBatch"); | 478 L"sheetInBatch"); |
475 return; | 479 return; |
476 } | 480 } |
477 CXFA_Node* pNode = NULL; | 481 CXFA_Node* pNode = NULL; |
478 if (iLength >= 1) { | 482 if (iLength >= 1) { |
479 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); | 483 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
480 } | 484 } |
481 if (!pNode) { | 485 if (!pNode) { |
482 return; | 486 return; |
483 } | 487 } |
484 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); | 488 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
485 if (!pNotify) { | 489 if (!pNotify) { |
486 return; | 490 return; |
487 } | 491 } |
488 IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); | 492 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); |
489 if (!pDocLayout) { | 493 if (!pDocLayout) { |
490 return; | 494 return; |
491 } | 495 } |
492 IXFA_Widget* hWidget = pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); | 496 CXFA_FFWidget* hWidget = |
| 497 pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); |
493 if (!hWidget) { | 498 if (!hWidget) { |
494 return; | 499 return; |
495 } | 500 } |
496 IXFA_Doc* hDoc = pNotify->GetHDOC(); | 501 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
497 int32_t iPageCount = pNotify->GetDocProvider()->SheetInBatch(hDoc, hWidget); | 502 int32_t iPageCount = pNotify->GetDocProvider()->SheetInBatch(hDoc, hWidget); |
498 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 503 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); |
499 if (hValue) { | 504 if (hValue) { |
500 FXJSE_Value_SetInteger(hValue, iPageCount); | 505 FXJSE_Value_SetInteger(hValue, iPageCount); |
501 } | 506 } |
502 } | 507 } |
503 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Sheet( | 508 void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Sheet( |
504 CFXJSE_Arguments* pArguments) { | 509 CFXJSE_Arguments* pArguments) { |
505 Script_LayoutPseudoModel_PageImp(pArguments, TRUE); | 510 Script_LayoutPseudoModel_PageImp(pArguments, TRUE); |
506 } | 511 } |
(...skipping 23 matching lines...) Expand all Loading... |
530 } | 535 } |
531 CXFA_Node* pNode = NULL; | 536 CXFA_Node* pNode = NULL; |
532 if (iLength >= 1) { | 537 if (iLength >= 1) { |
533 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); | 538 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
534 } | 539 } |
535 int32_t iPage = 0; | 540 int32_t iPage = 0; |
536 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 541 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); |
537 if (!pNode && hValue) { | 542 if (!pNode && hValue) { |
538 FXJSE_Value_SetInteger(hValue, iPage); | 543 FXJSE_Value_SetInteger(hValue, iPage); |
539 } | 544 } |
540 IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); | 545 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); |
541 if (!pDocLayout) { | 546 if (!pDocLayout) { |
542 return; | 547 return; |
543 } | 548 } |
544 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); | 549 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); |
545 if (!pLayoutItem) { | 550 if (!pLayoutItem) { |
546 FXJSE_Value_SetInteger(hValue, -1); | 551 FXJSE_Value_SetInteger(hValue, -1); |
547 return; | 552 return; |
548 } | 553 } |
549 iPage = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); | 554 iPage = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); |
550 if (hValue) { | 555 if (hValue) { |
551 FXJSE_Value_SetInteger(hValue, bAbsPage ? iPage : iPage + 1); | 556 FXJSE_Value_SetInteger(hValue, bAbsPage ? iPage : iPage + 1); |
552 } | 557 } |
553 } | 558 } |
OLD | NEW |