| 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/cscript_layoutpseudomodel.h" | 7 #include "xfa/fxfa/parser/cscript_layoutpseudomodel.h" |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 if (!pNotify) { | 38 if (!pNotify) { |
| 39 return; | 39 return; |
| 40 } | 40 } |
| 41 if (bSetting) { | 41 if (bSetting) { |
| 42 ThrowException(XFA_IDS_UNABLE_SET_READY); | 42 ThrowException(XFA_IDS_UNABLE_SET_READY); |
| 43 return; | 43 return; |
| 44 } | 44 } |
| 45 int32_t iStatus = pNotify->GetLayoutStatus(); | 45 int32_t iStatus = pNotify->GetLayoutStatus(); |
| 46 pValue->SetBoolean(iStatus >= 2); | 46 pValue->SetBoolean(iStatus >= 2); |
| 47 } | 47 } |
| 48 |
| 48 void CScript_LayoutPseudoModel::HWXY(CFXJSE_Arguments* pArguments, | 49 void CScript_LayoutPseudoModel::HWXY(CFXJSE_Arguments* pArguments, |
| 49 XFA_LAYOUTMODEL_HWXY layoutModel) { | 50 XFA_LAYOUTMODEL_HWXY layoutModel) { |
| 50 int32_t iLength = pArguments->GetLength(); | 51 int32_t iLength = pArguments->GetLength(); |
| 51 if (iLength < 1 || iLength > 3) { | 52 if (iLength < 1 || iLength > 3) { |
| 52 const FX_WCHAR* methodName = nullptr; | 53 const FX_WCHAR* methodName = nullptr; |
| 53 switch (layoutModel) { | 54 switch (layoutModel) { |
| 54 case XFA_LAYOUTMODEL_H: | 55 case XFA_LAYOUTMODEL_H: |
| 55 methodName = L"h"; | 56 methodName = L"h"; |
| 56 break; | 57 break; |
| 57 case XFA_LAYOUTMODEL_W: | 58 case XFA_LAYOUTMODEL_W: |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 case XFA_LAYOUTMODEL_Y: | 119 case XFA_LAYOUTMODEL_Y: |
| 119 measure.Set(rtRect.top, XFA_UNIT_Pt); | 120 measure.Set(rtRect.top, XFA_UNIT_Pt); |
| 120 break; | 121 break; |
| 121 } | 122 } |
| 122 XFA_UNIT unit = measure.GetUnit(wsUnit.AsStringC()); | 123 XFA_UNIT unit = measure.GetUnit(wsUnit.AsStringC()); |
| 123 FX_FLOAT fValue = measure.ToUnit(unit); | 124 FX_FLOAT fValue = measure.ToUnit(unit); |
| 124 fValue = FXSYS_round(fValue * 1000) / 1000.0f; | 125 fValue = FXSYS_round(fValue * 1000) / 1000.0f; |
| 125 if (pValue) | 126 if (pValue) |
| 126 pValue->SetFloat(fValue); | 127 pValue->SetFloat(fValue); |
| 127 } | 128 } |
| 129 |
| 128 void CScript_LayoutPseudoModel::H(CFXJSE_Arguments* pArguments) { | 130 void CScript_LayoutPseudoModel::H(CFXJSE_Arguments* pArguments) { |
| 129 HWXY(pArguments, XFA_LAYOUTMODEL_H); | 131 HWXY(pArguments, XFA_LAYOUTMODEL_H); |
| 130 } | 132 } |
| 133 |
| 131 void CScript_LayoutPseudoModel::W(CFXJSE_Arguments* pArguments) { | 134 void CScript_LayoutPseudoModel::W(CFXJSE_Arguments* pArguments) { |
| 132 HWXY(pArguments, XFA_LAYOUTMODEL_W); | 135 HWXY(pArguments, XFA_LAYOUTMODEL_W); |
| 133 } | 136 } |
| 137 |
| 134 void CScript_LayoutPseudoModel::X(CFXJSE_Arguments* pArguments) { | 138 void CScript_LayoutPseudoModel::X(CFXJSE_Arguments* pArguments) { |
| 135 HWXY(pArguments, XFA_LAYOUTMODEL_X); | 139 HWXY(pArguments, XFA_LAYOUTMODEL_X); |
| 136 } | 140 } |
| 141 |
| 137 void CScript_LayoutPseudoModel::Y(CFXJSE_Arguments* pArguments) { | 142 void CScript_LayoutPseudoModel::Y(CFXJSE_Arguments* pArguments) { |
| 138 HWXY(pArguments, XFA_LAYOUTMODEL_Y); | 143 HWXY(pArguments, XFA_LAYOUTMODEL_Y); |
| 139 } | 144 } |
| 145 |
| 140 void CScript_LayoutPseudoModel::NumberedPageCount(CFXJSE_Arguments* pArguments, | 146 void CScript_LayoutPseudoModel::NumberedPageCount(CFXJSE_Arguments* pArguments, |
| 141 FX_BOOL bNumbered) { | 147 FX_BOOL bNumbered) { |
| 142 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); | 148 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); |
| 143 if (!pDocLayout) { | 149 if (!pDocLayout) { |
| 144 return; | 150 return; |
| 145 } | 151 } |
| 146 int32_t iPageCount = 0; | 152 int32_t iPageCount = 0; |
| 147 int32_t iPageNum = pDocLayout->CountPages(); | 153 int32_t iPageNum = pDocLayout->CountPages(); |
| 148 if (bNumbered) { | 154 if (bNumbered) { |
| 149 for (int32_t i = 0; i < iPageNum; i++) { | 155 for (int32_t i = 0; i < iPageNum; i++) { |
| 150 CXFA_ContainerLayoutItem* pLayoutPage = pDocLayout->GetPage(i); | 156 CXFA_ContainerLayoutItem* pLayoutPage = pDocLayout->GetPage(i); |
| 151 if (!pLayoutPage) { | 157 if (!pLayoutPage) { |
| 152 continue; | 158 continue; |
| 153 } | 159 } |
| 154 CXFA_Node* pMasterPage = pLayoutPage->GetMasterPage(); | 160 CXFA_Node* pMasterPage = pLayoutPage->GetMasterPage(); |
| 155 if (pMasterPage->GetInteger(XFA_ATTRIBUTE_Numbered)) { | 161 if (pMasterPage->GetInteger(XFA_ATTRIBUTE_Numbered)) { |
| 156 iPageCount++; | 162 iPageCount++; |
| 157 } | 163 } |
| 158 } | 164 } |
| 159 } else { | 165 } else { |
| 160 iPageCount = iPageNum; | 166 iPageCount = iPageNum; |
| 161 } | 167 } |
| 162 CFXJSE_Value* pValue = pArguments->GetReturnValue(); | 168 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
| 163 if (pValue) | 169 if (pValue) |
| 164 pValue->SetInteger(iPageCount); | 170 pValue->SetInteger(iPageCount); |
| 165 } | 171 } |
| 172 |
| 166 void CScript_LayoutPseudoModel::PageCount(CFXJSE_Arguments* pArguments) { | 173 void CScript_LayoutPseudoModel::PageCount(CFXJSE_Arguments* pArguments) { |
| 167 NumberedPageCount(pArguments, TRUE); | 174 NumberedPageCount(pArguments, TRUE); |
| 168 } | 175 } |
| 176 |
| 169 void CScript_LayoutPseudoModel::PageSpan(CFXJSE_Arguments* pArguments) { | 177 void CScript_LayoutPseudoModel::PageSpan(CFXJSE_Arguments* pArguments) { |
| 170 int32_t iLength = pArguments->GetLength(); | 178 int32_t iLength = pArguments->GetLength(); |
| 171 if (iLength != 1) { | 179 if (iLength != 1) { |
| 172 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"pageSpan"); | 180 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"pageSpan"); |
| 173 return; | 181 return; |
| 174 } | 182 } |
| 175 CXFA_Node* pNode = nullptr; | 183 CXFA_Node* pNode = nullptr; |
| 176 if (iLength >= 1) { | 184 if (iLength >= 1) { |
| 177 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); | 185 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
| 178 } | 186 } |
| 179 if (!pNode) { | 187 if (!pNode) { |
| 180 return; | 188 return; |
| 181 } | 189 } |
| 182 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); | 190 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); |
| 183 if (!pDocLayout) { | 191 if (!pDocLayout) { |
| 184 return; | 192 return; |
| 185 } | 193 } |
| 186 CFXJSE_Value* pValue = pArguments->GetReturnValue(); | 194 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
| 187 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); | 195 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); |
| 188 if (!pLayoutItem) { | 196 if (!pLayoutItem) { |
| 189 pValue->SetInteger(-1); | 197 pValue->SetInteger(-1); |
| 190 return; | 198 return; |
| 191 } | 199 } |
| 192 int32_t iLast = pLayoutItem->GetLast()->GetPage()->GetPageIndex(); | 200 int32_t iLast = pLayoutItem->GetLast()->GetPage()->GetPageIndex(); |
| 193 int32_t iFirst = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); | 201 int32_t iFirst = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); |
| 194 int32_t iPageSpan = iLast - iFirst + 1; | 202 int32_t iPageSpan = iLast - iFirst + 1; |
| 195 if (pValue) | 203 if (pValue) |
| 196 pValue->SetInteger(iPageSpan); | 204 pValue->SetInteger(iPageSpan); |
| 197 } | 205 } |
| 206 |
| 198 void CScript_LayoutPseudoModel::Page(CFXJSE_Arguments* pArguments) { | 207 void CScript_LayoutPseudoModel::Page(CFXJSE_Arguments* pArguments) { |
| 199 PageImp(pArguments, FALSE); | 208 PageImp(pArguments, FALSE); |
| 200 } | 209 } |
| 210 |
| 201 void CScript_LayoutPseudoModel::GetObjArray(CXFA_LayoutProcessor* pDocLayout, | 211 void CScript_LayoutPseudoModel::GetObjArray(CXFA_LayoutProcessor* pDocLayout, |
| 202 int32_t iPageNo, | 212 int32_t iPageNo, |
| 203 const CFX_WideString& wsType, | 213 const CFX_WideString& wsType, |
| 204 FX_BOOL bOnPageArea, | 214 FX_BOOL bOnPageArea, |
| 205 CXFA_NodeArray& retArray) { | 215 CXFA_NodeArray& retArray) { |
| 206 CXFA_ContainerLayoutItem* pLayoutPage = pDocLayout->GetPage(iPageNo); | 216 CXFA_ContainerLayoutItem* pLayoutPage = pDocLayout->GetPage(iPageNo); |
| 207 if (!pLayoutPage) { | 217 if (!pLayoutPage) { |
| 208 return; | 218 return; |
| 209 } | 219 } |
| 210 if (wsType == FX_WSTRC(L"pageArea")) { | 220 if (wsType == FX_WSTRC(L"pageArea")) { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 continue; | 332 continue; |
| 323 formItems.insert(pItemChild->m_pFormNode); | 333 formItems.insert(pItemChild->m_pFormNode); |
| 324 retArray.Add(pItemChild->m_pFormNode); | 334 retArray.Add(pItemChild->m_pFormNode); |
| 325 } | 335 } |
| 326 } | 336 } |
| 327 } | 337 } |
| 328 } | 338 } |
| 329 return; | 339 return; |
| 330 } | 340 } |
| 331 } | 341 } |
| 342 |
| 332 void CScript_LayoutPseudoModel::PageContent(CFXJSE_Arguments* pArguments) { | 343 void CScript_LayoutPseudoModel::PageContent(CFXJSE_Arguments* pArguments) { |
| 333 int32_t iLength = pArguments->GetLength(); | 344 int32_t iLength = pArguments->GetLength(); |
| 334 if (iLength < 1 || iLength > 3) { | 345 if (iLength < 1 || iLength > 3) { |
| 335 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"pageContent"); | 346 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"pageContent"); |
| 336 return; | 347 return; |
| 337 } | 348 } |
| 338 int32_t iIndex = 0; | 349 int32_t iIndex = 0; |
| 339 CFX_WideString wsType; | 350 CFX_WideString wsType; |
| 340 FX_BOOL bOnPageArea = FALSE; | 351 FX_BOOL bOnPageArea = FALSE; |
| 341 if (iLength >= 1) { | 352 if (iLength >= 1) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 356 if (!pDocLayout) { | 367 if (!pDocLayout) { |
| 357 return; | 368 return; |
| 358 } | 369 } |
| 359 CXFA_NodeArray retArray; | 370 CXFA_NodeArray retArray; |
| 360 GetObjArray(pDocLayout, iIndex, wsType, bOnPageArea, retArray); | 371 GetObjArray(pDocLayout, iIndex, wsType, bOnPageArea, retArray); |
| 361 CXFA_ArrayNodeList* pArrayNodeList = new CXFA_ArrayNodeList(m_pDocument); | 372 CXFA_ArrayNodeList* pArrayNodeList = new CXFA_ArrayNodeList(m_pDocument); |
| 362 pArrayNodeList->SetArrayNodeList(retArray); | 373 pArrayNodeList->SetArrayNodeList(retArray); |
| 363 pArguments->GetReturnValue()->SetObject( | 374 pArguments->GetReturnValue()->SetObject( |
| 364 pArrayNodeList, m_pDocument->GetScriptContext()->GetJseNormalClass()); | 375 pArrayNodeList, m_pDocument->GetScriptContext()->GetJseNormalClass()); |
| 365 } | 376 } |
| 377 |
| 366 void CScript_LayoutPseudoModel::AbsPageCount(CFXJSE_Arguments* pArguments) { | 378 void CScript_LayoutPseudoModel::AbsPageCount(CFXJSE_Arguments* pArguments) { |
| 367 NumberedPageCount(pArguments, FALSE); | 379 NumberedPageCount(pArguments, FALSE); |
| 368 } | 380 } |
| 381 |
| 369 void CScript_LayoutPseudoModel::AbsPageCountInBatch( | 382 void CScript_LayoutPseudoModel::AbsPageCountInBatch( |
| 370 CFXJSE_Arguments* pArguments) { | 383 CFXJSE_Arguments* pArguments) { |
| 371 CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); | |
| 372 if (!pNotify) { | |
| 373 return; | |
| 374 } | |
| 375 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | |
| 376 int32_t iPageCount = pNotify->GetDocProvider()->AbsPageCountInBatch(hDoc); | |
| 377 CFXJSE_Value* pValue = pArguments->GetReturnValue(); | 384 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
| 378 if (pValue) | 385 if (pValue) |
| 379 pValue->SetInteger(iPageCount); | 386 pValue->SetInteger(0); |
| 380 } | 387 } |
| 388 |
| 381 void CScript_LayoutPseudoModel::SheetCountInBatch( | 389 void CScript_LayoutPseudoModel::SheetCountInBatch( |
| 382 CFXJSE_Arguments* pArguments) { | 390 CFXJSE_Arguments* pArguments) { |
| 383 CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); | |
| 384 if (!pNotify) { | |
| 385 return; | |
| 386 } | |
| 387 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | |
| 388 int32_t iPageCount = pNotify->GetDocProvider()->SheetCountInBatch(hDoc); | |
| 389 CFXJSE_Value* pValue = pArguments->GetReturnValue(); | 391 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
| 390 if (pValue) | 392 if (pValue) |
| 391 pValue->SetInteger(iPageCount); | 393 pValue->SetInteger(0); |
| 392 } | 394 } |
| 395 |
| 393 void CScript_LayoutPseudoModel::Relayout(CFXJSE_Arguments* pArguments) { | 396 void CScript_LayoutPseudoModel::Relayout(CFXJSE_Arguments* pArguments) { |
| 394 CXFA_Node* pRootNode = m_pDocument->GetRoot(); | 397 CXFA_Node* pRootNode = m_pDocument->GetRoot(); |
| 395 CXFA_Node* pFormRoot = pRootNode->GetFirstChildByClass(XFA_Element::Form); | 398 CXFA_Node* pFormRoot = pRootNode->GetFirstChildByClass(XFA_Element::Form); |
| 396 ASSERT(pFormRoot); | 399 ASSERT(pFormRoot); |
| 397 CXFA_Node* pContentRootNode = pFormRoot->GetNodeItem(XFA_NODEITEM_FirstChild); | 400 CXFA_Node* pContentRootNode = pFormRoot->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 398 CXFA_LayoutProcessor* pLayoutProcessor = m_pDocument->GetLayoutProcessor(); | 401 CXFA_LayoutProcessor* pLayoutProcessor = m_pDocument->GetLayoutProcessor(); |
| 399 if (pContentRootNode) { | 402 if (pContentRootNode) { |
| 400 pLayoutProcessor->AddChangedContainer(pContentRootNode); | 403 pLayoutProcessor->AddChangedContainer(pContentRootNode); |
| 401 } | 404 } |
| 402 pLayoutProcessor->SetForceReLayout(TRUE); | 405 pLayoutProcessor->SetForceReLayout(TRUE); |
| 403 } | 406 } |
| 407 |
| 404 void CScript_LayoutPseudoModel::AbsPageSpan(CFXJSE_Arguments* pArguments) { | 408 void CScript_LayoutPseudoModel::AbsPageSpan(CFXJSE_Arguments* pArguments) { |
| 405 PageSpan(pArguments); | 409 PageSpan(pArguments); |
| 406 } | 410 } |
| 411 |
| 407 void CScript_LayoutPseudoModel::AbsPageInBatch(CFXJSE_Arguments* pArguments) { | 412 void CScript_LayoutPseudoModel::AbsPageInBatch(CFXJSE_Arguments* pArguments) { |
| 408 int32_t iLength = pArguments->GetLength(); | 413 if (pArguments->GetLength() != 1) { |
| 409 if (iLength != 1) { | |
| 410 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"absPageInBatch"); | 414 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"absPageInBatch"); |
| 411 return; | 415 return; |
| 412 } | 416 } |
| 413 CXFA_Node* pNode = nullptr; | 417 |
| 414 if (iLength >= 1) { | |
| 415 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); | |
| 416 } | |
| 417 if (!pNode) { | |
| 418 return; | |
| 419 } | |
| 420 CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); | |
| 421 if (!pNotify) { | |
| 422 return; | |
| 423 } | |
| 424 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); | |
| 425 if (!pDocLayout) { | |
| 426 return; | |
| 427 } | |
| 428 CXFA_FFWidget* hWidget = | |
| 429 pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); | |
| 430 if (!hWidget) { | |
| 431 return; | |
| 432 } | |
| 433 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | |
| 434 int32_t iPageCount = pNotify->GetDocProvider()->AbsPageInBatch(hDoc, hWidget); | |
| 435 CFXJSE_Value* pValue = pArguments->GetReturnValue(); | 418 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
| 436 if (pValue) | 419 if (pValue) |
| 437 pValue->SetInteger(iPageCount); | 420 pValue->SetInteger(0); |
| 438 } | 421 } |
| 422 |
| 439 void CScript_LayoutPseudoModel::SheetInBatch(CFXJSE_Arguments* pArguments) { | 423 void CScript_LayoutPseudoModel::SheetInBatch(CFXJSE_Arguments* pArguments) { |
| 440 int32_t iLength = pArguments->GetLength(); | 424 if (pArguments->GetLength() != 1) { |
| 441 if (iLength != 1) { | |
| 442 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sheetInBatch"); | 425 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sheetInBatch"); |
| 443 return; | 426 return; |
| 444 } | 427 } |
| 445 CXFA_Node* pNode = nullptr; | 428 |
| 446 if (iLength >= 1) { | |
| 447 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); | |
| 448 } | |
| 449 if (!pNode) { | |
| 450 return; | |
| 451 } | |
| 452 CXFA_FFNotify* pNotify = m_pDocument->GetNotify(); | |
| 453 if (!pNotify) { | |
| 454 return; | |
| 455 } | |
| 456 CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); | |
| 457 if (!pDocLayout) { | |
| 458 return; | |
| 459 } | |
| 460 CXFA_FFWidget* hWidget = | |
| 461 pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); | |
| 462 if (!hWidget) { | |
| 463 return; | |
| 464 } | |
| 465 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | |
| 466 int32_t iPageCount = pNotify->GetDocProvider()->SheetInBatch(hDoc, hWidget); | |
| 467 CFXJSE_Value* pValue = pArguments->GetReturnValue(); | 429 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
| 468 if (pValue) | 430 if (pValue) |
| 469 pValue->SetInteger(iPageCount); | 431 pValue->SetInteger(0); |
| 470 } | 432 } |
| 433 |
| 471 void CScript_LayoutPseudoModel::Sheet(CFXJSE_Arguments* pArguments) { | 434 void CScript_LayoutPseudoModel::Sheet(CFXJSE_Arguments* pArguments) { |
| 472 PageImp(pArguments, TRUE); | 435 PageImp(pArguments, TRUE); |
| 473 } | 436 } |
| 437 |
| 474 void CScript_LayoutPseudoModel::RelayoutPageArea(CFXJSE_Arguments* pArguments) { | 438 void CScript_LayoutPseudoModel::RelayoutPageArea(CFXJSE_Arguments* pArguments) { |
| 475 } | 439 } |
| 440 |
| 476 void CScript_LayoutPseudoModel::SheetCount(CFXJSE_Arguments* pArguments) { | 441 void CScript_LayoutPseudoModel::SheetCount(CFXJSE_Arguments* pArguments) { |
| 477 NumberedPageCount(pArguments, FALSE); | 442 NumberedPageCount(pArguments, FALSE); |
| 478 } | 443 } |
| 444 |
| 479 void CScript_LayoutPseudoModel::AbsPage(CFXJSE_Arguments* pArguments) { | 445 void CScript_LayoutPseudoModel::AbsPage(CFXJSE_Arguments* pArguments) { |
| 480 PageImp(pArguments, TRUE); | 446 PageImp(pArguments, TRUE); |
| 481 } | 447 } |
| 448 |
| 482 void CScript_LayoutPseudoModel::PageImp(CFXJSE_Arguments* pArguments, | 449 void CScript_LayoutPseudoModel::PageImp(CFXJSE_Arguments* pArguments, |
| 483 FX_BOOL bAbsPage) { | 450 FX_BOOL bAbsPage) { |
| 484 int32_t iLength = pArguments->GetLength(); | 451 int32_t iLength = pArguments->GetLength(); |
| 485 if (iLength != 1) { | 452 if (iLength != 1) { |
| 486 const FX_WCHAR* methodName; | 453 const FX_WCHAR* methodName; |
| 487 if (bAbsPage) { | 454 if (bAbsPage) { |
| 488 methodName = L"absPage"; | 455 methodName = L"absPage"; |
| 489 } else { | 456 } else { |
| 490 methodName = L"page"; | 457 methodName = L"page"; |
| 491 } | 458 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 507 } | 474 } |
| 508 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); | 475 CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); |
| 509 if (!pLayoutItem) { | 476 if (!pLayoutItem) { |
| 510 pValue->SetInteger(-1); | 477 pValue->SetInteger(-1); |
| 511 return; | 478 return; |
| 512 } | 479 } |
| 513 iPage = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); | 480 iPage = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); |
| 514 if (pValue) | 481 if (pValue) |
| 515 pValue->SetInteger(bAbsPage ? iPage : iPage + 1); | 482 pValue->SetInteger(bAbsPage ? iPage : iPage + 1); |
| 516 } | 483 } |
| OLD | NEW |