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_SignaturePseudoModel::Script_SignaturePseudoModel_Clear( CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 1 || iLength > 2) { ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clear"); return; } IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } IXFA_Doc* hDoc = pNotify->GetHDOC(); CXFA_Node* pNode = NULL; FX_BOOL bClear = TRUE; if (iLength >= 1) { pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); } if (iLength >= 2) { bClear = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; } FX_BOOL bFlag = pNotify->GetDocProvider()->Clear(hDoc, pNode, bClear); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetBoolean(hValue, bFlag); } }
void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Sign( CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 3 || iLength > 7) { ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sign"); return; } IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } IXFA_Doc* hDoc = pNotify->GetHDOC(); CXFA_NodeList* pNodeList = NULL; CFX_WideString wsExpression; CFX_WideString wsXMLIdent; if (iLength >= 1) { pNodeList = (CXFA_NodeList*)pArguments->GetObject(0); } if (iLength >= 2) { CFX_ByteString bsExpression = pArguments->GetUTF8String(1); wsExpression = CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); } if (iLength >= 3) { CFX_ByteString bsXMLIdent = pArguments->GetUTF8String(2); wsXMLIdent = CFX_WideString::FromUTF8(bsXMLIdent, bsXMLIdent.GetLength()); } FX_BOOL bSign = pNotify->GetDocProvider()->Sign(hDoc, pNodeList, wsExpression, wsXMLIdent); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetBoolean(hValue, bSign); } }
void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( CFXJSE_Arguments* pArguments) { if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } int32_t iLength = pArguments->GetLength(); if (iLength != 1) { ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"openList"); return; } IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } CXFA_Node* pNode = NULL; if (iLength >= 1) { FXJSE_HVALUE hValue = pArguments->GetValue(0); if (FXJSE_Value_IsObject(hValue)) { pNode = static_cast<CXFA_Node*>(FXJSE_Value_ToObject(hValue, nullptr)); } else if (FXJSE_Value_IsUTF8String(hValue)) { CFX_ByteString bsString; FXJSE_Value_ToUTF8String(hValue, bsString); CFX_WideString wsExpression = CFX_WideString::FromUTF8(bsString, bsString.GetLength()); IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { FXJSE_Value_Release(hValue); return; } CXFA_Object* pObject = pScriptContext->GetThisObject(); if (!pObject) { FXJSE_Value_Release(hValue); return; } FX_DWORD dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resoveNodeRS; int32_t iRet = pScriptContext->ResolveObjects(pObject, wsExpression, resoveNodeRS, dwFlag); if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { FXJSE_Value_Release(hValue); return; } pNode = resoveNodeRS.nodes[0]->AsNode(); } FXJSE_Value_Release(hValue); } IXFA_DocLayout* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; } IXFA_Widget* hWidget = pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode)); if (!hWidget) { return; } pNotify->GetDocProvider()->SetFocusWidget(pNotify->GetHDOC(), hWidget); pNotify->OpenDropDownList(hWidget); }
void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentDateTime( CFXJSE_Arguments* pArguments) { IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } CFX_WideString wsDataTime = pNotify->GetCurrentDateTime(); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsDataTime)); } }
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_HostPseudoModel::Script_HostPseudoModel_GetFocus( CFXJSE_Arguments* pArguments) { IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } CXFA_Node* pNode = pNotify->GetFocusWidgetNode(); if (!pNode) { return; } FXJSE_Value_Set(pArguments->GetReturnValue(), m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); }
void CScript_HostPseudoModel::Script_HostPseudoModel_ResetData( CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 0 || iLength > 1) { ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resetData"); return; } IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } CFX_WideString wsExpression; if (iLength >= 1) { CFX_ByteString bsExpression = pArguments->GetUTF8String(0); wsExpression = CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); } if (wsExpression.IsEmpty()) { pNotify->ResetData(); return; } int32_t iStart = 0; CFX_WideString wsName; CXFA_Node* pNode = NULL; int32_t iExpLength = wsExpression.GetLength(); while (iStart < iExpLength) { iStart = XFA_FilterName(wsExpression, iStart, wsName); IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; } CXFA_Object* pObject = pScriptContext->GetThisObject(); if (!pObject) { return; } FX_DWORD dwFlag = XFA_RESOLVENODE_Children | XFA_RESOLVENODE_Parent | XFA_RESOLVENODE_Siblings; XFA_RESOLVENODE_RS resoveNodeRS; int32_t iRet = pScriptContext->ResolveObjects(pObject, wsName, resoveNodeRS, dwFlag); if (iRet < 1 || !resoveNodeRS.nodes[0]->IsNode()) { continue; } pNode = resoveNodeRS.nodes[0]->AsNode(); pNotify->ResetData(pNode->GetWidgetData()); } if (!pNode) { pNotify->ResetData(); } }
void CScript_HostPseudoModel::Script_HostPseudoModel_PageUp( CFXJSE_Arguments* pArguments) { IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } IXFA_Doc* hDoc = pNotify->GetHDOC(); int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc); int32_t nNewPage = 0; if (nCurPage <= 1) { return; } nNewPage = nCurPage - 1; pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage); }
void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Ready( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } if (bSetting) { ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_READY); return; } int32_t iStatus = pNotify->GetLayoutStatus(); FXJSE_Value_SetBoolean(hValue, iStatus >= 2); }
void CScript_HostPseudoModel::Script_HostPseudoModel_Language( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } if (bSetting) { ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_LANGUAGE); return; } CFX_WideString wsLanguage; pNotify->GetAppProvider()->GetLanguage(wsLanguage); FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsLanguage)); }
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_FoxitAppType( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } if (bSetting) { ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); return; } CFX_WideString wsAppType; pNotify->GetAppProvider()->GetFoxitAppType(wsAppType); FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppType)); }
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_CalculationsEnabled( 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()->SetCalculationsEnabled( hDoc, FXJSE_Value_ToBoolean(hValue)); return; } FX_BOOL bEnabled = pNotify->GetDocProvider()->IsCalculationsEnabled(hDoc); FXJSE_Value_SetBoolean(hValue, bEnabled); }
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_Enumerate( CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength != 0) { ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"enumerate"); return; } IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } IXFA_Doc* hDoc = pNotify->GetHDOC(); CXFA_NodeList* pList = pNotify->GetDocProvider()->Enumerate(hDoc); if (!pList) return; FXJSE_Value_Set(pArguments->GetReturnValue(), m_pDocument->GetScriptContext()->GetJSValueFromMap(pList)); }
void CScript_HostPseudoModel::Script_HostPseudoModel_Variation( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } if (bSetting) { ThrowScriptErrorMessage(XFA_IDS_UNABLE_SET_VARIATION); return; } CFX_WideString wsVariation; pNotify->GetAppProvider()->GetVariation(wsVariation); FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVariation)); }
void CScript_HostPseudoModel::Script_HostPseudoModel_ImportData( CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 0 || iLength > 1) { ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"importData"); return; } IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } CFX_WideString wsFilePath; if (iLength > 0) { CFX_ByteString bsFilePath = pArguments->GetUTF8String(0); wsFilePath = CFX_WideString::FromUTF8(bsFilePath, bsFilePath.GetLength()); } IXFA_Doc* hDoc = pNotify->GetHDOC(); pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath); }
void CScript_HostPseudoModel::Script_HostPseudoModel_Beep( CFXJSE_Arguments* pArguments) { if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } int32_t iLength = pArguments->GetLength(); if (iLength < 0 || iLength > 1) { ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"beep"); return; } IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } FX_DWORD dwType = 4; if (iLength >= 1) { dwType = pArguments->GetInt32(0); } pNotify->GetAppProvider()->Beep(dwType); }
void CScript_EventPseudoModel::Script_EventPseudoModel_Emit( CFXJSE_Arguments* pArguments) { IXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; } CXFA_EventParam* pEventParam = pScriptContext->GetEventParam(); if (!pEventParam) { return; } IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } IXFA_WidgetHandler* pWidgetHandler = pNotify->GetWidgetHandler(); if (!pWidgetHandler) { return; } pWidgetHandler->ProcessEvent(pEventParam->m_pTarget, pEventParam); }
void CScript_HostPseudoModel::Script_HostPseudoModel_PageDown( CFXJSE_Arguments* pArguments) { IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } IXFA_Doc* hDoc = pNotify->GetHDOC(); int32_t nCurPage = pNotify->GetDocProvider()->GetCurrentPage(hDoc); int32_t nPageCount = pNotify->GetDocProvider()->CountPages(hDoc); if (!nPageCount || nCurPage == nPageCount) { return; } int32_t nNewPage = 0; if (nCurPage >= nPageCount) { nNewPage = nPageCount - 1; } else { nNewPage = nCurPage + 1; } pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage); }
void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem) { CXFA_LayoutItem* pNode = pLayoutItem->m_pFirstChild; IXFA_Notify* pNotify = pLayoutItem->m_pFormNode->GetDocument()->GetParser()->GetNotify(); IXFA_DocLayout* pDocLayout = pLayoutItem->m_pFormNode->GetDocument()->GetDocLayout(); while (pNode) { CXFA_LayoutItem* pNext = pNode->m_pNextSibling; pNode->m_pParent = nullptr; pNotify->OnLayoutEvent(pDocLayout, static_cast<CXFA_LayoutItem*>(pNode), XFA_LAYOUTEVENT_ItemRemoving); XFA_ReleaseLayoutItem(pNode); pNode = pNext; } pNotify->OnLayoutEvent(pDocLayout, pLayoutItem, XFA_LAYOUTEVENT_ItemRemoving); if (pLayoutItem->m_pFormNode->GetClassID() == XFA_ELEMENT_PageArea) { pNotify->OnPageEvent(static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem), XFA_PAGEEVENT_PageRemoved); } delete pLayoutItem; }
void CScript_HostPseudoModel::Script_HostPseudoModel_GotoURL( CFXJSE_Arguments* pArguments) { if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } int32_t iLength = pArguments->GetLength(); if (iLength != 1) { ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"gotoURL"); return; } IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } IXFA_Doc* hDoc = pNotify->GetHDOC(); CFX_WideString wsURL; if (iLength >= 1) { CFX_ByteString bsURL = pArguments->GetUTF8String(0); wsURL = CFX_WideString::FromUTF8(bsURL, bsURL.GetLength()); } pNotify->GetDocProvider()->GotoURL(hDoc, wsURL); }
void CScript_HostPseudoModel::Script_HostPseudoModel_Response( CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 1 || iLength > 4) { ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"response"); return; } IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } CFX_WideString wsQuestion; CFX_WideString wsTitle; CFX_WideString wsDefaultAnswer; FX_BOOL bMark = FALSE; if (iLength >= 1) { CFX_ByteString bsQuestion = pArguments->GetUTF8String(0); wsQuestion = CFX_WideString::FromUTF8(bsQuestion, bsQuestion.GetLength()); } if (iLength >= 2) { CFX_ByteString bsTitle = pArguments->GetUTF8String(1); wsTitle = CFX_WideString::FromUTF8(bsTitle, bsTitle.GetLength()); } if (iLength >= 3) { CFX_ByteString bsDefaultAnswer = pArguments->GetUTF8String(2); wsDefaultAnswer = CFX_WideString::FromUTF8(bsDefaultAnswer, bsDefaultAnswer.GetLength()); } if (iLength >= 4) { bMark = pArguments->GetInt32(3) == 0 ? FALSE : TRUE; } CFX_WideString wsAnswer; pNotify->GetAppProvider()->Response(wsAnswer, wsQuestion, wsTitle, wsDefaultAnswer, bMark); FXJSE_HVALUE hValue = pArguments->GetReturnValue(); if (hValue) { FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAnswer)); } }
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); } }
void CScript_HostPseudoModel::Script_HostPseudoModel_Title( FXJSE_HVALUE hValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute) { if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } IXFA_Doc* hDoc = pNotify->GetHDOC(); if (bSetting) { CFX_ByteString bsValue; FXJSE_Value_ToUTF8String(hValue, bsValue); pNotify->GetDocProvider()->SetTitle( hDoc, CFX_WideString::FromUTF8(bsValue, bsValue.GetLength())); return; } CFX_WideString wsTitle; pNotify->GetDocProvider()->GetTitle(hDoc, wsTitle); FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsTitle)); }
void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData( CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 0 || iLength > 2) { ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"exportData"); return; } IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } IXFA_Doc* hDoc = pNotify->GetHDOC(); CFX_WideString wsFilePath; FX_BOOL bXDP = TRUE; if (iLength >= 1) { CFX_ByteString bsFilePath = pArguments->GetUTF8String(0); wsFilePath = CFX_WideString::FromUTF8(bsFilePath, bsFilePath.GetLength()); } if (iLength >= 2) { bXDP = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; } pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath, bXDP); }
void CScript_HostPseudoModel::Script_HostPseudoModel_Print( CFXJSE_Arguments* pArguments) { if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } int32_t iLength = pArguments->GetLength(); if (iLength != 8) { ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"print"); return; } IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; } IXFA_Doc* hDoc = pNotify->GetHDOC(); FX_DWORD dwOptions = 0; FX_BOOL bShowDialog = TRUE; if (iLength >= 1) { bShowDialog = pArguments->GetInt32(0) == 0 ? FALSE : TRUE; } if (bShowDialog) { dwOptions |= XFA_PRINTOPT_ShowDialog; } int32_t nStartPage = 0; if (iLength >= 2) { nStartPage = pArguments->GetInt32(1); } int32_t nEndPage = 0; if (iLength >= 3) { nEndPage = pArguments->GetInt32(2); } FX_BOOL bCanCancel = TRUE; if (iLength >= 4) { bCanCancel = pArguments->GetInt32(3) == 0 ? FALSE : TRUE; } if (bCanCancel) { dwOptions |= XFA_PRINTOPT_CanCancel; } FX_BOOL bShrinkPage = TRUE; if (iLength >= 5) { bShrinkPage = pArguments->GetInt32(4) == 0 ? FALSE : TRUE; } if (bShrinkPage) { dwOptions |= XFA_PRINTOPT_ShrinkPage; } FX_BOOL bAsImage = TRUE; if (iLength >= 6) { bAsImage = pArguments->GetInt32(5) == 0 ? FALSE : TRUE; } if (bAsImage) { dwOptions |= XFA_PRINTOPT_AsImage; } FX_BOOL bReverseOrder = TRUE; if (iLength >= 7) { bAsImage = pArguments->GetInt32(5) == 0 ? FALSE : TRUE; } bReverseOrder = pArguments->GetInt32(6) == 0 ? FALSE : TRUE; if (bReverseOrder) { dwOptions |= XFA_PRINTOPT_ReverseOrder; } FX_BOOL bPrintAnnot = TRUE; if (iLength >= 8) { bPrintAnnot = pArguments->GetInt32(7) == 0 ? FALSE : TRUE; } if (bPrintAnnot) { dwOptions |= XFA_PRINTOPT_PrintAnnot; } pNotify->GetDocProvider()->Print(hDoc, nStartPage, nEndPage, dwOptions); }