void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageSpan( CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength != 1) { ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"pageSpan"); return; } CXFA_Node* pNode = NULL; if (iLength >= 1) { pNode = (CXFA_Node*)pArguments->GetObject(0); } if (!pNode) { return; } IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } FXJSE_HVALUE hValue = pArguments->GetReturnValue(); CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); if (!pLayoutItem) { FXJSE_Value_SetInteger(hValue, -1); return; } int32_t iLast = pLayoutItem->GetLast()->GetPage()->GetPageIndex(); int32_t iFirst = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); int32_t iPageSpan = iLast - iFirst + 1; if (hValue) { FXJSE_Value_SetInteger(hValue, iPageSpan); } }
void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetInBatch( CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength != 1) { ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sheetInBatch"); return; } CXFA_Node* pNode = NULL; if (iLength >= 1) { pNode = (CXFA_Node*)pArguments->GetObject(0); } if (!pNode) { return; } IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } IXFA_Widget* hWidget = pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); if (!hWidget) { return; } IXFA_Doc* hDoc = pNotify->GetHDOC(); int32_t iPageCount = pNotify->GetDocProvider()->SheetInBatch(hDoc, hWidget); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetInteger(hValue, iPageCount); } }
void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_NumberedPageCount( CFXJSE_Arguments* pArguments, FX_BOOL bNumbered) { IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } int32_t iPageCount = 0; int32_t iPageNum = pDocLayout->CountPages(); if (bNumbered) { for (int32_t i = 0; i < iPageNum; i++) { IXFA_LayoutPage* pLayoutPage = pDocLayout->GetPage(i); if (!pLayoutPage) { continue; } CXFA_Node* pMasterPage = pLayoutPage->GetMasterPage(); if (pMasterPage->GetInteger(XFA_ATTRIBUTE_Numbered)) { iPageCount++; } } } else { iPageCount = iPageNum; } FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetInteger(hValue, iPageCount); } }
void Script_EventPseudoModel_InterProperty(FXJSE_HVALUE hValue, int32_t& iValue, FX_BOOL bSetting) { if (bSetting) { iValue = FXJSE_Value_ToInteger(hValue); } else { FXJSE_Value_SetInteger(hValue, iValue); } }
void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentCountInBatch( CFXJSE_Arguments* pArguments) { IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } int32_t iValue = pNotify->GetAppProvider()->GetDocumentCountInBatch(); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetInteger(hValue, iValue); } }
void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetCountInBatch( CFXJSE_Arguments* pArguments) { IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } IXFA_Doc* hDoc = pNotify->GetHDOC(); int32_t iPageCount = pNotify->GetDocProvider()->SheetCountInBatch(hDoc); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetInteger(hValue, iPageCount); } }
void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageImp( CFXJSE_Arguments* pArguments, FX_BOOL bAbsPage) { int32_t iLength = pArguments->GetLength(); if (iLength != 1) { const FX_WCHAR* methodName; if (bAbsPage) { methodName = L"absPage"; } else { methodName = L"page"; } ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, methodName); return; } CXFA_Node* pNode = NULL; if (iLength >= 1) { pNode = (CXFA_Node*)pArguments->GetObject(0); } int32_t iPage = 0; FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (!pNode && hValue) { FXJSE_Value_SetInteger(hValue, iPage); } IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } CXFA_LayoutItem* pLayoutItem = pDocLayout->GetLayoutItem(pNode); if (!pLayoutItem) { FXJSE_Value_SetInteger(hValue, -1); return; } iPage = pLayoutItem->GetFirst()->GetPage()->GetPageIndex(); if (hValue) { FXJSE_Value_SetInteger(hValue, bAbsPage ? iPage : iPage + 1); } }
void CScript_HostPseudoModel::Script_HostPseudoModel_NumPages( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } IXFA_Doc* hDoc = pNotify->GetHDOC(); if (bSetting) { ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_NUMPAGES); return; } int32_t iNumPages = pNotify->GetDocProvider()->CountPages(hDoc); FXJSE_Value_SetInteger(hValue, iNumPages); }
void CScript_HostPseudoModel::Script_HostPseudoModel_MessageBox( CFXJSE_Arguments* pArguments) { if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } int32_t iLength = pArguments->GetLength(); if (iLength < 1 || iLength > 4) { ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"messageBox"); return; } IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } CFX_WideString wsMessage; CFX_WideString bsTitle; FX_DWORD dwMessageType = XFA_MBICON_Error; FX_DWORD dwButtonType = XFA_MB_OK; if (iLength >= 1) { if (!Script_HostPseudoModel_ValidateArgsForMsg(pArguments, 0, wsMessage)) { return; } } if (iLength >= 2) { if (!Script_HostPseudoModel_ValidateArgsForMsg(pArguments, 1, bsTitle)) { return; } } if (iLength >= 3) { dwMessageType = pArguments->GetInt32(2); if (dwMessageType > XFA_MBICON_Status) { dwMessageType = XFA_MBICON_Error; } } if (iLength >= 4) { dwButtonType = pArguments->GetInt32(3); if (dwButtonType > XFA_MB_YesNoCancel) { dwButtonType = XFA_MB_OK; } } int32_t iValue = pNotify->GetAppProvider()->MsgBox( wsMessage, bsTitle, dwMessageType, dwButtonType); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetInteger(hValue, iValue); } }
void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentPage( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } IXFA_Doc* hDoc = pNotify->GetHDOC(); if (bSetting) { pNotify->GetDocProvider()->SetCurrentPage(hDoc, FXJSE_Value_ToInteger(hValue)); return; } int32_t iCurrentPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc); FXJSE_Value_SetInteger(hValue, iCurrentPage); }
void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Verify( CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 1 || iLength > 4) { ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"verify"); return; } IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } IXFA_Doc* hDoc = pNotify->GetHDOC(); CXFA_Node* pNode = NULL; if (iLength >= 1) { pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); } int32_t bVerify = pNotify->GetDocProvider()->Verify(hDoc, pNode); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetInteger(hValue, bVerify); } }