diff options
Diffstat (limited to 'fpdfsdk/javascript/event.cpp')
-rw-r--r-- | fpdfsdk/javascript/event.cpp | 132 |
1 files changed, 63 insertions, 69 deletions
diff --git a/fpdfsdk/javascript/event.cpp b/fpdfsdk/javascript/event.cpp index 9c2e3f490e..34504d5aa4 100644 --- a/fpdfsdk/javascript/event.cpp +++ b/fpdfsdk/javascript/event.cpp @@ -47,61 +47,61 @@ event::event(CJS_Object* pJsObject) : CJS_EmbedObj(pJsObject) {} event::~event() {} bool event::get_change(CJS_Runtime* pRuntime, - CJS_PropValue* vp, + CJS_Value* vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); - vp->Set(pEvent->Change()); + vp->Set(pRuntime, pEvent->Change()); return true; } bool event::set_change(CJS_Runtime* pRuntime, - const CJS_PropValue& vp, + const CJS_Value& vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); - if (vp.GetJSValue()->GetType() == CJS_Value::VT_string) { + if (vp.GetType() == CJS_Value::VT_string) { WideString& wChange = pEvent->Change(); - wChange = vp.ToWideString(); + wChange = vp.ToWideString(pRuntime); } return true; } bool event::get_change_ex(CJS_Runtime* pRuntime, - CJS_PropValue* vp, + CJS_Value* vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); - vp->Set(pEvent->ChangeEx()); + vp->Set(pRuntime, pEvent->ChangeEx()); return true; } bool event::set_change_ex(CJS_Runtime* pRuntime, - const CJS_PropValue& vp, + const CJS_Value& vp, WideString* sError) { return false; } bool event::get_commit_key(CJS_Runtime* pRuntime, - CJS_PropValue* vp, + CJS_Value* vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); - vp->Set(pEvent->CommitKey()); + vp->Set(pRuntime, pEvent->CommitKey()); return true; } bool event::set_commit_key(CJS_Runtime* pRuntime, - const CJS_PropValue& vp, + const CJS_Value& vp, WideString* sError) { return false; } bool event::get_field_full(CJS_Runtime* pRuntime, - CJS_PropValue* vp, + CJS_Value* vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); @@ -109,117 +109,113 @@ bool event::get_field_full(CJS_Runtime* pRuntime, if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0) return false; - vp->Set(pEvent->FieldFull()); + vp->Set(pRuntime, pEvent->FieldFull()); return true; } bool event::set_field_full(CJS_Runtime* pRuntime, - const CJS_PropValue& vp, + const CJS_Value& vp, WideString* sError) { return false; } bool event::get_key_down(CJS_Runtime* pRuntime, - CJS_PropValue* vp, + CJS_Value* vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); - vp->Set(pEvent->KeyDown()); + vp->Set(pRuntime, pEvent->KeyDown()); return true; } bool event::set_key_down(CJS_Runtime* pRuntime, - const CJS_PropValue& vp, + const CJS_Value& vp, WideString* sError) { return false; } bool event::get_modifier(CJS_Runtime* pRuntime, - CJS_PropValue* vp, + CJS_Value* vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); - vp->Set(pEvent->Modifier()); + vp->Set(pRuntime, pEvent->Modifier()); return true; } bool event::set_modifier(CJS_Runtime* pRuntime, - const CJS_PropValue& vp, + const CJS_Value& vp, WideString* sError) { return false; } -bool event::get_name(CJS_Runtime* pRuntime, - CJS_PropValue* vp, - WideString* sError) { +bool event::get_name(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); - vp->Set(pEvent->Name()); + vp->Set(pRuntime, pEvent->Name()); return true; } bool event::set_name(CJS_Runtime* pRuntime, - const CJS_PropValue& vp, + const CJS_Value& vp, WideString* sError) { return false; } -bool event::get_rc(CJS_Runtime* pRuntime, - CJS_PropValue* vp, - WideString* sError) { +bool event::get_rc(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); - vp->Set(pEvent->Rc()); + vp->Set(pRuntime, pEvent->Rc()); return true; } bool event::set_rc(CJS_Runtime* pRuntime, - const CJS_PropValue& vp, + const CJS_Value& vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); - pEvent->Rc() = vp.ToBool(); + pEvent->Rc() = vp.ToBool(pRuntime); return true; } bool event::get_rich_change(CJS_Runtime* pRuntime, - CJS_PropValue* vp, + CJS_Value* vp, WideString* sError) { return true; } bool event::set_rich_change(CJS_Runtime* pRuntime, - const CJS_PropValue& vp, + const CJS_Value& vp, WideString* sError) { return true; } bool event::get_rich_change_ex(CJS_Runtime* pRuntime, - CJS_PropValue* vp, + CJS_Value* vp, WideString* sError) { return true; } bool event::set_rich_change_ex(CJS_Runtime* pRuntime, - const CJS_PropValue& vp, + const CJS_Value& vp, WideString* sError) { return true; } bool event::get_rich_value(CJS_Runtime* pRuntime, - CJS_PropValue* vp, + CJS_Value* vp, WideString* sError) { return true; } bool event::set_rich_value(CJS_Runtime* pRuntime, - const CJS_PropValue& vp, + const CJS_Value& vp, WideString* sError) { return true; } bool event::get_sel_end(CJS_Runtime* pRuntime, - CJS_PropValue* vp, + CJS_Value* vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); @@ -227,12 +223,12 @@ bool event::get_sel_end(CJS_Runtime* pRuntime, if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0) return true; - vp->Set(pEvent->SelEnd()); + vp->Set(pRuntime, pEvent->SelEnd()); return true; } bool event::set_sel_end(CJS_Runtime* pRuntime, - const CJS_PropValue& vp, + const CJS_Value& vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); @@ -240,12 +236,12 @@ bool event::set_sel_end(CJS_Runtime* pRuntime, if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0) return true; - pEvent->SelEnd() = vp.ToInt(); + pEvent->SelEnd() = vp.ToInt(pRuntime); return true; } bool event::get_sel_start(CJS_Runtime* pRuntime, - CJS_PropValue* vp, + CJS_Value* vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); @@ -253,12 +249,12 @@ bool event::get_sel_start(CJS_Runtime* pRuntime, if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0) return true; - vp->Set(pEvent->SelStart()); + vp->Set(pRuntime, pEvent->SelStart()); return true; } bool event::set_sel_start(CJS_Runtime* pRuntime, - const CJS_PropValue& vp, + const CJS_Value& vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); @@ -266,87 +262,85 @@ bool event::set_sel_start(CJS_Runtime* pRuntime, if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0) return true; - pEvent->SelStart() = vp.ToInt(); + pEvent->SelStart() = vp.ToInt(pRuntime); return true; } bool event::get_shift(CJS_Runtime* pRuntime, - CJS_PropValue* vp, + CJS_Value* vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); - vp->Set(pEvent->Shift()); + vp->Set(pRuntime, pEvent->Shift()); return true; } bool event::set_shift(CJS_Runtime* pRuntime, - const CJS_PropValue& vp, + const CJS_Value& vp, WideString* sError) { return false; } bool event::get_source(CJS_Runtime* pRuntime, - CJS_PropValue* vp, + CJS_Value* vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); - vp->Set(pEvent->Source()->GetJSObject()); + vp->Set(pRuntime, pEvent->Source()->GetJSObject()); return true; } bool event::set_source(CJS_Runtime* pRuntime, - const CJS_PropValue& vp, + const CJS_Value& vp, WideString* sError) { return false; } bool event::get_target(CJS_Runtime* pRuntime, - CJS_PropValue* vp, + CJS_Value* vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); - vp->Set(pEvent->Target_Field()->GetJSObject()); + vp->Set(pRuntime, pEvent->Target_Field()->GetJSObject()); return true; } bool event::set_target(CJS_Runtime* pRuntime, - const CJS_PropValue& vp, + const CJS_Value& vp, WideString* sError) { return false; } bool event::get_target_name(CJS_Runtime* pRuntime, - CJS_PropValue* vp, + CJS_Value* vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); - vp->Set(pEvent->TargetName()); + vp->Set(pRuntime, pEvent->TargetName()); return true; } bool event::set_target_name(CJS_Runtime* pRuntime, - const CJS_PropValue& vp, + const CJS_Value& vp, WideString* sError) { return false; } -bool event::get_type(CJS_Runtime* pRuntime, - CJS_PropValue* vp, - WideString* sError) { +bool event::get_type(CJS_Runtime* pRuntime, CJS_Value* vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); - vp->Set(pEvent->Type()); + vp->Set(pRuntime, pEvent->Type()); return true; } bool event::set_type(CJS_Runtime* pRuntime, - const CJS_PropValue& vp, + const CJS_Value& vp, WideString* sError) { return false; } bool event::get_value(CJS_Runtime* pRuntime, - CJS_PropValue* vp, + CJS_Value* vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); @@ -357,12 +351,12 @@ bool event::get_value(CJS_Runtime* pRuntime, if (!pEvent->m_pValue) return false; - vp->Set(pEvent->Value()); + vp->Set(pRuntime, pEvent->Value()); return true; } bool event::set_value(CJS_Runtime* pRuntime, - const CJS_PropValue& vp, + const CJS_Value& vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); @@ -373,21 +367,21 @@ bool event::set_value(CJS_Runtime* pRuntime, if (!pEvent->m_pValue) return false; - pEvent->Value() = vp.ToWideString(); + pEvent->Value() = vp.ToWideString(pRuntime); return true; } bool event::get_will_commit(CJS_Runtime* pRuntime, - CJS_PropValue* vp, + CJS_Value* vp, WideString* sError) { CJS_EventHandler* pEvent = pRuntime->GetCurrentEventContext()->GetEventHandler(); - vp->Set(pEvent->WillCommit()); + vp->Set(pRuntime, pEvent->WillCommit()); return true; } bool event::set_will_commit(CJS_Runtime* pRuntime, - const CJS_PropValue& vp, + const CJS_Value& vp, WideString* sError) { return false; } |