diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-11-07 21:42:05 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-07 21:42:05 +0000 |
commit | 255e61ed20e42917e0055710fb5be56b2ad40afc (patch) | |
tree | a834a34df4b2db89118012139f6b7ca346748939 | |
parent | 5bd9a0bf3a6bf81c3706df595387f9fc497bbd72 (diff) | |
download | pdfium-255e61ed20e42917e0055710fb5be56b2ad40afc.tar.xz |
Rename CXFA_Validate to CXFA_ValidateData
This CL renames CXFA_Validate to CXFA_ValidateData to signify it is part
of the data hierarchy.
Change-Id: Ib6f743513160990b6d64c4b10618f16554dc5c08
Reviewed-on: https://pdfium-review.googlesource.com/18017
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
-rw-r--r-- | BUILD.gn | 4 | ||||
-rw-r--r-- | fxjs/cjx_node.cpp | 28 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffdocview.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffwidgethandler.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_widgetacc.cpp | 39 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_widgetacc.h | 7 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_validatedata.cpp (renamed from xfa/fxfa/parser/cxfa_validate.cpp) | 36 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_validatedata.h (renamed from xfa/fxfa/parser/cxfa_validate.h) | 10 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_widgetdata.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_widgetdata.h | 4 |
10 files changed, 71 insertions, 69 deletions
@@ -1884,8 +1884,8 @@ if (pdf_enable_xfa) { "xfa/fxfa/parser/cxfa_traversestrategy_layoutitem.h", "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h", "xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h", - "xfa/fxfa/parser/cxfa_validate.cpp", - "xfa/fxfa/parser/cxfa_validate.h", + "xfa/fxfa/parser/cxfa_validatedata.cpp", + "xfa/fxfa/parser/cxfa_validatedata.h", "xfa/fxfa/parser/cxfa_value.cpp", "xfa/fxfa/parser/cxfa_value.h", "xfa/fxfa/parser/cxfa_valuearray.cpp", diff --git a/fxjs/cjx_node.cpp b/fxjs/cjx_node.cpp index 2422a0f9b6..1e76790f54 100644 --- a/fxjs/cjx_node.cpp +++ b/fxjs/cjx_node.cpp @@ -1355,21 +1355,21 @@ void CJX_Node::Script_Som_Message(CFXJSE_Value* pValue, return; } bool bNew = false; - CXFA_Validate validate = pWidgetData->GetValidate(false); - if (!validate) { - validate = pWidgetData->GetValidate(true); + CXFA_ValidateData validateData = pWidgetData->GetValidateData(false); + if (!validateData) { + validateData = pWidgetData->GetValidateData(true); bNew = true; } if (bSetting) { switch (iMessageType) { case XFA_SOM_ValidationMessage: - validate.SetScriptMessageText(pValue->ToWideString()); + validateData.SetScriptMessageText(pValue->ToWideString()); break; case XFA_SOM_FormatMessage: - validate.SetFormatMessageText(pValue->ToWideString()); + validateData.SetFormatMessageText(pValue->ToWideString()); break; case XFA_SOM_MandatoryMessage: - validate.SetNullMessageText(pValue->ToWideString()); + validateData.SetNullMessageText(pValue->ToWideString()); break; default: break; @@ -1385,13 +1385,13 @@ void CJX_Node::Script_Som_Message(CFXJSE_Value* pValue, WideString wsMessage; switch (iMessageType) { case XFA_SOM_ValidationMessage: - validate.GetScriptMessageText(wsMessage); + validateData.GetScriptMessageText(wsMessage); break; case XFA_SOM_FormatMessage: - validate.GetFormatMessageText(wsMessage); + validateData.GetFormatMessageText(wsMessage); break; case XFA_SOM_MandatoryMessage: - validate.GetNullMessageText(wsMessage); + validateData.GetNullMessageText(wsMessage); break; default: break; @@ -1789,14 +1789,14 @@ void CJX_Node::Script_Som_Mandatory(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute) { CXFA_WidgetData* pWidgetData = GetXFANode()->GetWidgetData(); - if (!pWidgetData) { + if (!pWidgetData) return; - } - CXFA_Validate validate = pWidgetData->GetValidate(true); + + CXFA_ValidateData validateData = pWidgetData->GetValidateData(true); if (bSetting) { - validate.SetNullTest(pValue->ToWideString()); + validateData.SetNullTest(pValue->ToWideString()); } else { - int32_t iValue = validate.GetNullTest(); + int32_t iValue = validateData.GetNullTest(); const XFA_ATTRIBUTEENUMINFO* pInfo = GetAttributeEnumByID((XFA_ATTRIBUTEENUM)iValue); WideString wsValue; diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp index 1779b9e2f0..57cd7d2f95 100644 --- a/xfa/fxfa/cxfa_ffdocview.cpp +++ b/xfa/fxfa/cxfa_ffdocview.cpp @@ -225,9 +225,9 @@ bool CXFA_FFDocView::ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc) { pWidgetAcc->ResetData(); pWidgetAcc->UpdateUIDisplay(); - if (CXFA_Validate validate = pWidgetAcc->GetValidate(false)) { + if (CXFA_ValidateData validateData = pWidgetAcc->GetValidateData(false)) { AddValidateWidget(pWidgetAcc); - validate.GetNode()->SetFlag(XFA_NodeFlag_NeedsInitApp, false); + validateData.GetNode()->SetFlag(XFA_NodeFlag_NeedsInitApp, false); } return true; } diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp index 9ab19623c2..4a2bf08222 100644 --- a/xfa/fxfa/cxfa_ffwidgethandler.cpp +++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp @@ -193,8 +193,8 @@ bool CXFA_FFWidgetHandler::HasEvent(CXFA_WidgetAcc* pWidgetAcc, return calcData && calcData.GetScriptData(); } case XFA_EVENT_Validate: { - CXFA_Validate val = pWidgetAcc->GetValidate(false); - return val && val.GetScriptData(); + CXFA_ValidateData validateData = pWidgetAcc->GetValidateData(false); + return validateData && validateData.GetScriptData(); } default: break; diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index e9ccaaa218..1e005791a2 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -341,7 +341,7 @@ int32_t CXFA_WidgetAcc::ProcessCalculate() { return XFA_EVENTERROR_Success; } -void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate validate, +void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_ValidateData validateData, int32_t iRet, bool bRetValue, bool bVersionFlag) { @@ -356,8 +356,8 @@ void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate validate, WideString wsTitle = pAppProvider->GetAppTitle(); WideString wsScriptMsg; - validate.GetScriptMessageText(wsScriptMsg); - int32_t eScriptTest = validate.GetScriptTest(); + validateData.GetScriptMessageText(wsScriptMsg); + int32_t eScriptTest = validateData.GetScriptTest(); if (eScriptTest == XFA_ATTRIBUTEENUM_Warning) { if (GetNode()->IsUserInteractive()) return; @@ -380,12 +380,13 @@ void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate validate, pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK); } -int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate, - bool bVersionFlag) { +int32_t CXFA_WidgetAcc::ProcessFormatTestValidate( + CXFA_ValidateData validateData, + bool bVersionFlag) { WideString wsRawValue = GetRawValue(); if (!wsRawValue.IsEmpty()) { WideString wsPicture; - validate.GetPicture(wsPicture); + validateData.GetPicture(wsPicture); if (wsPicture.IsEmpty()) return XFA_EVENTERROR_NotExist; @@ -401,9 +402,9 @@ int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate, return XFA_EVENTERROR_NotExist; WideString wsFormatMsg; - validate.GetFormatMessageText(wsFormatMsg); + validateData.GetFormatMessageText(wsFormatMsg); WideString wsTitle = pAppProvider->GetAppTitle(); - int32_t eFormatTest = validate.GetFormatTest(); + int32_t eFormatTest = validateData.GetFormatTest(); if (eFormatTest == XFA_ATTRIBUTEENUM_Error) { if (wsFormatMsg.IsEmpty()) wsFormatMsg = GetValidateMessage(true, bVersionFlag); @@ -430,7 +431,7 @@ int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate, return XFA_EVENTERROR_NotExist; } -int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate, +int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_ValidateData validateData, int32_t iFlags, bool bVersionFlag) { WideString wsValue; @@ -440,9 +441,9 @@ int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate, if (m_bIsNull && (m_bPreNull == m_bIsNull)) return XFA_EVENTERROR_Success; - int32_t eNullTest = validate.GetNullTest(); + int32_t eNullTest = validateData.GetNullTest(); WideString wsNullMsg; - validate.GetNullMessageText(wsNullMsg); + validateData.GetNullMessageText(wsNullMsg); if (iFlags & 0x01) { int32_t iRet = XFA_EVENTERROR_Success; if (eNullTest != XFA_ATTRIBUTEENUM_Disabled) @@ -539,15 +540,15 @@ int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) { if (GetElementType() == XFA_Element::Draw) return XFA_EVENTERROR_NotExist; - CXFA_Validate validate = GetValidate(false); - if (!validate) + CXFA_ValidateData validateData = GetValidateData(false); + if (!validateData) return XFA_EVENTERROR_NotExist; - bool bInitDoc = validate.GetNode()->NeedsInitApp(); + bool bInitDoc = validateData.GetNode()->NeedsInitApp(); bool bStatus = m_pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End; int32_t iFormat = 0; int32_t iRet = XFA_EVENTERROR_NotExist; - CXFA_ScriptData scriptData = validate.GetScriptData(); + CXFA_ScriptData scriptData = validateData.GetScriptData(); bool bRet = false; bool hasBoolResult = (bInitDoc || bStatus) && GetRawValue().IsEmpty(); if (scriptData) { @@ -563,17 +564,17 @@ int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) { bVersionFlag = true; if (bInitDoc) { - validate.GetNode()->ClearFlag(XFA_NodeFlag_NeedsInitApp); + validateData.GetNode()->ClearFlag(XFA_NodeFlag_NeedsInitApp); } else { - iFormat = ProcessFormatTestValidate(validate, bVersionFlag); + iFormat = ProcessFormatTestValidate(validateData, bVersionFlag); if (!bVersionFlag) bVersionFlag = GetDoc()->GetXFADoc()->HasFlag(XFA_DOCFLAG_Scripting); - iRet |= ProcessNullTestValidate(validate, iFlags, bVersionFlag); + iRet |= ProcessNullTestValidate(validateData, iFlags, bVersionFlag); } if (iFormat != XFA_EVENTERROR_Success && hasBoolResult) - ProcessScriptTestValidate(validate, iRet, bRet, bVersionFlag); + ProcessScriptTestValidate(validateData, iRet, bRet, bVersionFlag); return iRet | iFormat; } diff --git a/xfa/fxfa/cxfa_widgetacc.h b/xfa/fxfa/cxfa_widgetacc.h index 9191ac963c..036a6734b2 100644 --- a/xfa/fxfa/cxfa_widgetacc.h +++ b/xfa/fxfa/cxfa_widgetacc.h @@ -86,12 +86,13 @@ class CXFA_WidgetAcc : public CXFA_WidgetData { private: IXFA_AppProvider* GetAppProvider(); - void ProcessScriptTestValidate(CXFA_Validate validate, + void ProcessScriptTestValidate(CXFA_ValidateData validateData, int32_t iRet, bool pRetValue, bool bVersionFlag); - int32_t ProcessFormatTestValidate(CXFA_Validate validate, bool bVersionFlag); - int32_t ProcessNullTestValidate(CXFA_Validate validate, + int32_t ProcessFormatTestValidate(CXFA_ValidateData validateData, + bool bVersionFlag); + int32_t ProcessNullTestValidate(CXFA_ValidateData validateData, int32_t iFlags, bool bVersionFlag); WideString GetValidateCaptionName(bool bVersionFlag); diff --git a/xfa/fxfa/parser/cxfa_validate.cpp b/xfa/fxfa/parser/cxfa_validatedata.cpp index 2f38d82290..756ddf23bf 100644 --- a/xfa/fxfa/parser/cxfa_validate.cpp +++ b/xfa/fxfa/parser/cxfa_validatedata.cpp @@ -4,18 +4,18 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "xfa/fxfa/parser/cxfa_validate.h" +#include "xfa/fxfa/parser/cxfa_validatedata.h" #include "xfa/fxfa/parser/cxfa_node.h" #include "xfa/fxfa/parser/xfa_utils.h" -CXFA_Validate::CXFA_Validate(CXFA_Node* pNode) : CXFA_Data(pNode) {} +CXFA_ValidateData::CXFA_ValidateData(CXFA_Node* pNode) : CXFA_Data(pNode) {} -int32_t CXFA_Validate::GetFormatTest() { +int32_t CXFA_ValidateData::GetFormatTest() { return m_pNode->JSNode()->GetEnum(XFA_ATTRIBUTE_FormatTest); } -bool CXFA_Validate::SetNullTest(WideString wsValue) { +bool CXFA_ValidateData::SetNullTest(WideString wsValue) { const XFA_ATTRIBUTEENUMINFO* pInfo = XFA_GetAttributeEnumByName(wsValue.AsStringView()); m_pNode->JSNode()->SetEnum(XFA_ATTRIBUTE_NullTest, @@ -24,16 +24,16 @@ bool CXFA_Validate::SetNullTest(WideString wsValue) { return true; } -int32_t CXFA_Validate::GetNullTest() { +int32_t CXFA_ValidateData::GetNullTest() { return m_pNode->JSNode()->GetEnum(XFA_ATTRIBUTE_NullTest); } -int32_t CXFA_Validate::GetScriptTest() { +int32_t CXFA_ValidateData::GetScriptTest() { return m_pNode->JSNode()->GetEnum(XFA_ATTRIBUTE_ScriptTest); } -void CXFA_Validate::GetMessageText(WideString& wsMessage, - const WideString& wsMessageType) { +void CXFA_ValidateData::GetMessageText(WideString& wsMessage, + const WideString& wsMessageType) { CXFA_Node* pNode = m_pNode->JSNode()->GetProperty(0, XFA_Element::Message, false); if (!pNode) @@ -54,24 +54,24 @@ void CXFA_Validate::GetMessageText(WideString& wsMessage, } } -void CXFA_Validate::SetFormatMessageText(WideString wsMessage) { +void CXFA_ValidateData::SetFormatMessageText(WideString wsMessage) { SetMessageText(wsMessage, L"formatTest"); } -void CXFA_Validate::GetFormatMessageText(WideString& wsMessage) { +void CXFA_ValidateData::GetFormatMessageText(WideString& wsMessage) { GetMessageText(wsMessage, L"formatTest"); } -void CXFA_Validate::SetNullMessageText(WideString wsMessage) { +void CXFA_ValidateData::SetNullMessageText(WideString wsMessage) { SetMessageText(wsMessage, L"nullTest"); } -void CXFA_Validate::GetNullMessageText(WideString& wsMessage) { +void CXFA_ValidateData::GetNullMessageText(WideString& wsMessage) { GetMessageText(wsMessage, L"nullTest"); } -void CXFA_Validate::SetMessageText(WideString& wsMessage, - const WideString& wsMessageType) { +void CXFA_ValidateData::SetMessageText(WideString& wsMessage, + const WideString& wsMessageType) { CXFA_Node* pNode = m_pNode->JSNode()->GetProperty(0, XFA_Element::Message, true); if (!pNode) @@ -97,19 +97,19 @@ void CXFA_Validate::SetMessageText(WideString& wsMessage, pTextNode->JSNode()->SetContent(wsMessage, wsMessage, false, false, true); } -void CXFA_Validate::GetScriptMessageText(WideString& wsMessage) { +void CXFA_ValidateData::GetScriptMessageText(WideString& wsMessage) { GetMessageText(wsMessage, L"scriptTest"); } -void CXFA_Validate::SetScriptMessageText(WideString wsMessage) { +void CXFA_ValidateData::SetScriptMessageText(WideString wsMessage) { SetMessageText(wsMessage, L"scriptTest"); } -void CXFA_Validate::GetPicture(WideString& wsPicture) { +void CXFA_ValidateData::GetPicture(WideString& wsPicture) { if (CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Picture, false)) pNode->JSNode()->TryContent(wsPicture, false, true); } -CXFA_ScriptData CXFA_Validate::GetScriptData() { +CXFA_ScriptData CXFA_ValidateData::GetScriptData() { return CXFA_ScriptData(m_pNode->GetChild(0, XFA_Element::Script, false)); } diff --git a/xfa/fxfa/parser/cxfa_validate.h b/xfa/fxfa/parser/cxfa_validatedata.h index bf6b807b7e..53df39429d 100644 --- a/xfa/fxfa/parser/cxfa_validate.h +++ b/xfa/fxfa/parser/cxfa_validatedata.h @@ -4,8 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef XFA_FXFA_PARSER_CXFA_VALIDATE_H_ -#define XFA_FXFA_PARSER_CXFA_VALIDATE_H_ +#ifndef XFA_FXFA_PARSER_CXFA_VALIDATEDATA_H_ +#define XFA_FXFA_PARSER_CXFA_VALIDATEDATA_H_ #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" @@ -14,9 +14,9 @@ class CXFA_Node; -class CXFA_Validate : public CXFA_Data { +class CXFA_ValidateData : public CXFA_Data { public: - explicit CXFA_Validate(CXFA_Node* pNode); + explicit CXFA_ValidateData(CXFA_Node* pNode); int32_t GetFormatTest(); int32_t GetNullTest(); @@ -36,4 +36,4 @@ class CXFA_Validate : public CXFA_Data { void SetMessageText(WideString& wsMessage, const WideString& wsMessageType); }; -#endif // XFA_FXFA_PARSER_CXFA_VALIDATE_H_ +#endif // XFA_FXFA_PARSER_CXFA_VALIDATEDATA_H_ diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index b9a54bd447..d5b1609aea 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -349,8 +349,8 @@ CXFA_CalculateData CXFA_WidgetData::GetCalculateData() { m_pNode->JSNode()->GetProperty(0, XFA_Element::Calculate, false)); } -CXFA_Validate CXFA_WidgetData::GetValidate(bool bModified) { - return CXFA_Validate( +CXFA_ValidateData CXFA_WidgetData::GetValidateData(bool bModified) { + return CXFA_ValidateData( m_pNode->JSNode()->GetProperty(0, XFA_Element::Validate, bModified)); } diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h index d076b9b01e..40ee92d299 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.h +++ b/xfa/fxfa/parser/cxfa_widgetdata.h @@ -21,7 +21,7 @@ #include "xfa/fxfa/parser/cxfa_fontdata.h" #include "xfa/fxfa/parser/cxfa_margindata.h" #include "xfa/fxfa/parser/cxfa_paradata.h" -#include "xfa/fxfa/parser/cxfa_validate.h" +#include "xfa/fxfa/parser/cxfa_validatedata.h" enum XFA_CHECKSTATE { XFA_CHECKSTATE_On = 0, @@ -61,7 +61,7 @@ class CXFA_WidgetData : public CXFA_Data { CXFA_Value GetDefaultValue(); CXFA_Value GetFormValue(); CXFA_CalculateData GetCalculateData(); - CXFA_Validate GetValidate(bool bModified); + CXFA_ValidateData GetValidateData(bool bModified); bool GetWidth(float& fWidth); bool GetHeight(float& fHeight); |