From d1cf239fa6be42baa02028efd1617d5af27d82e1 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Mon, 11 Jul 2016 06:46:59 -0700 Subject: Cleanup redundant method names. This CL cleans up a bunch of method names which are redundant with the class names or code location. Review-Url: https://codereview.chromium.org/2132513003 --- xfa/fxfa/app/xfa_ffpageview.cpp | 21 +- xfa/fxfa/parser/cxfa_widgetdata.cpp | 138 +++++++- xfa/fxfa/parser/xfa_basic_data_element_script.cpp | 361 +++++++++------------ xfa/fxfa/parser/xfa_script_datawindow.cpp | 40 +-- xfa/fxfa/parser/xfa_script_datawindow.h | 34 +- xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp | 286 ++++++++-------- xfa/fxfa/parser/xfa_script_eventpseudomodel.h | 96 +++--- xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp | 158 ++++----- xfa/fxfa/parser/xfa_script_hostpseudomodel.h | 128 ++++---- xfa/fxfa/parser/xfa_script_imp.cpp | 37 +-- xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp | 114 +++---- xfa/fxfa/parser/xfa_script_layoutpseudomodel.h | 64 ++-- xfa/fxfa/parser/xfa_script_logpseudomodel.cpp | 15 +- xfa/fxfa/parser/xfa_script_logpseudomodel.h | 10 +- xfa/fxfa/parser/xfa_script_nodehelper.cpp | 131 ++++---- xfa/fxfa/parser/xfa_script_nodehelper.h | 69 ++-- xfa/fxfa/parser/xfa_script_resolveprocessor.cpp | 182 +++++------ xfa/fxfa/parser/xfa_script_resolveprocessor.h | 66 ++-- .../parser/xfa_script_signaturepseudomodel.cpp | 12 +- xfa/fxfa/parser/xfa_script_signaturepseudomodel.h | 10 +- xfa/fxfa/parser/xfa_utils.h | 4 - xfa/fxfa/parser/xfa_utils_imp.cpp | 316 +++++------------- 22 files changed, 1056 insertions(+), 1236 deletions(-) diff --git a/xfa/fxfa/app/xfa_ffpageview.cpp b/xfa/fxfa/app/xfa_ffpageview.cpp index 54c262faac..c1417c72a4 100644 --- a/xfa/fxfa/app/xfa_ffpageview.cpp +++ b/xfa/fxfa/app/xfa_ffpageview.cpp @@ -91,6 +91,24 @@ bool PageWidgetFilter(CXFA_FFWidget* pWidget, return (dwFilter & dwStatus) == dwFilter; } +bool IsLayoutElement(XFA_Element eElement, bool bLayoutContainer) { + switch (eElement) { + case XFA_Element::Draw: + case XFA_Element::Field: + case XFA_Element::InstanceManager: + return !bLayoutContainer; + case XFA_Element::Area: + case XFA_Element::Subform: + case XFA_Element::ExclGroup: + case XFA_Element::SubformSet: + case XFA_Element::PageArea: + case XFA_Element::Form: + return true; + default: + return false; + } +} + } // namespace CXFA_FFPageView::CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea) @@ -373,8 +391,7 @@ void CXFA_FFTabOrderPageWidgetIterator::OrderContainer( CXFA_TabParam* pParam = new CXFA_TabParam; pParam->m_pWidget = hWidget; tabParams.Add(pParam); - if (XFA_IsLayoutElement(pSearchItem->GetFormNode()->GetElementType(), - TRUE)) { + if (IsLayoutElement(pSearchItem->GetFormNode()->GetElementType(), true)) { OrderContainer(sIterator, pSearchItem, pParam, bCurrentItem, bContentArea, bMarsterPage); } diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index 1dd78e198f..f372c51f2c 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -70,6 +70,142 @@ FX_BOOL SplitDateTime(const CFX_WideString& wsDateTime, return TRUE; } +CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { + XFA_Element eType = pNode->GetElementType(); + eWidgetType = eType; + if (eType != XFA_Element::Field && eType != XFA_Element::Draw) + return nullptr; + + eWidgetType = XFA_Element::Unknown; + XFA_Element eUIType = XFA_Element::Unknown; + CXFA_Value defValue(pNode->GetProperty(0, XFA_Element::Value, TRUE)); + XFA_Element eValueType = defValue.GetChildValueClassID(); + switch (eValueType) { + case XFA_Element::Boolean: + eUIType = XFA_Element::CheckButton; + break; + case XFA_Element::Integer: + case XFA_Element::Decimal: + case XFA_Element::Float: + eUIType = XFA_Element::NumericEdit; + break; + case XFA_Element::ExData: + case XFA_Element::Text: + eUIType = XFA_Element::TextEdit; + eWidgetType = XFA_Element::Text; + break; + case XFA_Element::Date: + case XFA_Element::Time: + case XFA_Element::DateTime: + eUIType = XFA_Element::DateTimeEdit; + break; + case XFA_Element::Image: + eUIType = XFA_Element::ImageEdit; + eWidgetType = XFA_Element::Image; + break; + case XFA_Element::Arc: + case XFA_Element::Line: + case XFA_Element::Rectangle: + eUIType = XFA_Element::DefaultUi; + eWidgetType = eValueType; + break; + default: + break; + } + + CXFA_Node* pUIChild = nullptr; + CXFA_Node* pUI = pNode->GetProperty(0, XFA_Element::Ui, TRUE); + CXFA_Node* pChild = pUI->GetNodeItem(XFA_NODEITEM_FirstChild); + for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { + XFA_Element eChildType = pChild->GetElementType(); + if (eChildType == XFA_Element::Extras || + eChildType == XFA_Element::Picture) { + continue; + } + const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( + XFA_Element::Ui, eChildType, XFA_XDPPACKET_Form); + if (pProperty && (pProperty->uFlags & XFA_PROPERTYFLAG_OneOf)) { + pUIChild = pChild; + break; + } + } + + if (eType == XFA_Element::Draw) { + XFA_Element eDraw = + pUIChild ? pUIChild->GetElementType() : XFA_Element::Unknown; + switch (eDraw) { + case XFA_Element::TextEdit: + eWidgetType = XFA_Element::Text; + break; + case XFA_Element::ImageEdit: + eWidgetType = XFA_Element::Image; + break; + default: + eWidgetType = eWidgetType == XFA_Element::Unknown ? XFA_Element::Text + : eWidgetType; + break; + } + } else { + if (pUIChild && pUIChild->GetElementType() == XFA_Element::DefaultUi) { + eWidgetType = XFA_Element::TextEdit; + } else { + eWidgetType = + pUIChild ? pUIChild->GetElementType() + : (eUIType == XFA_Element::Unknown ? XFA_Element::TextEdit + : eUIType); + } + } + + if (!pUIChild) { + if (eUIType == XFA_Element::Unknown) { + eUIType = XFA_Element::TextEdit; + defValue.GetNode()->GetProperty(0, XFA_Element::Text, TRUE); + } + return pUI->GetProperty(0, eUIType, TRUE); + } + + if (eUIType != XFA_Element::Unknown) + return pUIChild; + + switch (pUIChild->GetElementType()) { + case XFA_Element::CheckButton: { + eValueType = XFA_Element::Text; + if (CXFA_Node* pItems = pNode->GetChild(0, XFA_Element::Items)) { + if (CXFA_Node* pItem = pItems->GetChild(0, XFA_Element::Unknown)) + eValueType = pItem->GetElementType(); + } + break; + } + case XFA_Element::DateTimeEdit: + eValueType = XFA_Element::DateTime; + break; + case XFA_Element::ImageEdit: + eValueType = XFA_Element::Image; + break; + case XFA_Element::NumericEdit: + eValueType = XFA_Element::Float; + break; + case XFA_Element::ChoiceList: { + eValueType = (pUIChild->GetEnum(XFA_ATTRIBUTE_Open) == + XFA_ATTRIBUTEENUM_MultiSelect) + ? XFA_Element::ExData + : XFA_Element::Text; + break; + } + case XFA_Element::Barcode: + case XFA_Element::Button: + case XFA_Element::PasswordEdit: + case XFA_Element::Signature: + case XFA_Element::TextEdit: + default: + eValueType = XFA_Element::Text; + break; + } + defValue.GetNode()->GetProperty(0, eValueType, TRUE); + + return pUIChild; +} + } // namespace CXFA_WidgetData::CXFA_WidgetData(CXFA_Node* pNode) @@ -81,7 +217,7 @@ CXFA_WidgetData::CXFA_WidgetData(CXFA_Node* pNode) CXFA_Node* CXFA_WidgetData::GetUIChild() { if (m_eUIType == XFA_Element::Unknown) - m_pUiChildNode = XFA_CreateUIChild(m_pNode, m_eUIType); + m_pUiChildNode = CreateUIChild(m_pNode, m_eUIType); return m_pUiChildNode; } diff --git a/xfa/fxfa/parser/xfa_basic_data_element_script.cpp b/xfa/fxfa/parser/xfa_basic_data_element_script.cpp index f603bfaabb..0d1f7c8b02 100644 --- a/xfa/fxfa/parser/xfa_basic_data_element_script.cpp +++ b/xfa/fxfa/parser/xfa_basic_data_element_script.cpp @@ -126,15 +126,14 @@ const XFA_SCRIPTHIERARCHY g_XFAScriptIndex[] = { }; const XFA_METHODINFO g_SomMethodData[] = { - {0x3c752495, L"verify", (XFA_METHOD_CALLBACK)&CScript_SignaturePseudoModel:: - Script_SignaturePseudoModel_Verify}, - {0xa68635f1, L"sign", (XFA_METHOD_CALLBACK)&CScript_SignaturePseudoModel:: - Script_SignaturePseudoModel_Sign}, + {0x3c752495, L"verify", + (XFA_METHOD_CALLBACK)&CScript_SignaturePseudoModel::Verify}, + {0xa68635f1, L"sign", + (XFA_METHOD_CALLBACK)&CScript_SignaturePseudoModel::Sign}, {0xa7f2c5e6, L"enumerate", - (XFA_METHOD_CALLBACK)&CScript_SignaturePseudoModel:: - Script_SignaturePseudoModel_Enumerate}, - {0xd8ed1467, L"clear", (XFA_METHOD_CALLBACK)&CScript_SignaturePseudoModel:: - Script_SignaturePseudoModel_Clear}, + (XFA_METHOD_CALLBACK)&CScript_SignaturePseudoModel::Enumerate}, + {0xd8ed1467, L"clear", + (XFA_METHOD_CALLBACK)&CScript_SignaturePseudoModel::Clear}, {0x4bdcce13, L"execute", (XFA_METHOD_CALLBACK)&CXFA_Node::Script_WsdlConnection_Execute}, {0x1c296ba4, L"restore", @@ -165,10 +164,9 @@ const XFA_METHODINFO g_SomMethodData[] = { (XFA_METHOD_CALLBACK)&CXFA_Node::Script_Field_AddItem}, {0xef8ce48f, L"execValidate", (XFA_METHOD_CALLBACK)&CXFA_Node::Script_Field_ExecValidate}, - {0x461079ef, L"emit", (XFA_METHOD_CALLBACK)&CScript_EventPseudoModel:: - Script_EventPseudoModel_Emit}, - {0xfec90c63, L"reset", (XFA_METHOD_CALLBACK)&CScript_EventPseudoModel:: - Script_EventPseudoModel_Reset}, + {0x461079ef, L"emit", (XFA_METHOD_CALLBACK)&CScript_EventPseudoModel::Emit}, + {0xfec90c63, L"reset", + (XFA_METHOD_CALLBACK)&CScript_EventPseudoModel::Reset}, {0xfb0b007, L"execEvent", (XFA_METHOD_CALLBACK)&CXFA_Node::Script_ExclGroup_ExecEvent}, {0x3d832221, L"selectedMember", @@ -189,88 +187,71 @@ const XFA_METHODINFO g_SomMethodData[] = { (XFA_METHOD_CALLBACK)&CXFA_Node::Script_Subform_GetInvalidObjects}, {0xef8ce48f, L"execValidate", (XFA_METHOD_CALLBACK)&CXFA_Node::Script_Subform_ExecValidate}, - {0xa366b7c, L"exportData", (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_ExportData}, - {0x16cc226c, L"gotoURL", (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_GotoURL}, - {0x1e0722f5, L"pageDown", (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_PageDown}, - {0x3e66cb2c, L"setFocus", (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_SetFocus}, - {0x4ac9faae, L"openList", (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_OpenList}, - {0x7b89714f, L"response", (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_Response}, + {0xa366b7c, L"exportData", + (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel::ExportData}, + {0x16cc226c, L"gotoURL", + (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel::GotoURL}, + {0x1e0722f5, L"pageDown", + (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel::PageDown}, + {0x3e66cb2c, L"setFocus", + (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel::SetFocus}, + {0x4ac9faae, L"openList", + (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel::OpenList}, + {0x7b89714f, L"response", + (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel::Response}, {0x7fd9fd58, L"documentInBatch", - (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_DocumentInBatch}, - {0xaf1d019d, L"resetData", (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_ResetData}, - {0xb07be13c, L"beep", (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_Beep}, - {0xb1882ca0, L"getFocus", (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_GetFocus}, - {0xbf4ba9ee, L"messageBox", (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_MessageBox}, + (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel::DocumentInBatch}, + {0xaf1d019d, L"resetData", + (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel::ResetData}, + {0xb07be13c, L"beep", (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel::Beep}, + {0xb1882ca0, L"getFocus", + (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel::GetFocus}, + {0xbf4ba9ee, L"messageBox", + (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel::MessageBox}, {0xd6d4dbc1, L"documentCountInBatch", - (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_DocumentCountInBatch}, - {0xdd7676ed, L"print", (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_Print}, + (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel::DocumentCountInBatch}, + {0xdd7676ed, L"print", + (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel::Print}, {0xe2f863d0, L"currentDateTime", - (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_CurrentDateTime}, - {0xf995d0f5, L"importData", (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_ImportData}, - {0xfeb96b62, L"pageUp", (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_PageUp}, - {0x68, L"h", (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel:: - Script_LayoutPseudoModel_H}, - {0x77, L"w", (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel:: - Script_LayoutPseudoModel_W}, - {0x78, L"x", (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel:: - Script_LayoutPseudoModel_X}, - {0x79, L"y", (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel:: - Script_LayoutPseudoModel_Y}, - {0x5460206, L"pageCount", (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel:: - Script_LayoutPseudoModel_PageCount}, - {0x5eb5b0f, L"pageSpan", (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel:: - Script_LayoutPseudoModel_PageSpan}, - {0x10f1b1bd, L"page", (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel:: - Script_LayoutPseudoModel_Page}, + (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel::CurrentDateTime}, + {0xf995d0f5, L"importData", + (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel::ImportData}, + {0xfeb96b62, L"pageUp", + (XFA_METHOD_CALLBACK)&CScript_HostPseudoModel::PageUp}, + {0x68, L"h", (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel::H}, + {0x77, L"w", (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel::W}, + {0x78, L"x", (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel::X}, + {0x79, L"y", (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel::Y}, + {0x5460206, L"pageCount", + (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel::PageCount}, + {0x5eb5b0f, L"pageSpan", + (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel::PageSpan}, + {0x10f1b1bd, L"page", + (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel::Page}, {0x1c1e6318, L"pageContent", - (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel:: - Script_LayoutPseudoModel_PageContent}, + (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel::PageContent}, {0x1c1f4a5c, L"absPageCount", - (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel:: - Script_LayoutPseudoModel_AbsPageCount}, + (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel::AbsPageCount}, {0x1ec47db5, L"absPageCountInBatch", - (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel:: - Script_LayoutPseudoModel_AbsPageCountInBatch}, + (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel::AbsPageCountInBatch}, {0x2e4ecbdb, L"sheetCountInBatch", - (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel:: - Script_LayoutPseudoModel_SheetCountInBatch}, - {0x2fcff4b5, L"relayout", (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel:: - Script_LayoutPseudoModel_Relayout}, + (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel::SheetCountInBatch}, + {0x2fcff4b5, L"relayout", + (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel::Relayout}, {0x3bf1c2a5, L"absPageSpan", - (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel:: - Script_LayoutPseudoModel_AbsPageSpan}, + (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel::AbsPageSpan}, {0x5775c2cc, L"absPageInBatch", - (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel:: - Script_LayoutPseudoModel_AbsPageInBatch}, + (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel::AbsPageInBatch}, {0x8c5feb32, L"sheetInBatch", - (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel:: - Script_LayoutPseudoModel_SheetInBatch}, - {0x8f3a8379, L"sheet", (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel:: - Script_LayoutPseudoModel_Sheet}, + (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel::SheetInBatch}, + {0x8f3a8379, L"sheet", + (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel::Sheet}, {0x96f3c4cb, L"relayoutPageArea", - (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel:: - Script_LayoutPseudoModel_RelayoutPageArea}, + (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel::RelayoutPageArea}, {0xd2a4a542, L"sheetCount", - (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel:: - Script_LayoutPseudoModel_SheetCount}, - {0xe74f0653, L"absPage", (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel:: - Script_LayoutPseudoModel_AbsPage}, + (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel::SheetCount}, + {0xe74f0653, L"absPage", + (XFA_METHOD_CALLBACK)&CScript_LayoutPseudoModel::AbsPage}, {0x44c352ad, L"formNodes", (XFA_METHOD_CALLBACK)&CXFA_Node::Script_Template_FormNodes}, {0x45efb847, L"remerge", @@ -286,14 +267,12 @@ const XFA_METHODINFO g_SomMethodData[] = { {0xef8ce48f, L"execValidate", (XFA_METHOD_CALLBACK)&CXFA_Node::Script_Template_ExecValidate}, {0x4cc1c0f9, L"moveCurrentRecord", - (XFA_METHOD_CALLBACK)&CScript_DataWindow:: - Script_DataWindow_MoveCurrentRecord}, - {0x5779d65f, L"record", - (XFA_METHOD_CALLBACK)&CScript_DataWindow::Script_DataWindow_Record}, + (XFA_METHOD_CALLBACK)&CScript_DataWindow::MoveCurrentRecord}, + {0x5779d65f, L"record", (XFA_METHOD_CALLBACK)&CScript_DataWindow::Record}, {0x8a476498, L"gotoRecord", - (XFA_METHOD_CALLBACK)&CScript_DataWindow::Script_DataWindow_GotoRecord}, + (XFA_METHOD_CALLBACK)&CScript_DataWindow::GotoRecord}, {0xaac241c8, L"isRecordGroup", - (XFA_METHOD_CALLBACK)&CScript_DataWindow::Script_DataWindow_IsRecordGroup}, + (XFA_METHOD_CALLBACK)&CScript_DataWindow::IsRecordGroup}, {0x1c6f4277, L"evaluate", (XFA_METHOD_CALLBACK)&CXFA_Node::Script_Manifest_Evaluate}, {0x2afec2cc, L"moveInstance", @@ -320,18 +299,15 @@ const XFA_METHODINFO g_SomMethodData[] = { (XFA_METHOD_CALLBACK)&CXFA_Node::Script_Form_ExecCalculate}, {0xef8ce48f, L"execValidate", (XFA_METHOD_CALLBACK)&CXFA_Node::Script_Form_ExecValidate}, - {0x60490a85, L"message", (XFA_METHOD_CALLBACK)&CScript_LogPseudoModel:: - Script_LogPseudoModel_Message}, + {0x60490a85, L"message", + (XFA_METHOD_CALLBACK)&CScript_LogPseudoModel::Message}, {0x60ecfcc9, L"traceDeactivate", - (XFA_METHOD_CALLBACK)&CScript_LogPseudoModel:: - Script_LogPseudoModel_TraceDeactivate}, + (XFA_METHOD_CALLBACK)&CScript_LogPseudoModel::TraceDeactivate}, {0x86a0f4c0, L"traceActivate", - (XFA_METHOD_CALLBACK)&CScript_LogPseudoModel:: - Script_LogPseudoModel_TraceActivate}, - {0x93eac39a, L"traceEnabled", (XFA_METHOD_CALLBACK)&CScript_LogPseudoModel:: - Script_LogPseudoModel_TraceEnabled}, - {0xd1227e6f, L"trace", - (XFA_METHOD_CALLBACK)&CScript_LogPseudoModel::Script_LogPseudoModel_Trace}, + (XFA_METHOD_CALLBACK)&CScript_LogPseudoModel::TraceActivate}, + {0x93eac39a, L"traceEnabled", + (XFA_METHOD_CALLBACK)&CScript_LogPseudoModel::TraceEnabled}, + {0xd1227e6f, L"trace", (XFA_METHOD_CALLBACK)&CScript_LogPseudoModel::Trace}, {0x36c0ee14, L"getAttribute", (XFA_METHOD_CALLBACK)&CXFA_Node::Script_Packet_GetAttribute}, {0x5468e2a0, L"setAttribute", @@ -1483,62 +1459,54 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { {0xbc254332, L"usehref", (XFA_ATTRIBUTE_CALLBACK)&CXFA_Node::Script_Attribute_String, XFA_ATTRIBUTE_Usehref, XFA_SCRIPT_Basic}, - {0xd843798, L"fullText", (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel:: - Script_EventPseudoModel_FullText, - -1, XFA_SCRIPT_Basic}, - {0x1b6d1cf5, L"reenter", (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel:: - Script_EventPseudoModel_Reenter, - -1, XFA_SCRIPT_Basic}, + {0xd843798, L"fullText", + (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel::FullText, -1, + XFA_SCRIPT_Basic}, + {0x1b6d1cf5, L"reenter", + (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel::Reenter, -1, + XFA_SCRIPT_Basic}, {0x1e6ffa9a, L"prevContentType", - (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel:: - Script_EventPseudoModel_PrevContentType, - -1, XFA_SCRIPT_Basic}, + (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel::PrevContentType, -1, + XFA_SCRIPT_Basic}, {0x25a3c206, L"soapFaultString", - (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel:: - Script_EventPseudoModel_SoapFaultString, - -1, XFA_SCRIPT_Basic}, + (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel::SoapFaultString, -1, + XFA_SCRIPT_Basic}, {0x2e00c007, L"newContentType", - (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel:: - Script_EventPseudoModel_NewContentType, - -1, XFA_SCRIPT_Basic}, + (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel::NewContentType, -1, + XFA_SCRIPT_Basic}, {0x4570500f, L"modifier", - (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel:: - Script_EventPseudoModel_Modifier, - -1, XFA_SCRIPT_Basic}, - {0x50e2e33b, L"selEnd", (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel:: - Script_EventPseudoModel_SelEnd, - -1, XFA_SCRIPT_Basic}, + (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel::Modifier, -1, + XFA_SCRIPT_Basic}, + {0x50e2e33b, L"selEnd", + (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel::SelEnd, -1, + XFA_SCRIPT_Basic}, {0x57de87c2, L"prevText", - (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel:: - Script_EventPseudoModel_PrevText, - -1, XFA_SCRIPT_Basic}, + (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel::PrevText, -1, + XFA_SCRIPT_Basic}, {0x6ea04e0a, L"soapFaultCode", - (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel:: - Script_EventPseudoModel_SoapFaultCode, - -1, XFA_SCRIPT_Basic}, - {0x6f6556cf, L"newText", (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel:: - Script_EventPseudoModel_NewText, - -1, XFA_SCRIPT_Basic}, - {0x891f4606, L"change", (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel:: - Script_EventPseudoModel_Change, - -1, XFA_SCRIPT_Basic}, - {0x8fa3c19e, L"shift", (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel:: - Script_EventPseudoModel_Shift, - -1, XFA_SCRIPT_Basic}, - {0xa9d9b2e1, L"keyDown", (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel:: - Script_EventPseudoModel_KeyDown, - -1, XFA_SCRIPT_Basic}, + (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel::SoapFaultCode, -1, + XFA_SCRIPT_Basic}, + {0x6f6556cf, L"newText", + (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel::NewText, -1, + XFA_SCRIPT_Basic}, + {0x891f4606, L"change", + (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel::Change, -1, + XFA_SCRIPT_Basic}, + {0x8fa3c19e, L"shift", + (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel::Shift, -1, + XFA_SCRIPT_Basic}, + {0xa9d9b2e1, L"keyDown", + (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel::KeyDown, -1, + XFA_SCRIPT_Basic}, {0xbfc89db2, L"selStart", - (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel:: - Script_EventPseudoModel_SelStart, - -1, XFA_SCRIPT_Basic}, + (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel::SelStart, -1, + XFA_SCRIPT_Basic}, {0xc32a5812, L"commitKey", - (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel:: - Script_EventPseudoModel_CommitKey, - -1, XFA_SCRIPT_Basic}, - {0xc8da4da7, L"target", (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel:: - Script_EventPseudoModel_Target, - -1, XFA_SCRIPT_Basic}, + (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel::CommitKey, -1, + XFA_SCRIPT_Basic}, + {0xc8da4da7, L"target", + (XFA_ATTRIBUTE_CALLBACK)&CScript_EventPseudoModel::Target, -1, + XFA_SCRIPT_Basic}, {0xc0811ed, L"use", (XFA_ATTRIBUTE_CALLBACK)&CXFA_Node::Script_Attribute_String, XFA_ATTRIBUTE_Use, XFA_SCRIPT_Basic}, @@ -1946,54 +1914,46 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { (XFA_ATTRIBUTE_CALLBACK)&CXFA_Node::Script_Attribute_String, XFA_ATTRIBUTE_Usehref, XFA_SCRIPT_Basic}, {0x4107ed, L"foxitAppType", - (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_FoxitAppType, - -1, XFA_SCRIPT_Basic}, - {0x31b19c1, L"name", (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_Name, + (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel::FoxitAppType, -1, + XFA_SCRIPT_Basic}, + {0x31b19c1, L"name", (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel::Name, -1, XFA_SCRIPT_Basic}, {0x66c1ae9, L"validationsEnabled", - (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_ValidationsEnabled, - -1, XFA_SCRIPT_Basic}, - {0x14d04502, L"title", (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_Title, - -1, XFA_SCRIPT_Basic}, + (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel::ValidationsEnabled, -1, + XFA_SCRIPT_Basic}, + {0x14d04502, L"title", + (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel::Title, -1, + XFA_SCRIPT_Basic}, {0x193afe8b, L"foxitName", - (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_FoxitName, - -1, XFA_SCRIPT_Basic}, - {0x392ae445, L"platform", (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_Platform, - -1, XFA_SCRIPT_Basic}, - {0x5a50e9e6, L"version", (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_Version, - -1, XFA_SCRIPT_Basic}, + (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel::FoxitName, -1, + XFA_SCRIPT_Basic}, + {0x392ae445, L"platform", + (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel::Platform, -1, + XFA_SCRIPT_Basic}, + {0x5a50e9e6, L"version", + (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel::Version, -1, + XFA_SCRIPT_Basic}, {0x66cb1eed, L"variation", - (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_Variation, - -1, XFA_SCRIPT_Basic}, - {0x7717cbc4, L"language", (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_Language, - -1, XFA_SCRIPT_Basic}, - {0x86698963, L"appType", (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_AppType, - -1, XFA_SCRIPT_Basic}, + (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel::Variation, -1, + XFA_SCRIPT_Basic}, + {0x7717cbc4, L"language", + (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel::Language, -1, + XFA_SCRIPT_Basic}, + {0x86698963, L"appType", + (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel::AppType, -1, + XFA_SCRIPT_Basic}, {0x94ff9e8d, L"calculationsEnabled", - (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_CalculationsEnabled, - -1, XFA_SCRIPT_Basic}, + (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel::CalculationsEnabled, -1, + XFA_SCRIPT_Basic}, {0xbcd44940, L"currentPage", - (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_CurrentPage, - -1, XFA_SCRIPT_Basic}, + (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel::CurrentPage, -1, + XFA_SCRIPT_Basic}, {0xd4286870, L"foxitVersion", - (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_FoxitVersion, - -1, XFA_SCRIPT_Basic}, - {0xd592b920, L"numPages", (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel:: - Script_HostPseudoModel_NumPages, - -1, XFA_SCRIPT_Basic}, + (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel::FoxitVersion, -1, + XFA_SCRIPT_Basic}, + {0xd592b920, L"numPages", + (XFA_ATTRIBUTE_CALLBACK)&CScript_HostPseudoModel::NumPages, -1, + XFA_SCRIPT_Basic}, {0xbe52dfbf, L"desc", (XFA_ATTRIBUTE_CALLBACK)&CXFA_Node::Script_Attribute_String, XFA_ATTRIBUTE_Desc, XFA_SCRIPT_Basic}, @@ -2135,9 +2095,9 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { {0xf6b47749, L"lock", (XFA_ATTRIBUTE_CALLBACK)&CXFA_Node::Script_Attribute_BOOL, XFA_ATTRIBUTE_Lock, XFA_SCRIPT_Basic}, - {0xfcef86b5, L"ready", (XFA_ATTRIBUTE_CALLBACK)&CScript_LayoutPseudoModel:: - Script_LayoutPseudoModel_Ready, - -1, XFA_SCRIPT_Basic}, + {0xfcef86b5, L"ready", + (XFA_ATTRIBUTE_CALLBACK)&CScript_LayoutPseudoModel::Ready, -1, + XFA_SCRIPT_Basic}, {0xbe52dfbf, L"desc", (XFA_ATTRIBUTE_CALLBACK)&CXFA_Node::Script_Attribute_String, XFA_ATTRIBUTE_Desc, XFA_SCRIPT_Basic}, @@ -2396,19 +2356,18 @@ const XFA_SCRIPTATTRIBUTEINFO g_SomAttributeData[] = { {0xbc254332, L"usehref", (XFA_ATTRIBUTE_CALLBACK)&CXFA_Node::Script_Attribute_String, XFA_ATTRIBUTE_Usehref, XFA_SCRIPT_Basic}, - {0xfb67185, L"recordsBefore", (XFA_ATTRIBUTE_CALLBACK)&CScript_DataWindow:: - Script_DataWindow_RecordsBefore, - -1, XFA_SCRIPT_Basic}, + {0xfb67185, L"recordsBefore", + (XFA_ATTRIBUTE_CALLBACK)&CScript_DataWindow::RecordsBefore, -1, + XFA_SCRIPT_Basic}, {0x21d5dfcb, L"currentRecordNumber", - (XFA_ATTRIBUTE_CALLBACK)&CScript_DataWindow:: - Script_DataWindow_CurrentRecordNumber, - -1, XFA_SCRIPT_Basic}, - {0x312af044, L"recordsAfter", (XFA_ATTRIBUTE_CALLBACK)&CScript_DataWindow:: - Script_DataWindow_RecordsAfter, - -1, XFA_SCRIPT_Basic}, + (XFA_ATTRIBUTE_CALLBACK)&CScript_DataWindow::CurrentRecordNumber, -1, + XFA_SCRIPT_Basic}, + {0x312af044, L"recordsAfter", + (XFA_ATTRIBUTE_CALLBACK)&CScript_DataWindow::RecordsAfter, -1, + XFA_SCRIPT_Basic}, {0x6aab37cb, L"isDefined", - (XFA_ATTRIBUTE_CALLBACK)&CScript_DataWindow::Script_DataWindow_IsDefined, - -1, XFA_SCRIPT_Basic}, + (XFA_ATTRIBUTE_CALLBACK)&CScript_DataWindow::IsDefined, -1, + XFA_SCRIPT_Basic}, {0xc0811ed, L"use", (XFA_ATTRIBUTE_CALLBACK)&CXFA_Node::Script_Attribute_String, XFA_ATTRIBUTE_Use, XFA_SCRIPT_Basic}, diff --git a/xfa/fxfa/parser/xfa_script_datawindow.cpp b/xfa/fxfa/parser/xfa_script_datawindow.cpp index 9d307a4abe..c04b5e2770 100644 --- a/xfa/fxfa/parser/xfa_script_datawindow.cpp +++ b/xfa/fxfa/parser/xfa_script_datawindow.cpp @@ -20,34 +20,26 @@ CScript_DataWindow::CScript_DataWindow(CXFA_Document* pDocument) CScript_DataWindow::~CScript_DataWindow() {} -void CScript_DataWindow::Script_DataWindow_MoveCurrentRecord( - CFXJSE_Arguments* pArguments) {} +void CScript_DataWindow::MoveCurrentRecord(CFXJSE_Arguments* pArguments) {} -void CScript_DataWindow::Script_DataWindow_Record( - CFXJSE_Arguments* pArguments) {} +void CScript_DataWindow::Record(CFXJSE_Arguments* pArguments) {} -void CScript_DataWindow::Script_DataWindow_GotoRecord( - CFXJSE_Arguments* pArguments) {} +void CScript_DataWindow::GotoRecord(CFXJSE_Arguments* pArguments) {} -void CScript_DataWindow::Script_DataWindow_IsRecordGroup( - CFXJSE_Arguments* pArguments) {} +void CScript_DataWindow::IsRecordGroup(CFXJSE_Arguments* pArguments) {} -void CScript_DataWindow::Script_DataWindow_RecordsBefore( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) {} +void CScript_DataWindow::RecordsBefore(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) {} -void CScript_DataWindow::Script_DataWindow_CurrentRecordNumber( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) {} +void CScript_DataWindow::CurrentRecordNumber(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) {} -void CScript_DataWindow::Script_DataWindow_RecordsAfter( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) {} +void CScript_DataWindow::RecordsAfter(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) {} -void CScript_DataWindow::Script_DataWindow_IsDefined(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { -} +void CScript_DataWindow::IsDefined(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) {} diff --git a/xfa/fxfa/parser/xfa_script_datawindow.h b/xfa/fxfa/parser/xfa_script_datawindow.h index b57bd147ae..05ecf8dc53 100644 --- a/xfa/fxfa/parser/xfa_script_datawindow.h +++ b/xfa/fxfa/parser/xfa_script_datawindow.h @@ -12,25 +12,25 @@ class CScript_DataWindow : public CXFA_Object { public: - CScript_DataWindow(CXFA_Document* pDocument); + explicit CScript_DataWindow(CXFA_Document* pDocument); ~CScript_DataWindow() override; - void Script_DataWindow_MoveCurrentRecord(CFXJSE_Arguments* pArguments); - void Script_DataWindow_Record(CFXJSE_Arguments* pArguments); - void Script_DataWindow_GotoRecord(CFXJSE_Arguments* pArguments); - void Script_DataWindow_IsRecordGroup(CFXJSE_Arguments* pArguments); - void Script_DataWindow_RecordsBefore(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_DataWindow_CurrentRecordNumber(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_DataWindow_RecordsAfter(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_DataWindow_IsDefined(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); + void MoveCurrentRecord(CFXJSE_Arguments* pArguments); + void Record(CFXJSE_Arguments* pArguments); + void GotoRecord(CFXJSE_Arguments* pArguments); + void IsRecordGroup(CFXJSE_Arguments* pArguments); + void RecordsBefore(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void CurrentRecordNumber(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void RecordsAfter(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void IsDefined(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); }; #endif // XFA_FXFA_PARSER_XFA_SCRIPT_DATAWINDOW_H_ diff --git a/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp index f6612d1563..1c54a5dbb7 100644 --- a/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp @@ -20,42 +20,46 @@ #include "xfa/fxfa/parser/xfa_script_imp.h" #include "xfa/fxfa/parser/xfa_utils.h" -CScript_EventPseudoModel::CScript_EventPseudoModel(CXFA_Document* pDocument) - : CXFA_Object(pDocument, - XFA_ObjectType::Object, - XFA_Element::EventPseudoModel) {} -CScript_EventPseudoModel::~CScript_EventPseudoModel() {} -void Script_EventPseudoModel_StringProperty(CFXJSE_Value* pValue, - CFX_WideString& wsValue, - FX_BOOL bSetting) { +namespace { + +void StringProperty(CFXJSE_Value* pValue, + CFX_WideString& wsValue, + FX_BOOL bSetting) { if (bSetting) { wsValue = pValue->ToWideString(); - } else { - pValue->SetString(FX_UTF8Encode(wsValue).AsStringC()); + return; } + pValue->SetString(FX_UTF8Encode(wsValue).AsStringC()); } -void Script_EventPseudoModel_InterProperty(CFXJSE_Value* pValue, - int32_t& iValue, - FX_BOOL bSetting) { + +void InterProperty(CFXJSE_Value* pValue, int32_t& iValue, FX_BOOL bSetting) { if (bSetting) { iValue = pValue->ToInteger(); - } else { - pValue->SetInteger(iValue); + return; } + pValue->SetInteger(iValue); } -void Script_EventPseudoModel_BooleanProperty(CFXJSE_Value* pValue, - FX_BOOL& bValue, - FX_BOOL bSetting) { - if (bSetting) + +void BooleanProperty(CFXJSE_Value* pValue, FX_BOOL& bValue, FX_BOOL bSetting) { + if (bSetting) { bValue = pValue->ToBoolean(); - else - pValue->SetBoolean(bValue); + return; + } + pValue->SetBoolean(bValue); } -void CScript_EventPseudoModel::Script_EventPseudoModel_Property( - CFXJSE_Value* pValue, - XFA_Event dwFlag, - FX_BOOL bSetting) { +} // namespace + +CScript_EventPseudoModel::CScript_EventPseudoModel(CXFA_Document* pDocument) + : CXFA_Object(pDocument, + XFA_ObjectType::Object, + XFA_Element::EventPseudoModel) {} + +CScript_EventPseudoModel::~CScript_EventPseudoModel() {} + +void CScript_EventPseudoModel::Property(CFXJSE_Value* pValue, + XFA_Event dwFlag, + FX_BOOL bSetting) { CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) return; @@ -66,68 +70,52 @@ void CScript_EventPseudoModel::Script_EventPseudoModel_Property( switch (dwFlag) { case XFA_Event::CancelAction: - Script_EventPseudoModel_BooleanProperty( - pValue, pEventParam->m_bCancelAction, bSetting); + BooleanProperty(pValue, pEventParam->m_bCancelAction, bSetting); break; case XFA_Event::Change: - Script_EventPseudoModel_StringProperty(pValue, pEventParam->m_wsChange, - bSetting); + StringProperty(pValue, pEventParam->m_wsChange, bSetting); break; case XFA_Event::CommitKey: - Script_EventPseudoModel_InterProperty(pValue, pEventParam->m_iCommitKey, - bSetting); + InterProperty(pValue, pEventParam->m_iCommitKey, bSetting); break; case XFA_Event::FullText: - Script_EventPseudoModel_StringProperty(pValue, pEventParam->m_wsFullText, - bSetting); + StringProperty(pValue, pEventParam->m_wsFullText, bSetting); break; case XFA_Event::Keydown: - Script_EventPseudoModel_BooleanProperty(pValue, pEventParam->m_bKeyDown, - bSetting); + BooleanProperty(pValue, pEventParam->m_bKeyDown, bSetting); break; case XFA_Event::Modifier: - Script_EventPseudoModel_BooleanProperty(pValue, pEventParam->m_bModifier, - bSetting); + BooleanProperty(pValue, pEventParam->m_bModifier, bSetting); break; case XFA_Event::NewContentType: - Script_EventPseudoModel_StringProperty( - pValue, pEventParam->m_wsNewContentType, bSetting); + StringProperty(pValue, pEventParam->m_wsNewContentType, bSetting); break; case XFA_Event::NewText: - Script_EventPseudoModel_StringProperty(pValue, pEventParam->m_wsNewText, - bSetting); + StringProperty(pValue, pEventParam->m_wsNewText, bSetting); break; case XFA_Event::PreviousContentType: - Script_EventPseudoModel_StringProperty( - pValue, pEventParam->m_wsPrevContentType, bSetting); + StringProperty(pValue, pEventParam->m_wsPrevContentType, bSetting); break; case XFA_Event::PreviousText: - Script_EventPseudoModel_StringProperty(pValue, pEventParam->m_wsPrevText, - bSetting); + StringProperty(pValue, pEventParam->m_wsPrevText, bSetting); break; case XFA_Event::Reenter: - Script_EventPseudoModel_BooleanProperty(pValue, pEventParam->m_bReenter, - bSetting); + BooleanProperty(pValue, pEventParam->m_bReenter, bSetting); break; case XFA_Event::SelectionEnd: - Script_EventPseudoModel_InterProperty(pValue, pEventParam->m_iSelEnd, - bSetting); + InterProperty(pValue, pEventParam->m_iSelEnd, bSetting); break; case XFA_Event::SelectionStart: - Script_EventPseudoModel_InterProperty(pValue, pEventParam->m_iSelStart, - bSetting); + InterProperty(pValue, pEventParam->m_iSelStart, bSetting); break; case XFA_Event::Shift: - Script_EventPseudoModel_BooleanProperty(pValue, pEventParam->m_bShift, - bSetting); + BooleanProperty(pValue, pEventParam->m_bShift, bSetting); break; case XFA_Event::SoapFaultCode: - Script_EventPseudoModel_StringProperty( - pValue, pEventParam->m_wsSoapFaultCode, bSetting); + StringProperty(pValue, pEventParam->m_wsSoapFaultCode, bSetting); break; case XFA_Event::SoapFaultString: - Script_EventPseudoModel_StringProperty( - pValue, pEventParam->m_wsSoapFaultString, bSetting); + StringProperty(pValue, pEventParam->m_wsSoapFaultString, bSetting); break; case XFA_Event::Target: break; @@ -135,106 +123,87 @@ void CScript_EventPseudoModel::Script_EventPseudoModel_Property( break; } } -void CScript_EventPseudoModel::Script_EventPseudoModel_Change( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(pValue, XFA_Event::Change, bSetting); -} -void CScript_EventPseudoModel::Script_EventPseudoModel_CommitKey( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(pValue, XFA_Event::CommitKey, bSetting); -} -void CScript_EventPseudoModel::Script_EventPseudoModel_FullText( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(pValue, XFA_Event::FullText, bSetting); -} -void CScript_EventPseudoModel::Script_EventPseudoModel_KeyDown( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(pValue, XFA_Event::Keydown, bSetting); -} -void CScript_EventPseudoModel::Script_EventPseudoModel_Modifier( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(pValue, XFA_Event::Modifier, bSetting); -} -void CScript_EventPseudoModel::Script_EventPseudoModel_NewContentType( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(pValue, XFA_Event::NewContentType, bSetting); -} -void CScript_EventPseudoModel::Script_EventPseudoModel_NewText( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(pValue, XFA_Event::NewText, bSetting); -} -void CScript_EventPseudoModel::Script_EventPseudoModel_PrevContentType( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(pValue, XFA_Event::PreviousContentType, - bSetting); -} -void CScript_EventPseudoModel::Script_EventPseudoModel_PrevText( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(pValue, XFA_Event::PreviousText, bSetting); -} -void CScript_EventPseudoModel::Script_EventPseudoModel_Reenter( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(pValue, XFA_Event::Reenter, bSetting); -} -void CScript_EventPseudoModel::Script_EventPseudoModel_SelEnd( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(pValue, XFA_Event::SelectionEnd, bSetting); -} -void CScript_EventPseudoModel::Script_EventPseudoModel_SelStart( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(pValue, XFA_Event::SelectionStart, bSetting); -} -void CScript_EventPseudoModel::Script_EventPseudoModel_Shift( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(pValue, XFA_Event::Shift, bSetting); -} -void CScript_EventPseudoModel::Script_EventPseudoModel_SoapFaultCode( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(pValue, XFA_Event::SoapFaultCode, bSetting); -} -void CScript_EventPseudoModel::Script_EventPseudoModel_SoapFaultString( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(pValue, XFA_Event::SoapFaultString, - bSetting); -} -void CScript_EventPseudoModel::Script_EventPseudoModel_Target( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { - Script_EventPseudoModel_Property(pValue, XFA_Event::Target, bSetting); -} -void CScript_EventPseudoModel::Script_EventPseudoModel_Emit( - CFXJSE_Arguments* pArguments) { +void CScript_EventPseudoModel::Change(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { + Property(pValue, XFA_Event::Change, bSetting); +} +void CScript_EventPseudoModel::CommitKey(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { + Property(pValue, XFA_Event::CommitKey, bSetting); +} +void CScript_EventPseudoModel::FullText(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { + Property(pValue, XFA_Event::FullText, bSetting); +} +void CScript_EventPseudoModel::KeyDown(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { + Property(pValue, XFA_Event::Keydown, bSetting); +} +void CScript_EventPseudoModel::Modifier(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { + Property(pValue, XFA_Event::Modifier, bSetting); +} +void CScript_EventPseudoModel::NewContentType(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { + Property(pValue, XFA_Event::NewContentType, bSetting); +} +void CScript_EventPseudoModel::NewText(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { + Property(pValue, XFA_Event::NewText, bSetting); +} +void CScript_EventPseudoModel::PrevContentType(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { + Property(pValue, XFA_Event::PreviousContentType, bSetting); +} +void CScript_EventPseudoModel::PrevText(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { + Property(pValue, XFA_Event::PreviousText, bSetting); +} +void CScript_EventPseudoModel::Reenter(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { + Property(pValue, XFA_Event::Reenter, bSetting); +} +void CScript_EventPseudoModel::SelEnd(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { + Property(pValue, XFA_Event::SelectionEnd, bSetting); +} +void CScript_EventPseudoModel::SelStart(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { + Property(pValue, XFA_Event::SelectionStart, bSetting); +} +void CScript_EventPseudoModel::Shift(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { + Property(pValue, XFA_Event::Shift, bSetting); +} +void CScript_EventPseudoModel::SoapFaultCode(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { + Property(pValue, XFA_Event::SoapFaultCode, bSetting); +} +void CScript_EventPseudoModel::SoapFaultString(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { + Property(pValue, XFA_Event::SoapFaultString, bSetting); +} +void CScript_EventPseudoModel::Target(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { + Property(pValue, XFA_Event::Target, bSetting); +} +void CScript_EventPseudoModel::Emit(CFXJSE_Arguments* pArguments) { CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; @@ -253,8 +222,7 @@ void CScript_EventPseudoModel::Script_EventPseudoModel_Emit( } pWidgetHandler->ProcessEvent(pEventParam->m_pTarget, pEventParam); } -void CScript_EventPseudoModel::Script_EventPseudoModel_Reset( - CFXJSE_Arguments* pArguments) { +void CScript_EventPseudoModel::Reset(CFXJSE_Arguments* pArguments) { CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); if (!pScriptContext) { return; diff --git a/xfa/fxfa/parser/xfa_script_eventpseudomodel.h b/xfa/fxfa/parser/xfa_script_eventpseudomodel.h index ef59b3baff..9eb3912e9e 100644 --- a/xfa/fxfa/parser/xfa_script_eventpseudomodel.h +++ b/xfa/fxfa/parser/xfa_script_eventpseudomodel.h @@ -35,62 +35,52 @@ class CScript_EventPseudoModel : public CXFA_Object { explicit CScript_EventPseudoModel(CXFA_Document* pDocument); ~CScript_EventPseudoModel() override; - void Script_EventPseudoModel_Change(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_EventPseudoModel_CommitKey(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_EventPseudoModel_FullText(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_EventPseudoModel_KeyDown(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_EventPseudoModel_Modifier(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_EventPseudoModel_NewContentType(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_EventPseudoModel_NewText(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_EventPseudoModel_PrevContentType(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_EventPseudoModel_PrevText(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_EventPseudoModel_Reenter(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_EventPseudoModel_SelEnd(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_EventPseudoModel_SelStart(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_EventPseudoModel_Shift(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_EventPseudoModel_SoapFaultCode(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_EventPseudoModel_SoapFaultString(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_EventPseudoModel_Target(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); + void Change(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute); + void CommitKey(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void FullText(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void KeyDown(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void Modifier(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void NewContentType(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void NewText(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void PrevContentType(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void PrevText(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void Reenter(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void SelEnd(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute); + void SelStart(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void Shift(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute); + void SoapFaultCode(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void SoapFaultString(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void Target(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute); - void Script_EventPseudoModel_Emit(CFXJSE_Arguments* pArguments); - void Script_EventPseudoModel_Reset(CFXJSE_Arguments* pArguments); + void Emit(CFXJSE_Arguments* pArguments); + void Reset(CFXJSE_Arguments* pArguments); protected: - void Script_EventPseudoModel_Property(CFXJSE_Value* pValue, - XFA_Event dwFlag, - FX_BOOL bSetting); + void Property(CFXJSE_Value* pValue, XFA_Event dwFlag, FX_BOOL bSetting); }; #endif // XFA_FXFA_PARSER_XFA_SCRIPT_EVENTPSEUDOMODEL_H_ diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp index 84d5fc9223..6d659cd9c6 100644 --- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp @@ -32,18 +32,16 @@ CScript_HostPseudoModel::CScript_HostPseudoModel(CXFA_Document* pDocument) XFA_ObjectType::Object, XFA_Element::HostPseudoModel) {} CScript_HostPseudoModel::~CScript_HostPseudoModel() {} -void CScript_HostPseudoModel::Script_HostPseudoModel_LoadString( - CFXJSE_Value* pValue, - CXFA_FFNotify* pNotify, - uint32_t dwFlag) { +void CScript_HostPseudoModel::LoadString(CFXJSE_Value* pValue, + CXFA_FFNotify* pNotify, + uint32_t dwFlag) { CFX_WideString wsValue; pNotify->GetAppProvider()->LoadString(dwFlag, wsValue); pValue->SetString(FX_UTF8Encode(wsValue).AsStringC()); } -void CScript_HostPseudoModel::Script_HostPseudoModel_AppType( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { +void CScript_HostPseudoModel::AppType(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; @@ -56,10 +54,9 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_AppType( pNotify->GetAppProvider()->GetAppType(wsAppType); pValue->SetString(FX_UTF8Encode(wsAppType).AsStringC()); } -void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitAppType( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { +void CScript_HostPseudoModel::FoxitAppType(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; @@ -72,10 +69,9 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitAppType( pNotify->GetAppProvider()->GetFoxitAppType(wsAppType); pValue->SetString(FX_UTF8Encode(wsAppType).AsStringC()); } -void CScript_HostPseudoModel::Script_HostPseudoModel_CalculationsEnabled( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { +void CScript_HostPseudoModel::CalculationsEnabled(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; @@ -88,10 +84,9 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_CalculationsEnabled( } pValue->SetBoolean(pNotify->GetDocProvider()->IsCalculationsEnabled(hDoc)); } -void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentPage( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { +void CScript_HostPseudoModel::CurrentPage(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; @@ -103,10 +98,9 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentPage( } pValue->SetInteger(pNotify->GetDocProvider()->GetCurrentPage(hDoc)); } -void CScript_HostPseudoModel::Script_HostPseudoModel_Language( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { +void CScript_HostPseudoModel::Language(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; @@ -119,10 +113,9 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Language( pNotify->GetAppProvider()->GetLanguage(wsLanguage); pValue->SetString(FX_UTF8Encode(wsLanguage).AsStringC()); } -void CScript_HostPseudoModel::Script_HostPseudoModel_NumPages( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { +void CScript_HostPseudoModel::NumPages(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; @@ -134,10 +127,9 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_NumPages( } pValue->SetInteger(pNotify->GetDocProvider()->CountPages(hDoc)); } -void CScript_HostPseudoModel::Script_HostPseudoModel_Platform( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { +void CScript_HostPseudoModel::Platform(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; @@ -150,10 +142,9 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Platform( pNotify->GetAppProvider()->GetPlatform(wsPlatform); pValue->SetString(FX_UTF8Encode(wsPlatform).AsStringC()); } -void CScript_HostPseudoModel::Script_HostPseudoModel_Title( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { +void CScript_HostPseudoModel::Title(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } @@ -170,10 +161,9 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Title( pNotify->GetDocProvider()->GetTitle(hDoc, wsTitle); pValue->SetString(FX_UTF8Encode(wsTitle).AsStringC()); } -void CScript_HostPseudoModel::Script_HostPseudoModel_ValidationsEnabled( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { +void CScript_HostPseudoModel::ValidationsEnabled(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; @@ -186,10 +176,9 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ValidationsEnabled( FX_BOOL bEnabled = pNotify->GetDocProvider()->IsValidationsEnabled(hDoc); pValue->SetBoolean(bEnabled); } -void CScript_HostPseudoModel::Script_HostPseudoModel_Variation( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { +void CScript_HostPseudoModel::Variation(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } @@ -205,10 +194,9 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Variation( pNotify->GetAppProvider()->GetVariation(wsVariation); pValue->SetString(FX_UTF8Encode(wsVariation).AsStringC()); } -void CScript_HostPseudoModel::Script_HostPseudoModel_Version( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { +void CScript_HostPseudoModel::Version(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; @@ -221,10 +209,9 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Version( pNotify->GetAppProvider()->GetVersion(wsVersion); pValue->SetString(FX_UTF8Encode(wsVersion).AsStringC()); } -void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitVersion( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { +void CScript_HostPseudoModel::FoxitVersion(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; @@ -237,10 +224,9 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitVersion( pNotify->GetAppProvider()->GetFoxitVersion(wsVersion); pValue->SetString(FX_UTF8Encode(wsVersion).AsStringC()); } -void CScript_HostPseudoModel::Script_HostPseudoModel_Name( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { +void CScript_HostPseudoModel::Name(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; @@ -253,10 +239,9 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Name( pNotify->GetAppProvider()->GetAppName(wsAppName); pValue->SetString(FX_UTF8Encode(wsAppName).AsStringC()); } -void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitName( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { +void CScript_HostPseudoModel::FoxitName(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; @@ -269,8 +254,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitName( pNotify->GetAppProvider()->GetFoxitAppName(wsFoxitAppName); pValue->SetString(FX_UTF8Encode(wsFoxitAppName).AsStringC()); } -void CScript_HostPseudoModel::Script_HostPseudoModel_GotoURL( - CFXJSE_Arguments* pArguments) { +void CScript_HostPseudoModel::GotoURL(CFXJSE_Arguments* pArguments) { if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } @@ -291,8 +275,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_GotoURL( } pNotify->GetDocProvider()->GotoURL(hDoc, wsURL); } -void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( - CFXJSE_Arguments* pArguments) { +void CScript_HostPseudoModel::OpenList(CFXJSE_Arguments* pArguments) { if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } @@ -342,8 +325,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_OpenList( pNotify->GetDocProvider()->SetFocusWidget(pNotify->GetHDOC(), hWidget); pNotify->OpenDropDownList(hWidget); } -void CScript_HostPseudoModel::Script_HostPseudoModel_Response( - CFXJSE_Arguments* pArguments) { +void CScript_HostPseudoModel::Response(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 1 || iLength > 4) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"response"); @@ -378,8 +360,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Response( if (pValue) pValue->SetString(FX_UTF8Encode(wsAnswer).AsStringC()); } -void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentInBatch( - CFXJSE_Arguments* pArguments) { +void CScript_HostPseudoModel::DocumentInBatch(CFXJSE_Arguments* pArguments) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; @@ -413,8 +394,7 @@ static int32_t XFA_FilterName(const CFX_WideStringC& wsExpression, wsFilter.TrimRight(); return nStart; } -void CScript_HostPseudoModel::Script_HostPseudoModel_ResetData( - CFXJSE_Arguments* pArguments) { +void CScript_HostPseudoModel::ResetData(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 0 || iLength > 1) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"resetData"); @@ -462,8 +442,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ResetData( pNotify->ResetData(); } } -void CScript_HostPseudoModel::Script_HostPseudoModel_Beep( - CFXJSE_Arguments* pArguments) { +void CScript_HostPseudoModel::Beep(CFXJSE_Arguments* pArguments) { if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } @@ -482,8 +461,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Beep( } pNotify->GetAppProvider()->Beep(dwType); } -void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus( - CFXJSE_Arguments* pArguments) { +void CScript_HostPseudoModel::SetFocus(CFXJSE_Arguments* pArguments) { if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } @@ -523,8 +501,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_SetFocus( } pNotify->SetFocusWidgetNode(pNode); } -void CScript_HostPseudoModel::Script_HostPseudoModel_GetFocus( - CFXJSE_Arguments* pArguments) { +void CScript_HostPseudoModel::GetFocus(CFXJSE_Arguments* pArguments) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; @@ -536,8 +513,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_GetFocus( pArguments->GetReturnValue()->Assign( m_pDocument->GetScriptContext()->GetJSValueFromMap(pNode)); } -void CScript_HostPseudoModel::Script_HostPseudoModel_MessageBox( - CFXJSE_Arguments* pArguments) { +void CScript_HostPseudoModel::MessageBox(CFXJSE_Arguments* pArguments) { if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } @@ -555,12 +531,12 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_MessageBox( uint32_t dwMessageType = XFA_MBICON_Error; uint32_t dwButtonType = XFA_MB_OK; if (iLength >= 1) { - if (!Script_HostPseudoModel_ValidateArgsForMsg(pArguments, 0, wsMessage)) { + if (!ValidateArgsForMsg(pArguments, 0, wsMessage)) { return; } } if (iLength >= 2) { - if (!Script_HostPseudoModel_ValidateArgsForMsg(pArguments, 1, bsTitle)) { + if (!ValidateArgsForMsg(pArguments, 1, bsTitle)) { return; } } @@ -582,7 +558,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_MessageBox( if (pValue) pValue->SetInteger(iValue); } -FX_BOOL CScript_HostPseudoModel::Script_HostPseudoModel_ValidateArgsForMsg( +FX_BOOL CScript_HostPseudoModel::ValidateArgsForMsg( CFXJSE_Arguments* pArguments, int32_t iArgIndex, CFX_WideString& wsValue) { @@ -606,7 +582,7 @@ FX_BOOL CScript_HostPseudoModel::Script_HostPseudoModel_ValidateArgsForMsg( } return TRUE; } -void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentCountInBatch( +void CScript_HostPseudoModel::DocumentCountInBatch( CFXJSE_Arguments* pArguments) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { @@ -617,8 +593,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentCountInBatch( if (pValue) pValue->SetInteger(iValue); } -void CScript_HostPseudoModel::Script_HostPseudoModel_Print( - CFXJSE_Arguments* pArguments) { +void CScript_HostPseudoModel::Print(CFXJSE_Arguments* pArguments) { if (!m_pDocument->GetScriptContext()->IsRunAtClient()) { return; } @@ -686,8 +661,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Print( } pNotify->GetDocProvider()->Print(hDoc, nStartPage, nEndPage, dwOptions); } -void CScript_HostPseudoModel::Script_HostPseudoModel_ImportData( - CFXJSE_Arguments* pArguments) { +void CScript_HostPseudoModel::ImportData(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 0 || iLength > 1) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"importData"); @@ -705,8 +679,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ImportData( CXFA_FFDoc* hDoc = pNotify->GetHDOC(); pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath); } -void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData( - CFXJSE_Arguments* pArguments) { +void CScript_HostPseudoModel::ExportData(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 0 || iLength > 2) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"exportData"); @@ -728,8 +701,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_ExportData( } pNotify->GetDocProvider()->ExportData(hDoc, wsFilePath, bXDP); } -void CScript_HostPseudoModel::Script_HostPseudoModel_PageUp( - CFXJSE_Arguments* pArguments) { +void CScript_HostPseudoModel::PageUp(CFXJSE_Arguments* pArguments) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; @@ -743,8 +715,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_PageUp( nNewPage = nCurPage - 1; pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage); } -void CScript_HostPseudoModel::Script_HostPseudoModel_PageDown( - CFXJSE_Arguments* pArguments) { +void CScript_HostPseudoModel::PageDown(CFXJSE_Arguments* pArguments) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; @@ -763,8 +734,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_PageDown( } pNotify->GetDocProvider()->SetCurrentPage(hDoc, nNewPage); } -void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentDateTime( - CFXJSE_Arguments* pArguments) { +void CScript_HostPseudoModel::CurrentDateTime(CFXJSE_Arguments* pArguments) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.h b/xfa/fxfa/parser/xfa_script_hostpseudomodel.h index 58a2853180..e131b6fe7e 100644 --- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.h +++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.h @@ -13,78 +13,72 @@ class CScript_HostPseudoModel : public CXFA_Object { public: - CScript_HostPseudoModel(CXFA_Document* pDocument); + explicit CScript_HostPseudoModel(CXFA_Document* pDocument); ~CScript_HostPseudoModel() override; - void Script_HostPseudoModel_AppType(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_HostPseudoModel_FoxitAppType(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_HostPseudoModel_CalculationsEnabled(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_HostPseudoModel_CurrentPage(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_HostPseudoModel_Language(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_HostPseudoModel_NumPages(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_HostPseudoModel_Platform(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_HostPseudoModel_Title(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_HostPseudoModel_ValidationsEnabled(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_HostPseudoModel_Variation(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_HostPseudoModel_Version(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_HostPseudoModel_FoxitVersion(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_HostPseudoModel_Name(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - void Script_HostPseudoModel_FoxitName(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); + void AppType(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void FoxitAppType(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void CalculationsEnabled(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void CurrentPage(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void Language(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void NumPages(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void Platform(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void Title(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute); + void ValidationsEnabled(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void Variation(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void Version(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void FoxitVersion(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); + void Name(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute); + void FoxitName(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute); - void Script_HostPseudoModel_GotoURL(CFXJSE_Arguments* pArguments); - void Script_HostPseudoModel_OpenList(CFXJSE_Arguments* pArguments); - void Script_HostPseudoModel_Response(CFXJSE_Arguments* pArguments); - void Script_HostPseudoModel_DocumentInBatch(CFXJSE_Arguments* pArguments); - void Script_HostPseudoModel_ResetData(CFXJSE_Arguments* pArguments); - void Script_HostPseudoModel_Beep(CFXJSE_Arguments* pArguments); - void Script_HostPseudoModel_SetFocus(CFXJSE_Arguments* pArguments); - void Script_HostPseudoModel_GetFocus(CFXJSE_Arguments* pArguments); - void Script_HostPseudoModel_MessageBox(CFXJSE_Arguments* pArguments); - void Script_HostPseudoModel_DocumentCountInBatch( - CFXJSE_Arguments* pArguments); - void Script_HostPseudoModel_Print(CFXJSE_Arguments* pArguments); - void Script_HostPseudoModel_ImportData(CFXJSE_Arguments* pArguments); - void Script_HostPseudoModel_ExportData(CFXJSE_Arguments* pArguments); - void Script_HostPseudoModel_PageUp(CFXJSE_Arguments* pArguments); - void Script_HostPseudoModel_PageDown(CFXJSE_Arguments* pArguments); - void Script_HostPseudoModel_CurrentDateTime(CFXJSE_Arguments* pArguments); + void GotoURL(CFXJSE_Arguments* pArguments); + void OpenList(CFXJSE_Arguments* pArguments); + void Response(CFXJSE_Arguments* pArguments); + void DocumentInBatch(CFXJSE_Arguments* pArguments); + void ResetData(CFXJSE_Arguments* pArguments); + void Beep(CFXJSE_Arguments* pArguments); + void SetFocus(CFXJSE_Arguments* pArguments); + void GetFocus(CFXJSE_Arguments* pArguments); + void MessageBox(CFXJSE_Arguments* pArguments); + void DocumentCountInBatch(CFXJSE_Arguments* pArguments); + void Print(CFXJSE_Arguments* pArguments); + void ImportData(CFXJSE_Arguments* pArguments); + void ExportData(CFXJSE_Arguments* pArguments); + void PageUp(CFXJSE_Arguments* pArguments); + void PageDown(CFXJSE_Arguments* pArguments); + void CurrentDateTime(CFXJSE_Arguments* pArguments); protected: - void Script_HostPseudoModel_LoadString(CFXJSE_Value* pValue, - CXFA_FFNotify* pNotify, - uint32_t dwFlag); - FX_BOOL Script_HostPseudoModel_ValidateArgsForMsg( - CFXJSE_Arguments* pArguments, - int32_t iArgIndex, - CFX_WideString& wsValue); + void LoadString(CFXJSE_Value* pValue, + CXFA_FFNotify* pNotify, + uint32_t dwFlag); + FX_BOOL ValidateArgsForMsg(CFXJSE_Arguments* pArguments, + int32_t iArgIndex, + CFX_WideString& wsValue); }; #endif // XFA_FXFA_PARSER_XFA_SCRIPT_HOSTPSEUDOMODEL_H_ diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp index 109fc311e6..10ca2106ca 100644 --- a/xfa/fxfa/parser/xfa_script_imp.cpp +++ b/xfa/fxfa/parser/xfa_script_imp.cpp @@ -545,7 +545,7 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode, } FX_BOOL bNextCreate = FALSE; if (dwStyles & XFA_RESOLVENODE_CreateNode) { - m_ResolveProcessor->GetNodeHelper()->XFA_SetCreateNodeType(bindNode); + m_ResolveProcessor->GetNodeHelper()->SetCreateNodeType(bindNode); } m_ResolveProcessor->GetNodeHelper()->m_pCreateParent = nullptr; m_ResolveProcessor->GetNodeHelper()->m_iCurAllStart = -1; @@ -561,9 +561,8 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode, nNodes = findNodes.GetSize(); int32_t i = 0; rndFind.m_dwStyles = dwStyles; - m_ResolveProcessor->m_iCurStart = nStart; - nStart = m_ResolveProcessor->XFA_ResolveNodes_GetFilter(wsExpression, - nStart, rndFind); + m_ResolveProcessor->SetCurStart(nStart); + nStart = m_ResolveProcessor->GetFilter(wsExpression, nStart, rndFind); if (nStart < 1) { if ((dwStyles & XFA_RESOLVENODE_CreateNode) && !bNextCreate) { CXFA_Node* pDataNode = nullptr; @@ -591,7 +590,7 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode, } if (bNextCreate) { FX_BOOL bCreate = - m_ResolveProcessor->GetNodeHelper()->XFA_ResolveNodes_CreateNode( + m_ResolveProcessor->GetNodeHelper()->ResolveNodes_CreateNode( rndFind.m_wsName, rndFind.m_wsCondition, nStart == wsExpression.GetLength(), this); if (bCreate) { @@ -607,16 +606,14 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode, (dwStyles & XFA_RESOLVENODE_CreateNode)) && nNodes > 1) { CXFA_ResolveNodesData rndBind; - m_ResolveProcessor->XFA_ResolveNodes_GetFilter(wsExpression, nStart, - rndBind); - m_ResolveProcessor->XFA_ResolveNode_SetIndexDataBind( - rndBind.m_wsCondition, i, nNodes); + m_ResolveProcessor->GetFilter(wsExpression, nStart, rndBind); + m_ResolveProcessor->SetIndexDataBind(rndBind.m_wsCondition, i, nNodes); bDataBind = TRUE; } rndFind.m_CurNode = findNodes[i++]; rndFind.m_nLevel = nLevel; rndFind.m_dwFlag = XFA_RESOVENODE_RSTYPE_Nodes; - nRet = m_ResolveProcessor->XFA_ResolveNodes(rndFind); + nRet = m_ResolveProcessor->Resolve(rndFind); if (nRet < 1) { continue; } @@ -649,7 +646,7 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode, m_ResolveProcessor->GetNodeHelper()->m_iCreateCount = 1; } FX_BOOL bCreate = - m_ResolveProcessor->GetNodeHelper()->XFA_ResolveNodes_CreateNode( + m_ResolveProcessor->GetNodeHelper()->ResolveNodes_CreateNode( rndFind.m_wsName, rndFind.m_wsCondition, nStart == wsExpression.GetLength(), this); if (bCreate) { @@ -680,8 +677,8 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refNode, } if (dwStyles & (XFA_RESOLVENODE_CreateNode | XFA_RESOLVENODE_Bind | XFA_RESOLVENODE_BindNew)) { - m_ResolveProcessor->XFA_ResolveNode_SetResultCreateNode( - resolveNodeRS, rndFind.m_wsCondition); + m_ResolveProcessor->SetResultCreateNode(resolveNodeRS, + rndFind.m_wsCondition); if (!bNextCreate && (dwStyles & XFA_RESOLVENODE_CreateNode)) { resolveNodeRS.dwFlags = XFA_RESOVENODE_RSTYPE_ExistNodes; } @@ -712,21 +709,19 @@ CFXJSE_Value* CXFA_ScriptContext::GetJSValueFromMap(CXFA_Object* pObject) { } int32_t CXFA_ScriptContext::GetIndexByName(CXFA_Node* refNode) { CXFA_NodeHelper* lpNodeHelper = m_ResolveProcessor->GetNodeHelper(); - return lpNodeHelper->XFA_GetIndex(refNode, XFA_LOGIC_Transparent, - lpNodeHelper->XFA_NodeIsProperty(refNode), - FALSE); + return lpNodeHelper->GetIndex(refNode, XFA_LOGIC_Transparent, + lpNodeHelper->NodeIsProperty(refNode), FALSE); } int32_t CXFA_ScriptContext::GetIndexByClassName(CXFA_Node* refNode) { CXFA_NodeHelper* lpNodeHelper = m_ResolveProcessor->GetNodeHelper(); - return lpNodeHelper->XFA_GetIndex(refNode, XFA_LOGIC_Transparent, - lpNodeHelper->XFA_NodeIsProperty(refNode), - TRUE); + return lpNodeHelper->GetIndex(refNode, XFA_LOGIC_Transparent, + lpNodeHelper->NodeIsProperty(refNode), TRUE); } void CXFA_ScriptContext::GetSomExpression(CXFA_Node* refNode, CFX_WideString& wsExpression) { CXFA_NodeHelper* lpNodeHelper = m_ResolveProcessor->GetNodeHelper(); - lpNodeHelper->XFA_GetNameExpression(refNode, wsExpression, TRUE, - XFA_LOGIC_Transparent); + lpNodeHelper->GetNameExpression(refNode, wsExpression, TRUE, + XFA_LOGIC_Transparent); } void CXFA_ScriptContext::SetNodesOfRunScript(CXFA_NodeArray* pArray) { m_pScriptNodeArray = pArray; diff --git a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp index e158132170..b8864a6f4f 100644 --- a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.cpp @@ -28,10 +28,9 @@ CScript_LayoutPseudoModel::CScript_LayoutPseudoModel(CXFA_Document* pDocument) XFA_ObjectType::Object, XFA_Element::LayoutPseudoModel) {} CScript_LayoutPseudoModel::~CScript_LayoutPseudoModel() {} -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Ready( - CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute) { +void CScript_LayoutPseudoModel::Ready(CFXJSE_Value* pValue, + FX_BOOL bSetting, + XFA_ATTRIBUTE eAttribute) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { return; @@ -43,9 +42,8 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Ready( int32_t iStatus = pNotify->GetLayoutStatus(); pValue->SetBoolean(iStatus >= 2); } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_HWXY( - CFXJSE_Arguments* pArguments, - XFA_LAYOUTMODEL_HWXY layoutModel) { +void CScript_LayoutPseudoModel::HWXY(CFXJSE_Arguments* pArguments, + XFA_LAYOUTMODEL_HWXY layoutModel) { int32_t iLength = pArguments->GetLength(); if (iLength < 1 || iLength > 3) { const FX_WCHAR* methodName = nullptr; @@ -124,25 +122,20 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_HWXY( if (pValue) pValue->SetFloat(fValue); } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_H( - CFXJSE_Arguments* pArguments) { - Script_LayoutPseudoModel_HWXY(pArguments, XFA_LAYOUTMODEL_H); +void CScript_LayoutPseudoModel::H(CFXJSE_Arguments* pArguments) { + HWXY(pArguments, XFA_LAYOUTMODEL_H); } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_W( - CFXJSE_Arguments* pArguments) { - Script_LayoutPseudoModel_HWXY(pArguments, XFA_LAYOUTMODEL_W); +void CScript_LayoutPseudoModel::W(CFXJSE_Arguments* pArguments) { + HWXY(pArguments, XFA_LAYOUTMODEL_W); } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_X( - CFXJSE_Arguments* pArguments) { - Script_LayoutPseudoModel_HWXY(pArguments, XFA_LAYOUTMODEL_X); +void CScript_LayoutPseudoModel::X(CFXJSE_Arguments* pArguments) { + HWXY(pArguments, XFA_LAYOUTMODEL_X); } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Y( - CFXJSE_Arguments* pArguments) { - Script_LayoutPseudoModel_HWXY(pArguments, XFA_LAYOUTMODEL_Y); +void CScript_LayoutPseudoModel::Y(CFXJSE_Arguments* pArguments) { + HWXY(pArguments, XFA_LAYOUTMODEL_Y); } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_NumberedPageCount( - CFXJSE_Arguments* pArguments, - FX_BOOL bNumbered) { +void CScript_LayoutPseudoModel::NumberedPageCount(CFXJSE_Arguments* pArguments, + FX_BOOL bNumbered) { CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout(); if (!pDocLayout) { return; @@ -167,12 +160,10 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_NumberedPageCount( if (pValue) pValue->SetInteger(iPageCount); } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageCount( - CFXJSE_Arguments* pArguments) { - Script_LayoutPseudoModel_NumberedPageCount(pArguments, TRUE); +void CScript_LayoutPseudoModel::PageCount(CFXJSE_Arguments* pArguments) { + NumberedPageCount(pArguments, TRUE); } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageSpan( - CFXJSE_Arguments* pArguments) { +void CScript_LayoutPseudoModel::PageSpan(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength != 1) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"pageSpan"); @@ -201,16 +192,14 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageSpan( if (pValue) pValue->SetInteger(iPageSpan); } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Page( - CFXJSE_Arguments* pArguments) { - Script_LayoutPseudoModel_PageImp(pArguments, FALSE); +void CScript_LayoutPseudoModel::Page(CFXJSE_Arguments* pArguments) { + PageImp(pArguments, FALSE); } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( - CXFA_LayoutProcessor* pDocLayout, - int32_t iPageNo, - const CFX_WideString& wsType, - FX_BOOL bOnPageArea, - CXFA_NodeArray& retArray) { +void CScript_LayoutPseudoModel::GetObjArray(CXFA_LayoutProcessor* pDocLayout, + int32_t iPageNo, + const CFX_WideString& wsType, + FX_BOOL bOnPageArea, + CXFA_NodeArray& retArray) { CXFA_ContainerLayoutItem* pLayoutPage = pDocLayout->GetPage(iPageNo); if (!pLayoutPage) { return; @@ -337,8 +326,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_GetObjArray( return; } } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageContent( - CFXJSE_Arguments* pArguments) { +void CScript_LayoutPseudoModel::PageContent(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 1 || iLength > 3) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"pageContent"); @@ -366,18 +354,16 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageContent( return; } CXFA_NodeArray retArray; - Script_LayoutPseudoModel_GetObjArray(pDocLayout, iIndex, wsType, bOnPageArea, - retArray); + GetObjArray(pDocLayout, iIndex, wsType, bOnPageArea, retArray); CXFA_ArrayNodeList* pArrayNodeList = new CXFA_ArrayNodeList(m_pDocument); pArrayNodeList->SetArrayNodeList(retArray); pArguments->GetReturnValue()->SetObject( pArrayNodeList, m_pDocument->GetScriptContext()->GetJseNormalClass()); } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageCount( - CFXJSE_Arguments* pArguments) { - Script_LayoutPseudoModel_NumberedPageCount(pArguments, FALSE); +void CScript_LayoutPseudoModel::AbsPageCount(CFXJSE_Arguments* pArguments) { + NumberedPageCount(pArguments, FALSE); } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageCountInBatch( +void CScript_LayoutPseudoModel::AbsPageCountInBatch( CFXJSE_Arguments* pArguments) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { @@ -389,7 +375,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageCountInBatch( if (pValue) pValue->SetInteger(iPageCount); } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetCountInBatch( +void CScript_LayoutPseudoModel::SheetCountInBatch( CFXJSE_Arguments* pArguments) { CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); if (!pNotify) { @@ -401,8 +387,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetCountInBatch( if (pValue) pValue->SetInteger(iPageCount); } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Relayout( - CFXJSE_Arguments* pArguments) { +void CScript_LayoutPseudoModel::Relayout(CFXJSE_Arguments* pArguments) { CXFA_Node* pRootNode = m_pDocument->GetRoot(); CXFA_Node* pFormRoot = pRootNode->GetFirstChildByClass(XFA_Element::Form); ASSERT(pFormRoot); @@ -413,12 +398,10 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Relayout( } pLayoutProcessor->SetForceReLayout(TRUE); } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageSpan( - CFXJSE_Arguments* pArguments) { - Script_LayoutPseudoModel_PageSpan(pArguments); +void CScript_LayoutPseudoModel::AbsPageSpan(CFXJSE_Arguments* pArguments) { + PageSpan(pArguments); } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageInBatch( - CFXJSE_Arguments* pArguments) { +void CScript_LayoutPseudoModel::AbsPageInBatch(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength != 1) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"absPageInBatch"); @@ -450,8 +433,7 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPageInBatch( if (pValue) pValue->SetInteger(iPageCount); } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetInBatch( - CFXJSE_Arguments* pArguments) { +void CScript_LayoutPseudoModel::SheetInBatch(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength != 1) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sheetInBatch"); @@ -483,23 +465,19 @@ void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetInBatch( if (pValue) pValue->SetInteger(iPageCount); } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_Sheet( - CFXJSE_Arguments* pArguments) { - Script_LayoutPseudoModel_PageImp(pArguments, TRUE); +void CScript_LayoutPseudoModel::Sheet(CFXJSE_Arguments* pArguments) { + PageImp(pArguments, TRUE); } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_RelayoutPageArea( - CFXJSE_Arguments* pArguments) {} -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_SheetCount( - CFXJSE_Arguments* pArguments) { - Script_LayoutPseudoModel_NumberedPageCount(pArguments, FALSE); +void CScript_LayoutPseudoModel::RelayoutPageArea(CFXJSE_Arguments* pArguments) { } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_AbsPage( - CFXJSE_Arguments* pArguments) { - Script_LayoutPseudoModel_PageImp(pArguments, TRUE); +void CScript_LayoutPseudoModel::SheetCount(CFXJSE_Arguments* pArguments) { + NumberedPageCount(pArguments, FALSE); +} +void CScript_LayoutPseudoModel::AbsPage(CFXJSE_Arguments* pArguments) { + PageImp(pArguments, TRUE); } -void CScript_LayoutPseudoModel::Script_LayoutPseudoModel_PageImp( - CFXJSE_Arguments* pArguments, - FX_BOOL bAbsPage) { +void CScript_LayoutPseudoModel::PageImp(CFXJSE_Arguments* pArguments, + FX_BOOL bAbsPage) { int32_t iLength = pArguments->GetLength(); if (iLength != 1) { const FX_WCHAR* methodName; diff --git a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h index 506afcd74f..0977f32a94 100644 --- a/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h +++ b/xfa/fxfa/parser/xfa_script_layoutpseudomodel.h @@ -23,43 +23,37 @@ class CScript_LayoutPseudoModel : public CXFA_Object { explicit CScript_LayoutPseudoModel(CXFA_Document* pDocument); ~CScript_LayoutPseudoModel() override; - void Script_LayoutPseudoModel_Ready(CFXJSE_Value* pValue, - FX_BOOL bSetting, - XFA_ATTRIBUTE eAttribute); - - void Script_LayoutPseudoModel_HWXY(CFXJSE_Arguments* pArguments, - XFA_LAYOUTMODEL_HWXY layoutModel); - void Script_LayoutPseudoModel_H(CFXJSE_Arguments* pArguments); - void Script_LayoutPseudoModel_W(CFXJSE_Arguments* pArguments); - void Script_LayoutPseudoModel_X(CFXJSE_Arguments* pArguments); - void Script_LayoutPseudoModel_Y(CFXJSE_Arguments* pArguments); - void Script_LayoutPseudoModel_NumberedPageCount(CFXJSE_Arguments* pArguments, - FX_BOOL bNumbered); - void Script_LayoutPseudoModel_PageCount(CFXJSE_Arguments* pArguments); - void Script_LayoutPseudoModel_PageSpan(CFXJSE_Arguments* pArguments); - void Script_LayoutPseudoModel_Page(CFXJSE_Arguments* pArguments); - void Script_LayoutPseudoModel_PageContent(CFXJSE_Arguments* pArguments); - void Script_LayoutPseudoModel_AbsPageCount(CFXJSE_Arguments* pArguments); - void Script_LayoutPseudoModel_AbsPageCountInBatch( - CFXJSE_Arguments* pArguments); - void Script_LayoutPseudoModel_SheetCountInBatch(CFXJSE_Arguments* pArguments); - void Script_LayoutPseudoModel_Relayout(CFXJSE_Arguments* pArguments); - void Script_LayoutPseudoModel_AbsPageSpan(CFXJSE_Arguments* pArguments); - void Script_LayoutPseudoModel_AbsPageInBatch(CFXJSE_Arguments* pArguments); - void Script_LayoutPseudoModel_SheetInBatch(CFXJSE_Arguments* pArguments); - void Script_LayoutPseudoModel_Sheet(CFXJSE_Arguments* pArguments); - void Script_LayoutPseudoModel_RelayoutPageArea(CFXJSE_Arguments* pArguments); - void Script_LayoutPseudoModel_SheetCount(CFXJSE_Arguments* pArguments); - void Script_LayoutPseudoModel_AbsPage(CFXJSE_Arguments* pArguments); + void Ready(CFXJSE_Value* pValue, FX_BOOL bSetting, XFA_ATTRIBUTE eAttribute); + + void HWXY(CFXJSE_Arguments* pArguments, XFA_LAYOUTMODEL_HWXY layoutModel); + void H(CFXJSE_Arguments* pArguments); + void W(CFXJSE_Arguments* pArguments); + void X(CFXJSE_Arguments* pArguments); + void Y(CFXJSE_Arguments* pArguments); + void NumberedPageCount(CFXJSE_Arguments* pArguments, FX_BOOL bNumbered); + void PageCount(CFXJSE_Arguments* pArguments); + void PageSpan(CFXJSE_Arguments* pArguments); + void Page(CFXJSE_Arguments* pArguments); + void PageContent(CFXJSE_Arguments* pArguments); + void AbsPageCount(CFXJSE_Arguments* pArguments); + void AbsPageCountInBatch(CFXJSE_Arguments* pArguments); + void SheetCountInBatch(CFXJSE_Arguments* pArguments); + void Relayout(CFXJSE_Arguments* pArguments); + void AbsPageSpan(CFXJSE_Arguments* pArguments); + void AbsPageInBatch(CFXJSE_Arguments* pArguments); + void SheetInBatch(CFXJSE_Arguments* pArguments); + void Sheet(CFXJSE_Arguments* pArguments); + void RelayoutPageArea(CFXJSE_Arguments* pArguments); + void SheetCount(CFXJSE_Arguments* pArguments); + void AbsPage(CFXJSE_Arguments* pArguments); protected: - void Script_LayoutPseudoModel_GetObjArray(CXFA_LayoutProcessor* pDocLayout, - int32_t iPageNo, - const CFX_WideString& wsType, - FX_BOOL bOnPageArea, - CXFA_NodeArray& retArray); - void Script_LayoutPseudoModel_PageImp(CFXJSE_Arguments* pArguments, - FX_BOOL bAbsPage); + void GetObjArray(CXFA_LayoutProcessor* pDocLayout, + int32_t iPageNo, + const CFX_WideString& wsType, + FX_BOOL bOnPageArea, + CXFA_NodeArray& retArray); + void PageImp(CFXJSE_Arguments* pArguments, FX_BOOL bAbsPage); }; #endif // XFA_FXFA_PARSER_XFA_SCRIPT_LAYOUTPSEUDOMODEL_H_ diff --git a/xfa/fxfa/parser/xfa_script_logpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_logpseudomodel.cpp index 7e3c90559a..d835bd5057 100644 --- a/xfa/fxfa/parser/xfa_script_logpseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_logpseudomodel.cpp @@ -20,13 +20,8 @@ CScript_LogPseudoModel::CScript_LogPseudoModel(CXFA_Document* pDocument) XFA_ObjectType::Object, XFA_Element::LogPseudoModel) {} CScript_LogPseudoModel::~CScript_LogPseudoModel() {} -void CScript_LogPseudoModel::Script_LogPseudoModel_Message( - CFXJSE_Arguments* pArguments) {} -void CScript_LogPseudoModel::Script_LogPseudoModel_TraceEnabled( - CFXJSE_Arguments* pArguments) {} -void CScript_LogPseudoModel::Script_LogPseudoModel_TraceActivate( - CFXJSE_Arguments* pArguments) {} -void CScript_LogPseudoModel::Script_LogPseudoModel_TraceDeactivate( - CFXJSE_Arguments* pArguments) {} -void CScript_LogPseudoModel::Script_LogPseudoModel_Trace( - CFXJSE_Arguments* pArguments) {} +void CScript_LogPseudoModel::Message(CFXJSE_Arguments* pArguments) {} +void CScript_LogPseudoModel::TraceEnabled(CFXJSE_Arguments* pArguments) {} +void CScript_LogPseudoModel::TraceActivate(CFXJSE_Arguments* pArguments) {} +void CScript_LogPseudoModel::TraceDeactivate(CFXJSE_Arguments* pArguments) {} +void CScript_LogPseudoModel::Trace(CFXJSE_Arguments* pArguments) {} diff --git a/xfa/fxfa/parser/xfa_script_logpseudomodel.h b/xfa/fxfa/parser/xfa_script_logpseudomodel.h index e05b2c7c6e..d344fd5157 100644 --- a/xfa/fxfa/parser/xfa_script_logpseudomodel.h +++ b/xfa/fxfa/parser/xfa_script_logpseudomodel.h @@ -15,11 +15,11 @@ class CScript_LogPseudoModel : public CXFA_Object { explicit CScript_LogPseudoModel(CXFA_Document* pDocument); ~CScript_LogPseudoModel() override; - void Script_LogPseudoModel_Message(CFXJSE_Arguments* pArguments); - void Script_LogPseudoModel_TraceEnabled(CFXJSE_Arguments* pArguments); - void Script_LogPseudoModel_TraceActivate(CFXJSE_Arguments* pArguments); - void Script_LogPseudoModel_TraceDeactivate(CFXJSE_Arguments* pArguments); - void Script_LogPseudoModel_Trace(CFXJSE_Arguments* pArguments); + void Message(CFXJSE_Arguments* pArguments); + void TraceEnabled(CFXJSE_Arguments* pArguments); + void TraceActivate(CFXJSE_Arguments* pArguments); + void TraceDeactivate(CFXJSE_Arguments* pArguments); + void Trace(CFXJSE_Arguments* pArguments); }; #endif // XFA_FXFA_PARSER_XFA_SCRIPT_LOGPSEUDOMODEL_H_ diff --git a/xfa/fxfa/parser/xfa_script_nodehelper.cpp b/xfa/fxfa/parser/xfa_script_nodehelper.cpp index 3a80d89a94..ecb4616d9b 100644 --- a/xfa/fxfa/parser/xfa_script_nodehelper.cpp +++ b/xfa/fxfa/parser/xfa_script_nodehelper.cpp @@ -26,54 +26,51 @@ CXFA_NodeHelper::CXFA_NodeHelper() CXFA_NodeHelper::~CXFA_NodeHelper() {} -CXFA_Node* CXFA_NodeHelper::XFA_ResolveNodes_GetOneChild( - CXFA_Node* parent, - const FX_WCHAR* pwsName, - FX_BOOL bIsClassName) { +CXFA_Node* CXFA_NodeHelper::ResolveNodes_GetOneChild(CXFA_Node* parent, + const FX_WCHAR* pwsName, + FX_BOOL bIsClassName) { if (!parent) { return nullptr; } CXFA_NodeArray siblings; uint32_t uNameHash = FX_HashCode_GetW(CFX_WideStringC(pwsName), false); - XFA_NodeAcc_TraverseAnySiblings(parent, uNameHash, &siblings, bIsClassName); + NodeAcc_TraverseAnySiblings(parent, uNameHash, &siblings, bIsClassName); if (siblings.GetSize() == 0) { return nullptr; } return siblings[0]; } -int32_t CXFA_NodeHelper::XFA_CountSiblings(CXFA_Node* pNode, - XFA_LOGIC_TYPE eLogicType, - CXFA_NodeArray* pSiblings, - FX_BOOL bIsClassName) { +int32_t CXFA_NodeHelper::CountSiblings(CXFA_Node* pNode, + XFA_LOGIC_TYPE eLogicType, + CXFA_NodeArray* pSiblings, + FX_BOOL bIsClassName) { if (!pNode) return 0; - CXFA_Node* parent = - XFA_ResolveNodes_GetParent(pNode, XFA_LOGIC_NoTransparent); + CXFA_Node* parent = ResolveNodes_GetParent(pNode, XFA_LOGIC_NoTransparent); if (!parent) return 0; const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( parent->GetElementType(), pNode->GetElementType(), XFA_XDPPACKET_UNKNOWN); if (!pProperty && eLogicType == XFA_LOGIC_Transparent) { - parent = XFA_ResolveNodes_GetParent(pNode, XFA_LOGIC_Transparent); + parent = ResolveNodes_GetParent(pNode, XFA_LOGIC_Transparent); if (!parent) { return 0; } } if (bIsClassName) { - return XFA_NodeAcc_TraverseSiblings(parent, pNode->GetClassHashCode(), - pSiblings, eLogicType, bIsClassName); + return NodeAcc_TraverseSiblings(parent, pNode->GetClassHashCode(), + pSiblings, eLogicType, bIsClassName); } else { - return XFA_NodeAcc_TraverseSiblings(parent, pNode->GetNameHash(), pSiblings, - eLogicType, bIsClassName); + return NodeAcc_TraverseSiblings(parent, pNode->GetNameHash(), pSiblings, + eLogicType, bIsClassName); } } -int32_t CXFA_NodeHelper::XFA_NodeAcc_TraverseAnySiblings( - CXFA_Node* parent, - uint32_t dNameHash, - CXFA_NodeArray* pSiblings, - FX_BOOL bIsClassName) { +int32_t CXFA_NodeHelper::NodeAcc_TraverseAnySiblings(CXFA_Node* parent, + uint32_t dNameHash, + CXFA_NodeArray* pSiblings, + FX_BOOL bIsClassName) { if (!parent || !pSiblings) { return 0; } @@ -98,8 +95,8 @@ int32_t CXFA_NodeHelper::XFA_NodeAcc_TraverseAnySiblings( if (nCount > 0) { return nCount; } - nCount += XFA_NodeAcc_TraverseAnySiblings(child, dNameHash, pSiblings, - bIsClassName); + nCount += + NodeAcc_TraverseAnySiblings(child, dNameHash, pSiblings, bIsClassName); } CXFA_NodeArray children; parent->GetNodeList(children, XFA_NODEFILTER_Children); @@ -124,18 +121,18 @@ int32_t CXFA_NodeHelper::XFA_NodeAcc_TraverseAnySiblings( if (nCount > 0) { return nCount; } - nCount += XFA_NodeAcc_TraverseAnySiblings(child, dNameHash, pSiblings, - bIsClassName); + nCount += + NodeAcc_TraverseAnySiblings(child, dNameHash, pSiblings, bIsClassName); } return nCount; } -int32_t CXFA_NodeHelper::XFA_NodeAcc_TraverseSiblings(CXFA_Node* parent, - uint32_t dNameHash, - CXFA_NodeArray* pSiblings, - XFA_LOGIC_TYPE eLogicType, - FX_BOOL bIsClassName, - FX_BOOL bIsFindProperty) { +int32_t CXFA_NodeHelper::NodeAcc_TraverseSiblings(CXFA_Node* parent, + uint32_t dNameHash, + CXFA_NodeArray* pSiblings, + XFA_LOGIC_TYPE eLogicType, + FX_BOOL bIsClassName, + FX_BOOL bIsFindProperty) { if (!parent || !pSiblings) { return 0; } @@ -164,8 +161,8 @@ int32_t CXFA_NodeHelper::XFA_NodeAcc_TraverseSiblings(CXFA_Node* parent, } if (child->IsUnnamed() && child->GetElementType() == XFA_Element::PageSet) { - nCount += XFA_NodeAcc_TraverseSiblings(child, dNameHash, pSiblings, - eLogicType, bIsClassName, FALSE); + nCount += NodeAcc_TraverseSiblings(child, dNameHash, pSiblings, + eLogicType, bIsClassName, FALSE); } } if (nCount > 0) { @@ -198,18 +195,17 @@ int32_t CXFA_NodeHelper::XFA_NodeAcc_TraverseSiblings(CXFA_Node* parent, if (eLogicType == XFA_LOGIC_NoTransparent) { continue; } - if (XFA_NodeIsTransparent(child) && + if (NodeIsTransparent(child) && child->GetElementType() != XFA_Element::PageSet) { - nCount += XFA_NodeAcc_TraverseSiblings(child, dNameHash, pSiblings, - eLogicType, bIsClassName, FALSE); + nCount += NodeAcc_TraverseSiblings(child, dNameHash, pSiblings, + eLogicType, bIsClassName, FALSE); } } return nCount; } -CXFA_Node* CXFA_NodeHelper::XFA_ResolveNodes_GetParent( - CXFA_Node* pNode, - XFA_LOGIC_TYPE eLogicType) { +CXFA_Node* CXFA_NodeHelper::ResolveNodes_GetParent(CXFA_Node* pNode, + XFA_LOGIC_TYPE eLogicType) { if (!pNode) { return nullptr; } @@ -219,7 +215,7 @@ CXFA_Node* CXFA_NodeHelper::XFA_ResolveNodes_GetParent( CXFA_Node* parent; CXFA_Node* node = pNode; while (TRUE) { - parent = XFA_ResolveNodes_GetParent(node); + parent = ResolveNodes_GetParent(node); if (!parent) { break; } @@ -233,17 +229,16 @@ CXFA_Node* CXFA_NodeHelper::XFA_ResolveNodes_GetParent( return parent; } -int32_t CXFA_NodeHelper::XFA_GetIndex(CXFA_Node* pNode, - XFA_LOGIC_TYPE eLogicType, - FX_BOOL bIsProperty, - FX_BOOL bIsClassIndex) { - CXFA_Node* parent = - XFA_ResolveNodes_GetParent(pNode, XFA_LOGIC_NoTransparent); +int32_t CXFA_NodeHelper::GetIndex(CXFA_Node* pNode, + XFA_LOGIC_TYPE eLogicType, + FX_BOOL bIsProperty, + FX_BOOL bIsClassIndex) { + CXFA_Node* parent = ResolveNodes_GetParent(pNode, XFA_LOGIC_NoTransparent); if (!parent) { return 0; } if (!bIsProperty && eLogicType == XFA_LOGIC_Transparent) { - parent = XFA_ResolveNodes_GetParent(pNode, XFA_LOGIC_Transparent); + parent = ResolveNodes_GetParent(pNode, XFA_LOGIC_Transparent); if (!parent) { return 0; } @@ -253,8 +248,8 @@ int32_t CXFA_NodeHelper::XFA_GetIndex(CXFA_Node* pNode, dwHashName = pNode->GetClassHashCode(); } CXFA_NodeArray siblings; - int32_t iSize = XFA_NodeAcc_TraverseSiblings(parent, dwHashName, &siblings, - eLogicType, bIsClassIndex); + int32_t iSize = NodeAcc_TraverseSiblings(parent, dwHashName, &siblings, + eLogicType, bIsClassIndex); for (int32_t i = 0; i < iSize; ++i) { CXFA_Node* child = siblings[i]; if (child == pNode) { @@ -264,42 +259,42 @@ int32_t CXFA_NodeHelper::XFA_GetIndex(CXFA_Node* pNode, return 0; } -void CXFA_NodeHelper::XFA_GetNameExpression(CXFA_Node* refNode, - CFX_WideString& wsName, - FX_BOOL bIsAllPath, - XFA_LOGIC_TYPE eLogicType) { +void CXFA_NodeHelper::GetNameExpression(CXFA_Node* refNode, + CFX_WideString& wsName, + FX_BOOL bIsAllPath, + XFA_LOGIC_TYPE eLogicType) { wsName.clear(); if (bIsAllPath) { - XFA_GetNameExpression(refNode, wsName, FALSE, eLogicType); + GetNameExpression(refNode, wsName, FALSE, eLogicType); CFX_WideString wsParent; CXFA_Node* parent = - XFA_ResolveNodes_GetParent(refNode, XFA_LOGIC_NoTransparent); + ResolveNodes_GetParent(refNode, XFA_LOGIC_NoTransparent); while (parent) { - XFA_GetNameExpression(parent, wsParent, FALSE, eLogicType); + GetNameExpression(parent, wsParent, FALSE, eLogicType); wsParent += L"."; wsParent += wsName; wsName = wsParent; - parent = XFA_ResolveNodes_GetParent(parent, XFA_LOGIC_NoTransparent); + parent = ResolveNodes_GetParent(parent, XFA_LOGIC_NoTransparent); } return; } CFX_WideString ws; - FX_BOOL bIsProperty = XFA_NodeIsProperty(refNode); + FX_BOOL bIsProperty = NodeIsProperty(refNode); if (refNode->IsUnnamed() || (bIsProperty && refNode->GetElementType() != XFA_Element::PageSet)) { ws = refNode->GetClassName(); wsName.Format(L"#%s[%d]", ws.c_str(), - XFA_GetIndex(refNode, eLogicType, bIsProperty, TRUE)); + GetIndex(refNode, eLogicType, bIsProperty, TRUE)); return; } ws = refNode->GetCData(XFA_ATTRIBUTE_Name); ws.Replace(L".", L"\\."); wsName.Format(L"%s[%d]", ws.c_str(), - XFA_GetIndex(refNode, eLogicType, bIsProperty, FALSE)); + GetIndex(refNode, eLogicType, bIsProperty, FALSE)); } -FX_BOOL CXFA_NodeHelper::XFA_NodeIsTransparent(CXFA_Node* refNode) { +FX_BOOL CXFA_NodeHelper::NodeIsTransparent(CXFA_Node* refNode) { if (!refNode) { return FALSE; } @@ -312,8 +307,7 @@ FX_BOOL CXFA_NodeHelper::XFA_NodeIsTransparent(CXFA_Node* refNode) { return FALSE; } -FX_BOOL CXFA_NodeHelper::XFA_CreateNode_ForCondition( - CFX_WideString& wsCondition) { +FX_BOOL CXFA_NodeHelper::CreateNode_ForCondition(CFX_WideString& wsCondition) { int32_t iLen = wsCondition.GetLength(); CFX_WideString wsIndex(L"0"); FX_BOOL bAll = FALSE; @@ -351,7 +345,7 @@ FX_BOOL CXFA_NodeHelper::XFA_CreateNode_ForCondition( return FALSE; } -FX_BOOL CXFA_NodeHelper::XFA_ResolveNodes_CreateNode( +FX_BOOL CXFA_NodeHelper::ResolveNodes_CreateNode( CFX_WideString wsName, CFX_WideString wsCondition, FX_BOOL bLastNode, @@ -371,7 +365,7 @@ FX_BOOL CXFA_NodeHelper::XFA_ResolveNodes_CreateNode( wsName = wsName.Right(wsName.GetLength() - 1); } if (m_iCreateCount == 0) { - XFA_CreateNode_ForCondition(wsCondition); + CreateNode_ForCondition(wsCondition); } if (bIsClassName) { XFA_Element eType = XFA_GetElementTypeForName(wsName.AsStringC()); @@ -412,7 +406,7 @@ FX_BOOL CXFA_NodeHelper::XFA_ResolveNodes_CreateNode( return bResult; } -void CXFA_NodeHelper::XFA_SetCreateNodeType(CXFA_Node* refNode) { +void CXFA_NodeHelper::SetCreateNodeType(CXFA_Node* refNode) { if (!refNode) { return; } @@ -427,9 +421,8 @@ void CXFA_NodeHelper::XFA_SetCreateNodeType(CXFA_Node* refNode) { } } -FX_BOOL CXFA_NodeHelper::XFA_NodeIsProperty(CXFA_Node* refNode) { - CXFA_Node* parent = - XFA_ResolveNodes_GetParent(refNode, XFA_LOGIC_NoTransparent); +FX_BOOL CXFA_NodeHelper::NodeIsProperty(CXFA_Node* refNode) { + CXFA_Node* parent = ResolveNodes_GetParent(refNode, XFA_LOGIC_NoTransparent); return parent && refNode && XFA_GetPropertyOfElement(parent->GetElementType(), refNode->GetElementType(), diff --git a/xfa/fxfa/parser/xfa_script_nodehelper.h b/xfa/fxfa/parser/xfa_script_nodehelper.h index ac00f40194..2c9dd8d831 100644 --- a/xfa/fxfa/parser/xfa_script_nodehelper.h +++ b/xfa/fxfa/parser/xfa_script_nodehelper.h @@ -22,44 +22,43 @@ class CXFA_NodeHelper { CXFA_NodeHelper(); ~CXFA_NodeHelper(); - CXFA_Node* XFA_ResolveNodes_GetOneChild(CXFA_Node* parent, - const FX_WCHAR* pwsName, - FX_BOOL bIsClassName = FALSE); - CXFA_Node* XFA_ResolveNodes_GetParent( + CXFA_Node* ResolveNodes_GetOneChild(CXFA_Node* parent, + const FX_WCHAR* pwsName, + FX_BOOL bIsClassName = FALSE); + CXFA_Node* ResolveNodes_GetParent( CXFA_Node* pNode, XFA_LOGIC_TYPE eLogicType = XFA_LOGIC_NoTransparent); - int32_t XFA_NodeAcc_TraverseSiblings(CXFA_Node* parent, - uint32_t dNameHash, - CXFA_NodeArray* pSiblings, - XFA_LOGIC_TYPE eLogicType, - FX_BOOL bIsClassName = FALSE, - FX_BOOL bIsFindProperty = TRUE); - int32_t XFA_NodeAcc_TraverseAnySiblings(CXFA_Node* parent, - uint32_t dNameHash, - CXFA_NodeArray* pSiblings, - FX_BOOL bIsClassName = FALSE); - int32_t XFA_CountSiblings(CXFA_Node* pNode, - XFA_LOGIC_TYPE eLogicType, - CXFA_NodeArray* pSiblings, - FX_BOOL bIsClassName = FALSE); - int32_t XFA_GetIndex(CXFA_Node* pNode, - XFA_LOGIC_TYPE eLogicType = XFA_LOGIC_NoTransparent, - FX_BOOL bIsProperty = FALSE, - FX_BOOL bIsClassIndex = FALSE); - void XFA_GetNameExpression( - CXFA_Node* refNode, - CFX_WideString& wsName, - FX_BOOL bIsAllPath, - XFA_LOGIC_TYPE eLogicType = XFA_LOGIC_NoTransparent); - FX_BOOL XFA_NodeIsTransparent(CXFA_Node* refNode); - FX_BOOL XFA_ResolveNodes_CreateNode(CFX_WideString wsName, - CFX_WideString wsCondition, - FX_BOOL bLastNode, - CXFA_ScriptContext* pScriptContext); - FX_BOOL XFA_CreateNode_ForCondition(CFX_WideString& wsCondition); - void XFA_SetCreateNodeType(CXFA_Node* refNode); - FX_BOOL XFA_NodeIsProperty(CXFA_Node* refNode); + int32_t NodeAcc_TraverseSiblings(CXFA_Node* parent, + uint32_t dNameHash, + CXFA_NodeArray* pSiblings, + XFA_LOGIC_TYPE eLogicType, + FX_BOOL bIsClassName = FALSE, + FX_BOOL bIsFindProperty = TRUE); + int32_t NodeAcc_TraverseAnySiblings(CXFA_Node* parent, + uint32_t dNameHash, + CXFA_NodeArray* pSiblings, + FX_BOOL bIsClassName = FALSE); + int32_t CountSiblings(CXFA_Node* pNode, + XFA_LOGIC_TYPE eLogicType, + CXFA_NodeArray* pSiblings, + FX_BOOL bIsClassName = FALSE); + int32_t GetIndex(CXFA_Node* pNode, + XFA_LOGIC_TYPE eLogicType = XFA_LOGIC_NoTransparent, + FX_BOOL bIsProperty = FALSE, + FX_BOOL bIsClassIndex = FALSE); + void GetNameExpression(CXFA_Node* refNode, + CFX_WideString& wsName, + FX_BOOL bIsAllPath, + XFA_LOGIC_TYPE eLogicType = XFA_LOGIC_NoTransparent); + FX_BOOL NodeIsTransparent(CXFA_Node* refNode); + FX_BOOL ResolveNodes_CreateNode(CFX_WideString wsName, + CFX_WideString wsCondition, + FX_BOOL bLastNode, + CXFA_ScriptContext* pScriptContext); + FX_BOOL CreateNode_ForCondition(CFX_WideString& wsCondition); + void SetCreateNodeType(CXFA_Node* refNode); + FX_BOOL NodeIsProperty(CXFA_Node* refNode); public: XFA_Element m_eLastCreateType; diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp index 2ca137e510..aed23f0b01 100644 --- a/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp +++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.cpp @@ -18,39 +18,39 @@ #include "xfa/fxfa/parser/xfa_utils.h" CXFA_ResolveProcessor::CXFA_ResolveProcessor() - : m_pNodeHelper(new CXFA_NodeHelper), m_iCurStart(0) {} + : m_iCurStart(0), m_pNodeHelper(new CXFA_NodeHelper) {} CXFA_ResolveProcessor::~CXFA_ResolveProcessor() { delete m_pNodeHelper; } -int32_t CXFA_ResolveProcessor::XFA_ResolveNodes(CXFA_ResolveNodesData& rnd) { +int32_t CXFA_ResolveProcessor::Resolve(CXFA_ResolveNodesData& rnd) { if (!rnd.m_CurNode) { return -1; } if (!rnd.m_CurNode->IsNode()) { if (rnd.m_dwStyles & XFA_RESOLVENODE_Attributes) { - return XFA_ResolveNodes_ForAttributeRs(rnd.m_CurNode, rnd, - rnd.m_wsName.AsStringC()); + return ResolveForAttributeRs(rnd.m_CurNode, rnd, + rnd.m_wsName.AsStringC()); } return 0; } if (rnd.m_dwStyles & XFA_RESOLVENODE_AnyChild) { - return XFA_ResolveNodes_AnyChild(rnd); + return ResolveAnyChild(rnd); } FX_WCHAR wch = rnd.m_wsName.GetAt(0); switch (wch) { case '$': - return XFA_ResolveNodes_Dollar(rnd); + return ResolveDollar(rnd); case '!': - return XFA_ResolveNodes_Excalmatory(rnd); + return ResolveExcalmatory(rnd); case '#': - return XFA_ResolveNodes_NumberSign(rnd); + return ResolveNumberSign(rnd); case '*': - return XFA_ResolveNodes_Asterisk(rnd); + return ResolveAsterisk(rnd); // TODO(dsinclair): We could probably remove this. case '.': - return XFA_ResolveNodes_AnyChild(rnd); + return ResolveAnyChild(rnd); default: break; } @@ -65,23 +65,22 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes(CXFA_ResolveNodesData& rnd) { } else if (rnd.m_uHashName == XFA_HASHCODE_Xfa) { rnd.m_Nodes.Add(rnd.m_CurNode); } else if ((rnd.m_dwStyles & XFA_RESOLVENODE_Attributes) && - XFA_ResolveNodes_ForAttributeRs(rnd.m_CurNode, rnd, - rnd.m_wsName.AsStringC())) { + ResolveForAttributeRs(rnd.m_CurNode, rnd, + rnd.m_wsName.AsStringC())) { return 1; } if (rnd.m_Nodes.GetSize() > 0) { - XFA_ResolveNode_FilterCondition(rnd, rnd.m_wsCondition); + FilterCondition(rnd, rnd.m_wsCondition); } return rnd.m_Nodes.GetSize(); } - int32_t nRet = XFA_ResolveNodes_Normal(rnd); + int32_t nRet = ResolveNormal(rnd); if (nRet < 1 && rnd.m_uHashName == XFA_HASHCODE_Xfa) { rnd.m_Nodes.Add(rnd.m_pSC->GetDocument()->GetRoot()); } return rnd.m_Nodes.GetSize(); } -int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_AnyChild( - CXFA_ResolveNodesData& rnd) { +int32_t CXFA_ResolveProcessor::ResolveAnyChild(CXFA_ResolveNodesData& rnd) { CFX_WideString wsName = rnd.m_wsName; CFX_WideString wsCondition = rnd.m_wsCondition; CXFA_Node* findNode = nullptr; @@ -91,7 +90,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_AnyChild( bClassName = TRUE; wsName = wsName.Right(wsName.GetLength() - 1); } - findNode = m_pNodeHelper->XFA_ResolveNodes_GetOneChild( + findNode = m_pNodeHelper->ResolveNodes_GetOneChild( ToNode(rnd.m_CurNode), wsName.c_str(), bClassName); if (!findNode) { return 0; @@ -100,13 +99,12 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_AnyChild( rnd.m_Nodes.Add(findNode); return rnd.m_Nodes.GetSize(); } - m_pNodeHelper->XFA_CountSiblings(findNode, XFA_LOGIC_Transparent, - (CXFA_NodeArray*)&rnd.m_Nodes, bClassName); - XFA_ResolveNode_FilterCondition(rnd, wsCondition); + m_pNodeHelper->CountSiblings(findNode, XFA_LOGIC_Transparent, + (CXFA_NodeArray*)&rnd.m_Nodes, bClassName); + FilterCondition(rnd, wsCondition); return rnd.m_Nodes.GetSize(); } -int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Dollar( - CXFA_ResolveNodesData& rnd) { +int32_t CXFA_ResolveProcessor::ResolveDollar(CXFA_ResolveNodesData& rnd) { CXFA_ObjArray& nodes = rnd.m_Nodes; CFX_WideString wsName = rnd.m_wsName; CFX_WideString wsCondition = rnd.m_wsCondition; @@ -129,12 +127,11 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Dollar( } } if (rnd.m_Nodes.GetSize() > 0) { - XFA_ResolveNode_FilterCondition(rnd, wsCondition); + FilterCondition(rnd, wsCondition); } return rnd.m_Nodes.GetSize(); } -int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Excalmatory( - CXFA_ResolveNodesData& rnd) { +int32_t CXFA_ResolveProcessor::ResolveExcalmatory(CXFA_ResolveNodesData& rnd) { if (rnd.m_nLevel > 0) { return 0; } @@ -152,19 +149,18 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Excalmatory( rndFind.m_nLevel = rnd.m_nLevel + 1; rndFind.m_dwStyles = XFA_RESOLVENODE_Children; rndFind.m_wsCondition = rnd.m_wsCondition; - XFA_ResolveNodes(rndFind); + Resolve(rndFind); if (rndFind.m_Nodes.GetSize() > 0) { rnd.m_Nodes.Append(rndFind.m_Nodes); rndFind.m_Nodes.RemoveAll(); } return rnd.m_Nodes.GetSize(); } -int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_NumberSign( - CXFA_ResolveNodesData& rnd) { +int32_t CXFA_ResolveProcessor::ResolveNumberSign(CXFA_ResolveNodesData& rnd) { CFX_WideString wsName = rnd.m_wsName.Right(rnd.m_wsName.GetLength() - 1); CFX_WideString wsCondition = rnd.m_wsCondition; CXFA_Node* curNode = ToNode(rnd.m_CurNode); - if (XFA_ResolveNodes_ForAttributeRs(curNode, rnd, wsName.AsStringC())) { + if (ResolveForAttributeRs(curNode, rnd, wsName.AsStringC())) { return 1; } CXFA_ResolveNodesData rndFind; @@ -178,7 +174,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_NumberSign( FX_HashCode_GetW(rndFind.m_wsName.AsStringC(), false)); rndFind.m_wsCondition = wsCondition; rndFind.m_CurNode = curNode; - XFA_ResolveNodes_Normal(rndFind); + ResolveNormal(rndFind); if (rndFind.m_Nodes.GetSize() > 0) { if (wsCondition.GetLength() == 0 && rndFind.m_Nodes.Find(curNode) >= 0) { rnd.m_Nodes.Add(curNode); @@ -189,7 +185,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_NumberSign( } return rnd.m_Nodes.GetSize(); } -int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_ForAttributeRs( +int32_t CXFA_ResolveProcessor::ResolveForAttributeRs( CXFA_Object* curNode, CXFA_ResolveNodesData& rnd, const CFX_WideStringC& strAttr) { @@ -203,8 +199,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_ForAttributeRs( } return 0; } -int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( - CXFA_ResolveNodesData& rnd) { +int32_t CXFA_ResolveProcessor::ResolveNormal(CXFA_ResolveNodesData& rnd) { if (rnd.m_nLevel > 32) { return 0; } @@ -256,10 +251,10 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( nodes.Add(pVariablesNode); } else { rndFind.m_CurNode = pVariablesNode; - XFA_ResolveNodes_SetStylesForChild(dwStyles, rndFind); + SetStylesForChild(dwStyles, rndFind); CFX_WideString wsSaveCondition = rndFind.m_wsCondition; rndFind.m_wsCondition.clear(); - XFA_ResolveNodes_Normal(rndFind); + ResolveNormal(rndFind); rndFind.m_wsCondition = wsSaveCondition; if (rndFind.m_Nodes.GetSize() > 0) { nodes.Append(rndFind.m_Nodes); @@ -267,7 +262,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( } } if (nodes.GetSize() > nNum) { - XFA_ResolveNode_FilterCondition(rnd, wsCondition); + FilterCondition(rnd, wsCondition); if (nodes.GetSize() > 0) { return 1; } @@ -288,16 +283,16 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( } else if (child->GetNameHash() == uNameHash) { nodes.Add(child); } - if (m_pNodeHelper->XFA_NodeIsTransparent(child) && + if (m_pNodeHelper->NodeIsTransparent(child) && child->GetElementType() != XFA_Element::PageSet) { if (!bSetFlag) { - XFA_ResolveNodes_SetStylesForChild(dwStyles, rndFind); + SetStylesForChild(dwStyles, rndFind); bSetFlag = TRUE; } rndFind.m_CurNode = child; CFX_WideString wsSaveCondition = rndFind.m_wsCondition; rndFind.m_wsCondition.clear(); - XFA_ResolveNodes_Normal(rndFind); + ResolveNormal(rndFind); rndFind.m_wsCondition = wsSaveCondition; if (rndFind.m_Nodes.GetSize() > 0) { nodes.Append(rndFind.m_Nodes); @@ -308,10 +303,10 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( if (nodes.GetSize() > nNum) { if (!(dwStyles & XFA_RESOLVENODE_ALL)) { CXFA_NodeArray upArrayNodes; - if (m_pNodeHelper->XFA_NodeIsTransparent(ToNode(curNode))) { - m_pNodeHelper->XFA_CountSiblings( - ToNode(nodes[0]), XFA_LOGIC_Transparent, &upArrayNodes, - !!(dwStyles & XFA_RESOLVENODE_TagName)); + if (m_pNodeHelper->NodeIsTransparent(ToNode(curNode))) { + m_pNodeHelper->CountSiblings(ToNode(nodes[0]), XFA_LOGIC_Transparent, + &upArrayNodes, + !!(dwStyles & XFA_RESOLVENODE_TagName)); } if (upArrayNodes.GetSize() > nodes.GetSize()) { upArrayNodes[0] = ToNode(nodes[0]); @@ -320,7 +315,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( upArrayNodes.RemoveAll(); } } - XFA_ResolveNode_FilterCondition(rnd, wsCondition); + FilterCondition(rnd, wsCondition); if (nodes.GetSize() > 0) { return 1; } @@ -328,7 +323,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( } } if (dwStyles & XFA_RESOLVENODE_Attributes) { - if (XFA_ResolveNodes_ForAttributeRs(curNode, rnd, wsName.AsStringC())) { + if (ResolveForAttributeRs(curNode, rnd, wsName.AsStringC())) { return 1; } } @@ -347,7 +342,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( } } if (nodes.GetSize() > nNum) { - XFA_ResolveNode_FilterCondition(rnd, wsCondition); + FilterCondition(rnd, wsCondition); if (nodes.GetSize() > 0) { return 1; } @@ -373,13 +368,13 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( return nodes.GetSize(); } } - CXFA_Node* parentNode = m_pNodeHelper->XFA_ResolveNodes_GetParent( + CXFA_Node* parentNode = m_pNodeHelper->ResolveNodes_GetParent( curNode->AsNode(), XFA_LOGIC_NoTransparent); uint32_t uCurClassHash = curNode->GetClassHashCode(); if (!parentNode) { if (uCurClassHash == uNameHash) { nodes.Add(curNode->AsNode()); - XFA_ResolveNode_FilterCondition(rnd, wsCondition); + FilterCondition(rnd, wsCondition); if (nodes.GetSize() > 0) { return 1; } @@ -433,7 +428,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( bInnerSearch = TRUE; } } else { - if (m_pNodeHelper->XFA_NodeIsTransparent(child)) { + if (m_pNodeHelper->NodeIsTransparent(child)) { bInnerSearch = TRUE; } } @@ -443,7 +438,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( rndFind.m_wsCondition.clear(); uint32_t dwOriginStyle = rndFind.m_dwStyles; rndFind.m_dwStyles = dwOriginStyle | XFA_RESOLVENODE_ALL; - XFA_ResolveNodes_Normal(rndFind); + ResolveNormal(rndFind); rndFind.m_dwStyles = dwOriginStyle; rndFind.m_wsCondition = wsOriginCondition; if (rndFind.m_Nodes.GetSize() > 0) { @@ -454,11 +449,11 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( child = child->GetNodeItem(XFA_NODEITEM_NextSibling); } if (nodes.GetSize() > nNum) { - if (m_pNodeHelper->XFA_NodeIsTransparent(parentNode)) { + if (m_pNodeHelper->NodeIsTransparent(parentNode)) { CXFA_NodeArray upArrayNodes; - m_pNodeHelper->XFA_CountSiblings( - ToNode(nodes[0]), XFA_LOGIC_Transparent, &upArrayNodes, - !!(dwStyles & XFA_RESOLVENODE_TagName)); + m_pNodeHelper->CountSiblings(ToNode(nodes[0]), XFA_LOGIC_Transparent, + &upArrayNodes, + !!(dwStyles & XFA_RESOLVENODE_TagName)); if (upArrayNodes.GetSize() > nodes.GetSize()) { upArrayNodes[0] = ToNode(nodes[0]); nodes.RemoveAll(); @@ -466,7 +461,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( upArrayNodes.RemoveAll(); } } - XFA_ResolveNode_FilterCondition(rnd, wsCondition); + FilterCondition(rnd, wsCondition); if (nodes.GetSize() > 0) { return 1; } @@ -486,7 +481,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( rndFind.m_CurNode = parentNode; CXFA_NodeArray& array = rnd.m_pSC->GetUpObjectArray(); array.Add(parentNode); - XFA_ResolveNodes_Normal(rndFind); + ResolveNormal(rndFind); if (rndFind.m_Nodes.GetSize() > 0) { nodes.Append(rndFind.m_Nodes); rndFind.m_Nodes.RemoveAll(); @@ -497,8 +492,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Normal( } return 0; } -int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Asterisk( - CXFA_ResolveNodesData& rnd) { +int32_t CXFA_ResolveProcessor::ResolveAsterisk(CXFA_ResolveNodesData& rnd) { CXFA_Node* curNode = ToNode(rnd.m_CurNode); CXFA_ObjArray& nodes = rnd.m_Nodes; CXFA_NodeArray array; @@ -507,8 +501,7 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_Asterisk( nodes.Append((CXFA_ObjArray&)array); return nodes.GetSize(); } -int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_PopStack( - CFX_Int32Array& stack) { +int32_t CXFA_ResolveProcessor::ResolvePopStack(CFX_Int32Array& stack) { int32_t nType = -1; int32_t iSize = stack.GetSize() - 1; if (iSize > -1) { @@ -517,10 +510,9 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_PopStack( } return nType; } -int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_GetFilter( - const CFX_WideStringC& wsExpression, - int32_t nStart, - CXFA_ResolveNodesData& rnd) { +int32_t CXFA_ResolveProcessor::GetFilter(const CFX_WideStringC& wsExpression, + int32_t nStart, + CXFA_ResolveNodesData& rnd) { ASSERT(nStart > -1); int32_t iLength = wsExpression.GetLength(); if (nStart >= iLength) { @@ -570,19 +562,19 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_GetFilter( switch (nType) { case 0: if (wCur == ']') { - nType = XFA_ResolveNodes_PopStack(stack); + nType = ResolvePopStack(stack); bRecursive = FALSE; } break; case 1: if (wCur == ')') { - nType = XFA_ResolveNodes_PopStack(stack); + nType = ResolvePopStack(stack); bRecursive = FALSE; } break; case 2: if (wCur == '"') { - nType = XFA_ResolveNodes_PopStack(stack); + nType = ResolvePopStack(stack); bRecursive = FALSE; } break; @@ -618,11 +610,10 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNodes_GetFilter( static_cast(FX_HashCode_GetW(wsName.AsStringC(), false)); return nStart; } -void CXFA_ResolveProcessor::XFA_ResolveNode_ConditionArray( - int32_t iCurIndex, - CFX_WideString wsCondition, - int32_t iFoundCount, - CXFA_ResolveNodesData& rnd) { +void CXFA_ResolveProcessor::ConditionArray(int32_t iCurIndex, + CFX_WideString wsCondition, + int32_t iFoundCount, + CXFA_ResolveNodesData& rnd) { CXFA_NodeArray& findNodes = (CXFA_NodeArray&)rnd.m_Nodes; int32_t iLen = wsCondition.GetLength(); FX_BOOL bRelative = FALSE; @@ -685,11 +676,10 @@ void CXFA_ResolveProcessor::XFA_ResolveNode_ConditionArray( findNodes.Add(ret); } } -void CXFA_ResolveProcessor::XFA_ResolveNode_DoPredicateFilter( - int32_t iCurIndex, - CFX_WideString wsCondition, - int32_t iFoundCount, - CXFA_ResolveNodesData& rnd) { +void CXFA_ResolveProcessor::DoPredicateFilter(int32_t iCurIndex, + CFX_WideString wsCondition, + int32_t iFoundCount, + CXFA_ResolveNodesData& rnd) { CXFA_NodeArray& findNodes = (CXFA_NodeArray&)rnd.m_Nodes; ASSERT(iFoundCount == findNodes.GetSize()); CFX_WideString wsExpression; @@ -718,23 +708,22 @@ void CXFA_ResolveProcessor::XFA_ResolveNode_DoPredicateFilter( } } -void CXFA_ResolveProcessor::XFA_ResolveNode_FilterCondition( - CXFA_ResolveNodesData& rnd, - CFX_WideString wsCondition) { +void CXFA_ResolveProcessor::FilterCondition(CXFA_ResolveNodesData& rnd, + CFX_WideString wsCondition) { CXFA_NodeArray& findNodes = (CXFA_NodeArray&)rnd.m_Nodes; int32_t iCurrIndex = 0; const CXFA_NodeArray& array = rnd.m_pSC->GetUpObjectArray(); int32_t iSize = array.GetSize(); if (iSize) { CXFA_Node* curNode = array[iSize - 1]; - FX_BOOL bIsProperty = m_pNodeHelper->XFA_NodeIsProperty(curNode); + FX_BOOL bIsProperty = m_pNodeHelper->NodeIsProperty(curNode); if (curNode->IsUnnamed() || (bIsProperty && curNode->GetElementType() != XFA_Element::PageSet)) { - iCurrIndex = m_pNodeHelper->XFA_GetIndex(curNode, XFA_LOGIC_Transparent, - bIsProperty, TRUE); + iCurrIndex = m_pNodeHelper->GetIndex(curNode, XFA_LOGIC_Transparent, + bIsProperty, TRUE); } else { - iCurrIndex = m_pNodeHelper->XFA_GetIndex(curNode, XFA_LOGIC_Transparent, - bIsProperty, FALSE); + iCurrIndex = m_pNodeHelper->GetIndex(curNode, XFA_LOGIC_Transparent, + bIsProperty, FALSE); } } int32_t iFoundCount = findNodes.GetSize(); @@ -765,7 +754,7 @@ void CXFA_ResolveProcessor::XFA_ResolveNode_FilterCondition( FX_WCHAR wTypeChar = wsCondition[0]; switch (wTypeChar) { case '[': - XFA_ResolveNode_ConditionArray(iCurrIndex, wsCondition, iFoundCount, rnd); + ConditionArray(iCurrIndex, wsCondition, iFoundCount, rnd); return; case '(': return; @@ -773,16 +762,14 @@ void CXFA_ResolveProcessor::XFA_ResolveNode_FilterCondition( return; case '.': if (iLen > 1 && (wsCondition[1] == '[' || wsCondition[1] == '(')) { - XFA_ResolveNode_DoPredicateFilter(iCurrIndex, wsCondition, iFoundCount, - rnd); + DoPredicateFilter(iCurrIndex, wsCondition, iFoundCount, rnd); } default: return; } } -void CXFA_ResolveProcessor::XFA_ResolveNodes_SetStylesForChild( - uint32_t dwParentStyles, - CXFA_ResolveNodesData& rnd) { +void CXFA_ResolveProcessor::SetStylesForChild(uint32_t dwParentStyles, + CXFA_ResolveNodesData& rnd) { uint32_t dwSubStyles = XFA_RESOLVENODE_Children; if (dwParentStyles & XFA_RESOLVENODE_TagName) { dwSubStyles |= XFA_RESOLVENODE_TagName; @@ -793,13 +780,13 @@ void CXFA_ResolveProcessor::XFA_ResolveNodes_SetStylesForChild( dwSubStyles |= XFA_RESOLVENODE_ALL; rnd.m_dwStyles = dwSubStyles; } -int32_t CXFA_ResolveProcessor::XFA_ResolveNode_SetResultCreateNode( +int32_t CXFA_ResolveProcessor::SetResultCreateNode( XFA_RESOLVENODE_RS& resolveNodeRS, CFX_WideString& wsLastCondition) { if (m_pNodeHelper->m_pCreateParent) { resolveNodeRS.nodes.Add(m_pNodeHelper->m_pCreateParent); } else { - m_pNodeHelper->XFA_CreateNode_ForCondition(wsLastCondition); + m_pNodeHelper->CreateNode_ForCondition(wsLastCondition); } resolveNodeRS.dwFlags = m_pNodeHelper->m_iCreateFlag; if (resolveNodeRS.dwFlags == XFA_RESOLVENODE_RSTYPE_CreateNodeOne) { @@ -809,11 +796,10 @@ int32_t CXFA_ResolveProcessor::XFA_ResolveNode_SetResultCreateNode( } return resolveNodeRS.nodes.GetSize(); } -void CXFA_ResolveProcessor::XFA_ResolveNode_SetIndexDataBind( - CFX_WideString& wsNextCondition, - int32_t& iIndex, - int32_t iCount) { - if (m_pNodeHelper->XFA_CreateNode_ForCondition(wsNextCondition)) { +void CXFA_ResolveProcessor::SetIndexDataBind(CFX_WideString& wsNextCondition, + int32_t& iIndex, + int32_t iCount) { + if (m_pNodeHelper->CreateNode_ForCondition(wsNextCondition)) { if (m_pNodeHelper->m_eLastCreateType == XFA_Element::DataGroup) { iIndex = 0; } else { diff --git a/xfa/fxfa/parser/xfa_script_resolveprocessor.h b/xfa/fxfa/parser/xfa_script_resolveprocessor.h index ffcd9b4475..d8f16b1e50 100644 --- a/xfa/fxfa/parser/xfa_script_resolveprocessor.h +++ b/xfa/fxfa/parser/xfa_script_resolveprocessor.h @@ -35,44 +35,44 @@ class CXFA_ResolveProcessor { CXFA_ResolveProcessor(); ~CXFA_ResolveProcessor(); - int32_t XFA_ResolveNodes(CXFA_ResolveNodesData& rnd); - int32_t XFA_ResolveNodes_AnyChild(CXFA_ResolveNodesData& rnd); - int32_t XFA_ResolveNodes_Dollar(CXFA_ResolveNodesData& rnd); - int32_t XFA_ResolveNodes_Excalmatory(CXFA_ResolveNodesData& rnd); - int32_t XFA_ResolveNodes_NumberSign(CXFA_ResolveNodesData& rnd); - int32_t XFA_ResolveNodes_Asterisk(CXFA_ResolveNodesData& rnd); - int32_t XFA_ResolveNodes_Normal(CXFA_ResolveNodesData& rnd); - int32_t XFA_ResolveNodes_ForAttributeRs(CXFA_Object* curNode, - CXFA_ResolveNodesData& rnd, - const CFX_WideStringC& strAttr); - void XFA_ResolveNode_ConditionArray(int32_t iCurIndex, - CFX_WideString wsCondition, - int32_t iFoundCount, - CXFA_ResolveNodesData& rnd); - void XFA_ResolveNode_DoPredicateFilter(int32_t iCurIndex, - CFX_WideString wsCondition, - int32_t iFoundCount, - CXFA_ResolveNodesData& rnd); - int32_t XFA_ResolveNodes_GetFilter(const CFX_WideStringC& wsExpression, - int32_t nStart, - CXFA_ResolveNodesData& rnd); - void XFA_ResolveNode_FilterCondition(CXFA_ResolveNodesData& rnd, - CFX_WideString wsCondition); - int32_t XFA_ResolveNodes_PopStack(CFX_Int32Array& stack); - void XFA_ResolveNodes_SetStylesForChild(uint32_t dwParentStyles, - CXFA_ResolveNodesData& rnd); - int32_t XFA_ResolveNode_SetResultCreateNode(XFA_RESOLVENODE_RS& resolveNodeRS, - CFX_WideString& wsLastCondition); - void XFA_ResolveNode_SetIndexDataBind(CFX_WideString& wsNextCondition, - int32_t& iIndex, - int32_t iCount); + int32_t Resolve(CXFA_ResolveNodesData& rnd); + int32_t GetFilter(const CFX_WideStringC& wsExpression, + int32_t nStart, + CXFA_ResolveNodesData& rnd); + int32_t SetResultCreateNode(XFA_RESOLVENODE_RS& resolveNodeRS, + CFX_WideString& wsLastCondition); + void SetIndexDataBind(CFX_WideString& wsNextCondition, + int32_t& iIndex, + int32_t iCount); + void SetCurStart(int32_t start) { m_iCurStart = start; } + CXFA_NodeHelper* GetNodeHelper() { return m_pNodeHelper; } private: - CXFA_NodeHelper* m_pNodeHelper; + int32_t ResolveForAttributeRs(CXFA_Object* curNode, + CXFA_ResolveNodesData& rnd, + const CFX_WideStringC& strAttr); + int32_t ResolveAnyChild(CXFA_ResolveNodesData& rnd); + int32_t ResolveDollar(CXFA_ResolveNodesData& rnd); + int32_t ResolveExcalmatory(CXFA_ResolveNodesData& rnd); + int32_t ResolveNumberSign(CXFA_ResolveNodesData& rnd); + int32_t ResolveAsterisk(CXFA_ResolveNodesData& rnd); + int32_t ResolveNormal(CXFA_ResolveNodesData& rnd); + int32_t ResolvePopStack(CFX_Int32Array& stack); + void SetStylesForChild(uint32_t dwParentStyles, CXFA_ResolveNodesData& rnd); + + void ConditionArray(int32_t iCurIndex, + CFX_WideString wsCondition, + int32_t iFoundCount, + CXFA_ResolveNodesData& rnd); + void DoPredicateFilter(int32_t iCurIndex, + CFX_WideString wsCondition, + int32_t iFoundCount, + CXFA_ResolveNodesData& rnd); + void FilterCondition(CXFA_ResolveNodesData& rnd, CFX_WideString wsCondition); - public: int32_t m_iCurStart; + CXFA_NodeHelper* m_pNodeHelper; }; #endif // XFA_FXFA_PARSER_XFA_SCRIPT_RESOLVEPROCESSOR_H_ diff --git a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp index 2d7e1860cf..007820c47c 100644 --- a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp +++ b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp @@ -24,8 +24,7 @@ CScript_SignaturePseudoModel::CScript_SignaturePseudoModel( XFA_ObjectType::Object, XFA_Element::SignaturePseudoModel) {} CScript_SignaturePseudoModel::~CScript_SignaturePseudoModel() {} -void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Verify( - CFXJSE_Arguments* pArguments) { +void CScript_SignaturePseudoModel::Verify(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 1 || iLength > 4) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"verify"); @@ -45,8 +44,7 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Verify( if (pValue) pValue->SetInteger(bVerify); } -void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Sign( - CFXJSE_Arguments* pArguments) { +void CScript_SignaturePseudoModel::Sign(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 3 || iLength > 7) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sign"); @@ -77,8 +75,7 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Sign( if (pValue) pValue->SetBoolean(bSign); } -void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Enumerate( - CFXJSE_Arguments* pArguments) { +void CScript_SignaturePseudoModel::Enumerate(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength != 0) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"enumerate"); @@ -95,8 +92,7 @@ void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Enumerate( pArguments->GetReturnValue()->Assign( m_pDocument->GetScriptContext()->GetJSValueFromMap(pList)); } -void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Clear( - CFXJSE_Arguments* pArguments) { +void CScript_SignaturePseudoModel::Clear(CFXJSE_Arguments* pArguments) { int32_t iLength = pArguments->GetLength(); if (iLength < 1 || iLength > 2) { ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clear"); diff --git a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.h b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.h index 4fdb96c486..0ced36c841 100644 --- a/xfa/fxfa/parser/xfa_script_signaturepseudomodel.h +++ b/xfa/fxfa/parser/xfa_script_signaturepseudomodel.h @@ -12,13 +12,13 @@ class CScript_SignaturePseudoModel : public CXFA_Object { public: - CScript_SignaturePseudoModel(CXFA_Document* pDocument); + explicit CScript_SignaturePseudoModel(CXFA_Document* pDocument); ~CScript_SignaturePseudoModel() override; - void Script_SignaturePseudoModel_Verify(CFXJSE_Arguments* pArguments); - void Script_SignaturePseudoModel_Sign(CFXJSE_Arguments* pArguments); - void Script_SignaturePseudoModel_Enumerate(CFXJSE_Arguments* pArguments); - void Script_SignaturePseudoModel_Clear(CFXJSE_Arguments* pArguments); + void Verify(CFXJSE_Arguments* pArguments); + void Sign(CFXJSE_Arguments* pArguments); + void Enumerate(CFXJSE_Arguments* pArguments); + void Clear(CFXJSE_Arguments* pArguments); }; #endif // XFA_FXFA_PARSER_XFA_SCRIPT_SIGNATUREPSEUDOMODEL_H_ diff --git a/xfa/fxfa/parser/xfa_utils.h b/xfa/fxfa/parser/xfa_utils.h index a9101092a8..0aa9064288 100644 --- a/xfa/fxfa/parser/xfa_utils.h +++ b/xfa/fxfa/parser/xfa_utils.h @@ -162,9 +162,7 @@ class CXFA_NodeIteratorTemplate { CFX_StackTemplate m_NodeStack; }; -CXFA_Node* XFA_CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType); CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData); -FX_DOUBLE XFA_WideStringToDouble(const CFX_WideString& wsStringVal); FX_DOUBLE XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal); int32_t XFA_MapRotation(int32_t nRotation); @@ -173,8 +171,6 @@ void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode, CFX_WideString& wsPlainText); FX_BOOL XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode); IFX_Stream* XFA_CreateWideTextRead(const CFX_WideString& wsBuffer); -FX_BOOL XFA_IsLayoutElement(XFA_Element eElement, - FX_BOOL bLayoutContainer = FALSE); void XFA_DataExporter_DealWithDataGroupNode(CXFA_Node* pDataNode); void XFA_DataExporter_RegenerateFormFile(CXFA_Node* pNode, diff --git a/xfa/fxfa/parser/xfa_utils_imp.cpp b/xfa/fxfa/parser/xfa_utils_imp.cpp index f5da036498..5a7c2d1104 100644 --- a/xfa/fxfa/parser/xfa_utils_imp.cpp +++ b/xfa/fxfa/parser/xfa_utils_imp.cpp @@ -16,133 +16,107 @@ #include "xfa/fxfa/parser/xfa_parser.h" #include "xfa/fxfa/parser/xfa_script.h" -CXFA_Node* XFA_CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) { - XFA_Element eType = pNode->GetElementType(); - eWidgetType = eType; - if (eType != XFA_Element::Field && eType != XFA_Element::Draw) { - return nullptr; +namespace { + +const FX_DOUBLE fraction_scales[] = {0.1, + 0.01, + 0.001, + 0.0001, + 0.00001, + 0.000001, + 0.0000001, + 0.00000001, + 0.000000001, + 0.0000000001, + 0.00000000001, + 0.000000000001, + 0.0000000000001, + 0.00000000000001, + 0.000000000000001, + 0.0000000000000001}; + +FX_DOUBLE WideStringToDouble(const CFX_WideString& wsStringVal) { + CFX_WideString wsValue = wsStringVal; + wsValue.TrimLeft(); + wsValue.TrimRight(); + int64_t nIntegral = 0; + uint32_t dwFractional = 0; + int32_t nExponent = 0; + int32_t cc = 0; + bool bNegative = false; + bool bExpSign = false; + const FX_WCHAR* str = wsValue.c_str(); + int32_t len = wsValue.GetLength(); + if (str[0] == '+') { + cc++; + } else if (str[0] == '-') { + bNegative = true; + cc++; } - eWidgetType = XFA_Element::Unknown; - XFA_Element eUIType = XFA_Element::Unknown; - CXFA_Value defValue(pNode->GetProperty(0, XFA_Element::Value, TRUE)); - XFA_Element eValueType = defValue.GetChildValueClassID(); - switch (eValueType) { - case XFA_Element::Boolean: - eUIType = XFA_Element::CheckButton; - break; - case XFA_Element::Integer: - case XFA_Element::Decimal: - case XFA_Element::Float: - eUIType = XFA_Element::NumericEdit; - break; - case XFA_Element::ExData: - case XFA_Element::Text: - eUIType = XFA_Element::TextEdit; - eWidgetType = XFA_Element::Text; - break; - case XFA_Element::Date: - case XFA_Element::Time: - case XFA_Element::DateTime: - eUIType = XFA_Element::DateTimeEdit; - break; - case XFA_Element::Image: - eUIType = XFA_Element::ImageEdit; - eWidgetType = XFA_Element::Image; - break; - case XFA_Element::Arc: - case XFA_Element::Line: - case XFA_Element::Rectangle: - eUIType = XFA_Element::DefaultUi; - eWidgetType = eValueType; - break; - default: + int32_t nIntegralLen = 0; + while (cc < len) { + if (str[cc] == '.' || str[cc] == 'E' || str[cc] == 'e' || + nIntegralLen > 17) { break; - } - CXFA_Node* pUIChild = nullptr; - CXFA_Node* pUI = pNode->GetProperty(0, XFA_Element::Ui, TRUE); - CXFA_Node* pChild = pUI->GetNodeItem(XFA_NODEITEM_FirstChild); - for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { - XFA_Element eChildType = pChild->GetElementType(); - if (eChildType == XFA_Element::Extras || - eChildType == XFA_Element::Picture) { - continue; } - const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( - XFA_Element::Ui, eChildType, XFA_XDPPACKET_Form); - if (pProperty && (pProperty->uFlags & XFA_PROPERTYFLAG_OneOf)) { - pUIChild = pChild; - break; + if (!FXSYS_isDecimalDigit(str[cc])) { + return 0; } + nIntegral = nIntegral * 10 + str[cc] - '0'; + cc++; + nIntegralLen++; } - if (eType == XFA_Element::Draw) { - XFA_Element eDraw = - pUIChild ? pUIChild->GetElementType() : XFA_Element::Unknown; - switch (eDraw) { - case XFA_Element::TextEdit: - eWidgetType = XFA_Element::Text; - break; - case XFA_Element::ImageEdit: - eWidgetType = XFA_Element::Image; + nIntegral = bNegative ? -nIntegral : nIntegral; + int32_t scale = 0; + FX_DOUBLE fraction = 0.0; + if (cc < len && str[cc] == '.') { + cc++; + while (cc < len) { + fraction += fraction_scales[scale] * (str[cc] - '0'); + scale++; + cc++; + if (cc == len) { break; - default: - eWidgetType = eWidgetType == XFA_Element::Unknown ? XFA_Element::Text - : eWidgetType; + } + if (scale == sizeof(fraction_scales) / sizeof(FX_DOUBLE) || + str[cc] == 'E' || str[cc] == 'e') { break; + } + if (!FXSYS_isDecimalDigit(str[cc])) { + return 0; + } } - } else { - if (pUIChild && pUIChild->GetElementType() == XFA_Element::DefaultUi) { - eWidgetType = XFA_Element::TextEdit; - } else { - eWidgetType = - pUIChild ? pUIChild->GetElementType() - : (eUIType == XFA_Element::Unknown ? XFA_Element::TextEdit - : eUIType); - } + dwFractional = (uint32_t)(fraction * 4294967296.0); } - if (!pUIChild) { - if (eUIType == XFA_Element::Unknown) { - eUIType = XFA_Element::TextEdit; - defValue.GetNode()->GetProperty(0, XFA_Element::Text, TRUE); + if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) { + cc++; + if (cc < len) { + if (str[cc] == '+') { + cc++; + } else if (str[cc] == '-') { + bExpSign = true; + cc++; + } } - pUIChild = pUI->GetProperty(0, eUIType, TRUE); - } else if (eUIType == XFA_Element::Unknown) { - switch (pUIChild->GetElementType()) { - case XFA_Element::CheckButton: { - eValueType = XFA_Element::Text; - if (CXFA_Node* pItems = pNode->GetChild(0, XFA_Element::Items)) { - if (CXFA_Node* pItem = pItems->GetChild(0, XFA_Element::Unknown)) { - eValueType = pItem->GetElementType(); - } - } - } break; - case XFA_Element::DateTimeEdit: - eValueType = XFA_Element::DateTime; - break; - case XFA_Element::ImageEdit: - eValueType = XFA_Element::Image; - break; - case XFA_Element::NumericEdit: - eValueType = XFA_Element::Float; - break; - case XFA_Element::ChoiceList: { - eValueType = (pUIChild->GetEnum(XFA_ATTRIBUTE_Open) == - XFA_ATTRIBUTEENUM_MultiSelect) - ? XFA_Element::ExData - : XFA_Element::Text; - } break; - case XFA_Element::Barcode: - case XFA_Element::Button: - case XFA_Element::PasswordEdit: - case XFA_Element::Signature: - case XFA_Element::TextEdit: - default: - eValueType = XFA_Element::Text; - break; + while (cc < len) { + if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc])) { + return 0; + } + nExponent = nExponent * 10 + str[cc] - '0'; + cc++; } - defValue.GetNode()->GetProperty(0, eValueType, TRUE); + nExponent = bExpSign ? -nExponent : nExponent; } - return pUIChild; + FX_DOUBLE dValue = (dwFractional / 4294967296.0); + dValue = nIntegral + (nIntegral >= 0 ? dValue : -dValue); + if (nExponent != 0) { + dValue *= FXSYS_pow(10, (FX_FLOAT)nExponent); + } + return dValue; } + +} // namespace + CXFA_LocaleValue XFA_GetLocaleValue(CXFA_WidgetData* pWidgetData) { CXFA_Node* pNodeValue = pWidgetData->GetNode()->GetChild(0, XFA_Element::Value); @@ -246,122 +220,10 @@ FX_BOOL XFA_FieldIsMultiListBox(CXFA_Node* pFieldNode) { } return bRet; } -FX_BOOL XFA_IsLayoutElement(XFA_Element eElement, FX_BOOL bLayoutContainer) { - switch (eElement) { - case XFA_Element::Draw: - case XFA_Element::Field: - case XFA_Element::InstanceManager: - return !bLayoutContainer; - case XFA_Element::Area: - case XFA_Element::Subform: - case XFA_Element::ExclGroup: - case XFA_Element::SubformSet: - case XFA_Element::PageArea: - case XFA_Element::Form: - return TRUE; - default: - return FALSE; - } -} - -static const FX_DOUBLE fraction_scales[] = {0.1, - 0.01, - 0.001, - 0.0001, - 0.00001, - 0.000001, - 0.0000001, - 0.00000001, - 0.000000001, - 0.0000000001, - 0.00000000001, - 0.000000000001, - 0.0000000000001, - 0.00000000000001, - 0.000000000000001, - 0.0000000000000001}; -FX_DOUBLE XFA_WideStringToDouble(const CFX_WideString& wsStringVal) { - CFX_WideString wsValue = wsStringVal; - wsValue.TrimLeft(); - wsValue.TrimRight(); - int64_t nIntegral = 0; - uint32_t dwFractional = 0; - int32_t nExponent = 0; - int32_t cc = 0; - FX_BOOL bNegative = FALSE, bExpSign = FALSE; - const FX_WCHAR* str = wsValue.c_str(); - int32_t len = wsValue.GetLength(); - if (str[0] == '+') { - cc++; - } else if (str[0] == '-') { - bNegative = TRUE; - cc++; - } - int32_t nIntegralLen = 0; - while (cc < len) { - if (str[cc] == '.' || str[cc] == 'E' || str[cc] == 'e' || - nIntegralLen > 17) { - break; - } - if (!FXSYS_isDecimalDigit(str[cc])) { - return 0; - } - nIntegral = nIntegral * 10 + str[cc] - '0'; - cc++; - nIntegralLen++; - } - nIntegral = bNegative ? -nIntegral : nIntegral; - int32_t scale = 0; - FX_DOUBLE fraction = 0.0; - if (cc < len && str[cc] == '.') { - cc++; - while (cc < len) { - fraction += fraction_scales[scale] * (str[cc] - '0'); - scale++; - cc++; - if (cc == len) { - break; - } - if (scale == sizeof(fraction_scales) / sizeof(FX_DOUBLE) || - str[cc] == 'E' || str[cc] == 'e') { - break; - } - if (!FXSYS_isDecimalDigit(str[cc])) { - return 0; - } - } - dwFractional = (uint32_t)(fraction * 4294967296.0); - } - if (cc < len && (str[cc] == 'E' || str[cc] == 'e')) { - cc++; - if (cc < len) { - if (str[cc] == '+') { - cc++; - } else if (str[cc] == '-') { - bExpSign = TRUE; - cc++; - } - } - while (cc < len) { - if (str[cc] == '.' || !FXSYS_isDecimalDigit(str[cc])) { - return 0; - } - nExponent = nExponent * 10 + str[cc] - '0'; - cc++; - } - nExponent = bExpSign ? -nExponent : nExponent; - } - FX_DOUBLE dValue = (dwFractional / 4294967296.0); - dValue = nIntegral + (nIntegral >= 0 ? dValue : -dValue); - if (nExponent != 0) { - dValue *= FXSYS_pow(10, (FX_FLOAT)nExponent); - } - return dValue; -} FX_DOUBLE XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal) { CFX_WideString wsValue = CFX_WideString::FromUTF8(szStringVal); - return XFA_WideStringToDouble(wsValue); + return WideStringToDouble(wsValue); } int32_t XFA_MapRotation(int32_t nRotation) { -- cgit v1.2.3