diff options
Diffstat (limited to 'fxjs/cjx_hostpseudomodel.cpp')
-rw-r--r-- | fxjs/cjx_hostpseudomodel.cpp | 63 |
1 files changed, 36 insertions, 27 deletions
diff --git a/fxjs/cjx_hostpseudomodel.cpp b/fxjs/cjx_hostpseudomodel.cpp index 8838c891d9..6e0f2f83cb 100644 --- a/fxjs/cjx_hostpseudomodel.cpp +++ b/fxjs/cjx_hostpseudomodel.cpp @@ -49,8 +49,28 @@ int32_t FilterName(const WideStringView& wsExpression, } // namespace +const CJX_MethodSpec CJX_HostPseudoModel::MethodSpecs[] = { + {"beep", beep_static}, + {"documentCountInBatch", documentCountInBatch_static}, + {"documentInBatch", documentInBatch_static}, + {"exportData", exportData_static}, + {"getFocus", getFocus_static}, + {"gotoURL", gotoURL_static}, + {"importData", importData_static}, + {"messageBox", messageBox_static}, + {"openList", openList_static}, + {"pageDown", pageDown_static}, + {"pageUp", pageUp_static}, + {"print", print_static}, + {"resetData", resetData_static}, + {"response", response_static}, + {"setFocus", setFocus_static}, + {"", nullptr}}; + CJX_HostPseudoModel::CJX_HostPseudoModel(CScript_HostPseudoModel* model) - : CJX_Object(model) {} + : CJX_Object(model) { + DefineMethods(MethodSpecs); +} CJX_HostPseudoModel::~CJX_HostPseudoModel() {} @@ -229,7 +249,7 @@ void CJX_HostPseudoModel::Name(CFXJSE_Value* pValue, pNotify->GetAppProvider()->GetAppName().UTF8Encode().AsStringView()); } -void CJX_HostPseudoModel::GotoURL(CFXJSE_Arguments* pArguments) { +void CJX_HostPseudoModel::gotoURL(CFXJSE_Arguments* pArguments) { if (!GetDocument()->GetScriptContext()->IsRunAtClient()) return; @@ -252,7 +272,7 @@ void CJX_HostPseudoModel::GotoURL(CFXJSE_Arguments* pArguments) { pNotify->GetDocEnvironment()->GotoURL(hDoc, wsURL); } -void CJX_HostPseudoModel::OpenList(CFXJSE_Arguments* pArguments) { +void CJX_HostPseudoModel::openList(CFXJSE_Arguments* pArguments) { if (!GetDocument()->GetScriptContext()->IsRunAtClient()) return; @@ -306,7 +326,7 @@ void CJX_HostPseudoModel::OpenList(CFXJSE_Arguments* pArguments) { pNotify->OpenDropDownList(hWidget); } -void CJX_HostPseudoModel::Response(CFXJSE_Arguments* pArguments) { +void CJX_HostPseudoModel::response(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 1 || iLength > 4) { ThrowParamCountMismatchException(L"response"); @@ -344,12 +364,12 @@ void CJX_HostPseudoModel::Response(CFXJSE_Arguments* pArguments) { pValue->SetString(wsAnswer.UTF8Encode().AsStringView()); } -void CJX_HostPseudoModel::DocumentInBatch(CFXJSE_Arguments* pArguments) { +void CJX_HostPseudoModel::documentInBatch(CFXJSE_Arguments* pArguments) { if (CFXJSE_Value* pValue = pArguments->GetReturnValue()) pValue->SetInteger(0); } -void CJX_HostPseudoModel::ResetData(CFXJSE_Arguments* pArguments) { +void CJX_HostPseudoModel::resetData(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 0 || iLength > 1) { ThrowParamCountMismatchException(L"resetData"); @@ -399,7 +419,7 @@ void CJX_HostPseudoModel::ResetData(CFXJSE_Arguments* pArguments) { pNotify->ResetData(); } -void CJX_HostPseudoModel::Beep(CFXJSE_Arguments* pArguments) { +void CJX_HostPseudoModel::beep(CFXJSE_Arguments* pArguments) { if (!GetDocument()->GetScriptContext()->IsRunAtClient()) return; @@ -420,7 +440,7 @@ void CJX_HostPseudoModel::Beep(CFXJSE_Arguments* pArguments) { pNotify->GetAppProvider()->Beep(dwType); } -void CJX_HostPseudoModel::SetFocus(CFXJSE_Arguments* pArguments) { +void CJX_HostPseudoModel::setFocus(CFXJSE_Arguments* pArguments) { if (!GetDocument()->GetScriptContext()->IsRunAtClient()) return; @@ -463,7 +483,7 @@ void CJX_HostPseudoModel::SetFocus(CFXJSE_Arguments* pArguments) { pNotify->SetFocusWidgetNode(pNode); } -void CJX_HostPseudoModel::GetFocus(CFXJSE_Arguments* pArguments) { +void CJX_HostPseudoModel::getFocus(CFXJSE_Arguments* pArguments) { CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) return; @@ -476,7 +496,7 @@ void CJX_HostPseudoModel::GetFocus(CFXJSE_Arguments* pArguments) { GetDocument()->GetScriptContext()->GetJSValueFromMap(pNode)); } -void CJX_HostPseudoModel::MessageBox(CFXJSE_Arguments* pArguments) { +void CJX_HostPseudoModel::messageBox(CFXJSE_Arguments* pArguments) { if (!GetDocument()->GetScriptContext()->IsRunAtClient()) return; @@ -541,12 +561,12 @@ bool CJX_HostPseudoModel::ValidateArgsForMsg(CFXJSE_Arguments* pArguments, return true; } -void CJX_HostPseudoModel::DocumentCountInBatch(CFXJSE_Arguments* pArguments) { +void CJX_HostPseudoModel::documentCountInBatch(CFXJSE_Arguments* pArguments) { if (CFXJSE_Value* pValue = pArguments->GetReturnValue()) pValue->SetInteger(0); } -void CJX_HostPseudoModel::Print(CFXJSE_Arguments* pArguments) { +void CJX_HostPseudoModel::print(CFXJSE_Arguments* pArguments) { if (!GetDocument()->GetScriptContext()->IsRunAtClient()) return; @@ -611,7 +631,7 @@ void CJX_HostPseudoModel::Print(CFXJSE_Arguments* pArguments) { pNotify->GetDocEnvironment()->Print(hDoc, nStartPage, nEndPage, dwOptions); } -void CJX_HostPseudoModel::ImportData(CFXJSE_Arguments* pArguments) { +void CJX_HostPseudoModel::importData(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 0 || iLength > 1) { ThrowParamCountMismatchException(L"importData"); @@ -620,7 +640,7 @@ void CJX_HostPseudoModel::ImportData(CFXJSE_Arguments* pArguments) { // Not implemented. } -void CJX_HostPseudoModel::ExportData(CFXJSE_Arguments* pArguments) { +void CJX_HostPseudoModel::exportData(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 0 || iLength > 2) { ThrowParamCountMismatchException(L"exportData"); @@ -644,7 +664,7 @@ void CJX_HostPseudoModel::ExportData(CFXJSE_Arguments* pArguments) { pNotify->GetDocEnvironment()->ExportData(hDoc, wsFilePath, bXDP); } -void CJX_HostPseudoModel::PageUp(CFXJSE_Arguments* pArguments) { +void CJX_HostPseudoModel::pageUp(CFXJSE_Arguments* pArguments) { CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) return; @@ -659,7 +679,7 @@ void CJX_HostPseudoModel::PageUp(CFXJSE_Arguments* pArguments) { pNotify->GetDocEnvironment()->SetCurrentPage(hDoc, nNewPage); } -void CJX_HostPseudoModel::PageDown(CFXJSE_Arguments* pArguments) { +void CJX_HostPseudoModel::pageDown(CFXJSE_Arguments* pArguments) { CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); if (!pNotify) return; @@ -678,14 +698,3 @@ void CJX_HostPseudoModel::PageDown(CFXJSE_Arguments* pArguments) { pNotify->GetDocEnvironment()->SetCurrentPage(hDoc, nNewPage); } - -void CJX_HostPseudoModel::CurrentDateTime(CFXJSE_Arguments* pArguments) { - CXFA_FFNotify* pNotify = GetDocument()->GetNotify(); - if (!pNotify) - return; - - WideString wsDataTime = pNotify->GetCurrentDateTime(); - CFXJSE_Value* pValue = pArguments->GetReturnValue(); - if (pValue) - pValue->SetString(wsDataTime.UTF8Encode().AsStringView()); -} |