diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-12-14 19:48:44 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-12-14 19:48:44 +0000 |
commit | dcbb8e53e604178dc97d12846ddbdef88be41297 (patch) | |
tree | dc58158143f2a6a590007dfe137e7053b25357e5 /xfa | |
parent | fe9d640ea90cfccac39b6475dad9df62072542fc (diff) | |
download | pdfium-dcbb8e53e604178dc97d12846ddbdef88be41297.tar.xz |
Fold CXFA_ValidateData into CXFA_Validate
The ValidateData class is a thin wrapper around the Validate class. Now
that the Validate class exists we can fold the methods from ValidateData
into Validate.
Change-Id: I1e72f4b7bddeb22a311f4fe9a5940204221b6d2a
Reviewed-on: https://pdfium-review.googlesource.com/21150
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fxfa/cxfa_ffdocview.cpp | 12 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffwidgethandler.cpp | 6 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_widgetacc.cpp | 40 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_widgetacc.h | 7 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_validate.cpp | 100 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_validate.h | 22 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_validatedata.cpp | 123 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_validatedata.h | 45 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_widgetdata.cpp | 5 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_widgetdata.h | 4 |
10 files changed, 160 insertions, 204 deletions
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp index 5b1dc82223..25a357bc46 100644 --- a/xfa/fxfa/cxfa_ffdocview.cpp +++ b/xfa/fxfa/cxfa_ffdocview.cpp @@ -31,6 +31,7 @@ #include "xfa/fxfa/cxfa_widgetacciterator.h" #include "xfa/fxfa/parser/cxfa_binditemsdata.h" #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" +#include "xfa/fxfa/parser/cxfa_validate.h" #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" const XFA_AttributeEnum gs_EventActivity[] = { @@ -221,11 +222,12 @@ bool CXFA_FFDocView::ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc) { pWidgetAcc->ResetData(); pWidgetAcc->UpdateUIDisplay(); - CXFA_ValidateData validateData = pWidgetAcc->GetValidateData(false); - if (validateData.HasValidNode()) { - AddValidateWidget(pWidgetAcc); - validateData.GetNode()->SetFlag(XFA_NodeFlag_NeedsInitApp, false); - } + CXFA_Validate* validate = pWidgetAcc->GetValidate(false); + if (!validate) + return true; + + AddValidateWidget(pWidgetAcc); + validate->SetFlag(XFA_NodeFlag_NeedsInitApp, false); return true; } diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp index c4483c6a1e..39919bc1e7 100644 --- a/xfa/fxfa/cxfa_ffwidgethandler.cpp +++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp @@ -16,6 +16,7 @@ #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/cxfa_node.h" +#include "xfa/fxfa/parser/cxfa_validate.h" CXFA_FFWidgetHandler::CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView) : m_pDocView(pDocView) {} @@ -193,9 +194,8 @@ bool CXFA_FFWidgetHandler::HasEvent(CXFA_WidgetAcc* pWidgetAcc, return calcData.HasValidNode() && calcData.GetScriptData().HasValidNode(); } case XFA_EVENT_Validate: { - CXFA_ValidateData validateData = pWidgetAcc->GetValidateData(false); - return validateData.HasValidNode() && - validateData.GetScriptData().HasValidNode(); + CXFA_Validate* validate = pWidgetAcc->GetValidate(false); + return validate && validate->GetScriptData().HasValidNode(); } default: break; diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index c43ab6560a..74717b998c 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -24,6 +24,7 @@ #include "xfa/fxfa/parser/cxfa_layoutprocessor.h" #include "xfa/fxfa/parser/cxfa_localevalue.h" #include "xfa/fxfa/parser/cxfa_node.h" +#include "xfa/fxfa/parser/cxfa_validate.h" #include "xfa/fxfa/parser/xfa_utils.h" class CXFA_WidgetLayoutData { @@ -338,7 +339,7 @@ int32_t CXFA_WidgetAcc::ProcessCalculate() { return XFA_EVENTERROR_Success; } -void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_ValidateData validateData, +void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate* validate, int32_t iRet, bool bRetValue, bool bVersionFlag) { @@ -352,8 +353,8 @@ void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_ValidateData validateData, return; WideString wsTitle = pAppProvider->GetAppTitle(); - WideString wsScriptMsg = validateData.GetScriptMessageText(); - if (validateData.GetScriptTest() == XFA_AttributeEnum::Warning) { + WideString wsScriptMsg = validate->GetScriptMessageText(); + if (validate->GetScriptTest() == XFA_AttributeEnum::Warning) { if (GetNode()->IsUserInteractive()) return; if (wsScriptMsg.IsEmpty()) @@ -375,12 +376,11 @@ void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_ValidateData validateData, pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK); } -int32_t CXFA_WidgetAcc::ProcessFormatTestValidate( - CXFA_ValidateData validateData, - bool bVersionFlag) { +int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate* validate, + bool bVersionFlag) { WideString wsRawValue = GetRawValue(); if (!wsRawValue.IsEmpty()) { - WideString wsPicture = validateData.GetPicture(); + WideString wsPicture = validate->GetPicture(); if (wsPicture.IsEmpty()) return XFA_EVENTERROR_NotExist; @@ -395,9 +395,9 @@ int32_t CXFA_WidgetAcc::ProcessFormatTestValidate( if (!pAppProvider) return XFA_EVENTERROR_NotExist; - WideString wsFormatMsg = validateData.GetFormatMessageText(); + WideString wsFormatMsg = validate->GetFormatMessageText(); WideString wsTitle = pAppProvider->GetAppTitle(); - if (validateData.GetFormatTest() == XFA_AttributeEnum::Error) { + if (validate->GetFormatTest() == XFA_AttributeEnum::Error) { if (wsFormatMsg.IsEmpty()) wsFormatMsg = GetValidateMessage(true, bVersionFlag); pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK); @@ -423,7 +423,7 @@ int32_t CXFA_WidgetAcc::ProcessFormatTestValidate( return XFA_EVENTERROR_NotExist; } -int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_ValidateData validateData, +int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate* validate, int32_t iFlags, bool bVersionFlag) { if (!GetValue(XFA_VALUEPICTURE_Raw).IsEmpty()) @@ -431,8 +431,8 @@ int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_ValidateData validateData, if (IsNull() && IsPreNull()) return XFA_EVENTERROR_Success; - XFA_AttributeEnum eNullTest = validateData.GetNullTest(); - WideString wsNullMsg = validateData.GetNullMessageText(); + XFA_AttributeEnum eNullTest = validate->GetNullTest(); + WideString wsNullMsg = validate->GetNullMessageText(); if (iFlags & 0x01) { int32_t iRet = XFA_EVENTERROR_Success; if (eNullTest != XFA_AttributeEnum::Disabled) @@ -528,15 +528,15 @@ int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) { if (GetElementType() == XFA_Element::Draw) return XFA_EVENTERROR_NotExist; - CXFA_ValidateData validateData = GetValidateData(false); - if (!validateData.HasValidNode()) + CXFA_Validate* validate = GetValidate(false); + if (!validate) return XFA_EVENTERROR_NotExist; - bool bInitDoc = validateData.GetNode()->NeedsInitApp(); + bool bInitDoc = validate->NeedsInitApp(); bool bStatus = m_pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End; int32_t iFormat = 0; int32_t iRet = XFA_EVENTERROR_NotExist; - CXFA_ScriptData scriptData = validateData.GetScriptData(); + CXFA_ScriptData scriptData = validate->GetScriptData(); bool bRet = false; bool hasBoolResult = (bInitDoc || bStatus) && GetRawValue().IsEmpty(); if (scriptData.HasValidNode()) { @@ -552,17 +552,17 @@ int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) { bVersionFlag = true; if (bInitDoc) { - validateData.GetNode()->ClearFlag(XFA_NodeFlag_NeedsInitApp); + validate->ClearFlag(XFA_NodeFlag_NeedsInitApp); } else { - iFormat = ProcessFormatTestValidate(validateData, bVersionFlag); + iFormat = ProcessFormatTestValidate(validate, bVersionFlag); if (!bVersionFlag) bVersionFlag = GetDoc()->GetXFADoc()->HasFlag(XFA_DOCFLAG_Scripting); - iRet |= ProcessNullTestValidate(validateData, iFlags, bVersionFlag); + iRet |= ProcessNullTestValidate(validate, iFlags, bVersionFlag); } if (iFormat != XFA_EVENTERROR_Success && hasBoolResult) - ProcessScriptTestValidate(validateData, iRet, bRet, bVersionFlag); + ProcessScriptTestValidate(validate, iRet, bRet, bVersionFlag); return iRet | iFormat; } diff --git a/xfa/fxfa/cxfa_widgetacc.h b/xfa/fxfa/cxfa_widgetacc.h index 7b046b4670..96afeb4bde 100644 --- a/xfa/fxfa/cxfa_widgetacc.h +++ b/xfa/fxfa/cxfa_widgetacc.h @@ -87,13 +87,12 @@ class CXFA_WidgetAcc : public CXFA_WidgetData { private: IXFA_AppProvider* GetAppProvider(); - void ProcessScriptTestValidate(CXFA_ValidateData validateData, + void ProcessScriptTestValidate(CXFA_Validate* validate, int32_t iRet, bool pRetValue, bool bVersionFlag); - int32_t ProcessFormatTestValidate(CXFA_ValidateData validateData, - bool bVersionFlag); - int32_t ProcessNullTestValidate(CXFA_ValidateData validateData, + int32_t ProcessFormatTestValidate(CXFA_Validate* validate, bool bVersionFlag); + int32_t ProcessNullTestValidate(CXFA_Validate* validate, int32_t iFlags, bool bVersionFlag); WideString GetValidateCaptionName(bool bVersionFlag); diff --git a/xfa/fxfa/parser/cxfa_validate.cpp b/xfa/fxfa/parser/cxfa_validate.cpp index b532067157..9b31a17434 100644 --- a/xfa/fxfa/parser/cxfa_validate.cpp +++ b/xfa/fxfa/parser/cxfa_validate.cpp @@ -31,6 +31,9 @@ const CXFA_Node::AttributeData kAttributeData[] = { {XFA_Attribute::Unknown, XFA_AttributeType::Integer, nullptr}}; constexpr wchar_t kName[] = L"validate"; +constexpr wchar_t kFormatTest[] = L"formatTest"; +constexpr wchar_t kNullTest[] = L"nullTest"; +constexpr wchar_t kScriptTest[] = L"scriptTest"; } // namespace @@ -47,3 +50,100 @@ CXFA_Validate::CXFA_Validate(CXFA_Document* doc, XFA_PacketType packet) pdfium::MakeUnique<CJX_Validate>(this)) {} CXFA_Validate::~CXFA_Validate() {} + +XFA_AttributeEnum CXFA_Validate::GetFormatTest() { + return JSObject()->GetEnum(XFA_Attribute::FormatTest); +} + +void CXFA_Validate::SetNullTest(const WideString& wsValue) { + pdfium::Optional<XFA_AttributeEnum> item = + CXFA_Node::NameToAttributeEnum(wsValue.AsStringView()); + JSObject()->SetEnum(XFA_Attribute::NullTest, + item ? *item : XFA_AttributeEnum::Disabled, false); +} + +XFA_AttributeEnum CXFA_Validate::GetNullTest() { + return JSObject()->GetEnum(XFA_Attribute::NullTest); +} + +XFA_AttributeEnum CXFA_Validate::GetScriptTest() { + return JSObject()->GetEnum(XFA_Attribute::ScriptTest); +} + +WideString CXFA_Validate::GetMessageText(const WideString& wsMessageType) { + CXFA_Node* pNode = JSObject()->GetProperty(0, XFA_Element::Message, false); + if (!pNode) + return L""; + + for (CXFA_Node* pItemNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); + pItemNode; + pItemNode = pItemNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { + if (pItemNode->GetElementType() != XFA_Element::Text) + continue; + + WideString wsName = pItemNode->JSObject()->GetCData(XFA_Attribute::Name); + if (wsName.IsEmpty() || wsName == wsMessageType) + return pItemNode->JSObject()->GetContent(false); + } + return L""; +} + +void CXFA_Validate::SetFormatMessageText(const WideString& wsMessage) { + SetMessageText(kFormatTest, wsMessage); +} + +WideString CXFA_Validate::GetFormatMessageText() { + return GetMessageText(kFormatTest); +} + +void CXFA_Validate::SetNullMessageText(const WideString& wsMessage) { + SetMessageText(kNullTest, wsMessage); +} + +WideString CXFA_Validate::GetNullMessageText() { + return GetMessageText(kNullTest); +} + +WideString CXFA_Validate::GetScriptMessageText() { + return GetMessageText(kScriptTest); +} + +void CXFA_Validate::SetScriptMessageText(const WideString& wsMessage) { + SetMessageText(kScriptTest, wsMessage); +} + +void CXFA_Validate::SetMessageText(const WideString& wsMessageType, + const WideString& wsMessage) { + CXFA_Node* pNode = JSObject()->GetProperty(0, XFA_Element::Message, true); + if (!pNode) + return; + + for (CXFA_Node* pItemNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); + pItemNode; + pItemNode = pItemNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { + if (pItemNode->GetElementType() != XFA_Element::Text) + continue; + + WideString wsName = pItemNode->JSObject()->GetCData(XFA_Attribute::Name); + if (wsName.IsEmpty() || wsName == wsMessageType) { + pItemNode->JSObject()->SetContent(wsMessage, wsMessage, false, false, + true); + return; + } + } + + CXFA_Node* pTextNode = pNode->CreateSamePacketNode(XFA_Element::Text); + pNode->InsertChild(pTextNode, nullptr); + pTextNode->JSObject()->SetCData(XFA_Attribute::Name, wsMessageType, false, + false); + pTextNode->JSObject()->SetContent(wsMessage, wsMessage, false, false, true); +} + +WideString CXFA_Validate::GetPicture() { + CXFA_Node* pNode = GetChild(0, XFA_Element::Picture, false); + return pNode ? pNode->JSObject()->GetContent(false) : L""; +} + +CXFA_ScriptData CXFA_Validate::GetScriptData() { + return CXFA_ScriptData(GetChild(0, XFA_Element::Script, false)); +} diff --git a/xfa/fxfa/parser/cxfa_validate.h b/xfa/fxfa/parser/cxfa_validate.h index d19850cd77..9e2be9c959 100644 --- a/xfa/fxfa/parser/cxfa_validate.h +++ b/xfa/fxfa/parser/cxfa_validate.h @@ -13,6 +13,28 @@ class CXFA_Validate : public CXFA_Node { public: CXFA_Validate(CXFA_Document* doc, XFA_PacketType packet); ~CXFA_Validate() override; + + XFA_AttributeEnum GetFormatTest(); + WideString GetFormatMessageText(); + void SetFormatMessageText(const WideString& wsMessage); + + XFA_AttributeEnum GetNullTest(); + void SetNullTest(const WideString& wsValue); + + WideString GetNullMessageText(); + void SetNullMessageText(const WideString& wsMessage); + + XFA_AttributeEnum GetScriptTest(); + WideString GetScriptMessageText(); + void SetScriptMessageText(const WideString& wsMessage); + + WideString GetPicture(); + CXFA_ScriptData GetScriptData(); + + private: + WideString GetMessageText(const WideString& wsMessageType); + void SetMessageText(const WideString& wsMessageType, + const WideString& wsMessage); }; #endif // XFA_FXFA_PARSER_CXFA_VALIDATE_H_ diff --git a/xfa/fxfa/parser/cxfa_validatedata.cpp b/xfa/fxfa/parser/cxfa_validatedata.cpp deleted file mode 100644 index 934edba764..0000000000 --- a/xfa/fxfa/parser/cxfa_validatedata.cpp +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fxfa/parser/cxfa_validatedata.h" - -#include "xfa/fxfa/parser/cxfa_node.h" -#include "xfa/fxfa/parser/xfa_utils.h" - -namespace { - -constexpr wchar_t kFormatTest[] = L"formatTest"; -constexpr wchar_t kNullTest[] = L"nullTest"; -constexpr wchar_t kScriptTest[] = L"scriptTest"; - -} // namespace - -CXFA_ValidateData::CXFA_ValidateData(CXFA_Node* pNode) : CXFA_DataData(pNode) {} - -XFA_AttributeEnum CXFA_ValidateData::GetFormatTest() const { - return m_pNode->JSObject()->GetEnum(XFA_Attribute::FormatTest); -} - -void CXFA_ValidateData::SetNullTest(const WideString& wsValue) { - pdfium::Optional<XFA_AttributeEnum> item = - CXFA_Node::NameToAttributeEnum(wsValue.AsStringView()); - m_pNode->JSObject()->SetEnum(XFA_Attribute::NullTest, - item ? *item : XFA_AttributeEnum::Disabled, - false); -} - -XFA_AttributeEnum CXFA_ValidateData::GetNullTest() const { - return m_pNode->JSObject()->GetEnum(XFA_Attribute::NullTest); -} - -XFA_AttributeEnum CXFA_ValidateData::GetScriptTest() const { - return m_pNode->JSObject()->GetEnum(XFA_Attribute::ScriptTest); -} - -WideString CXFA_ValidateData::GetMessageText( - const WideString& wsMessageType) const { - CXFA_Node* pNode = - m_pNode->JSObject()->GetProperty(0, XFA_Element::Message, false); - if (!pNode) - return L""; - - for (CXFA_Node* pItemNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); - pItemNode; - pItemNode = pItemNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pItemNode->GetElementType() != XFA_Element::Text) - continue; - - WideString wsName = pItemNode->JSObject()->GetCData(XFA_Attribute::Name); - if (wsName.IsEmpty() || wsName == wsMessageType) - return pItemNode->JSObject()->GetContent(false); - } - return L""; -} - -void CXFA_ValidateData::SetFormatMessageText(const WideString& wsMessage) { - SetMessageText(kFormatTest, wsMessage); -} - -WideString CXFA_ValidateData::GetFormatMessageText() const { - return GetMessageText(kFormatTest); -} - -void CXFA_ValidateData::SetNullMessageText(const WideString& wsMessage) { - SetMessageText(kNullTest, wsMessage); -} - -WideString CXFA_ValidateData::GetNullMessageText() const { - return GetMessageText(kNullTest); -} - -WideString CXFA_ValidateData::GetScriptMessageText() const { - return GetMessageText(kScriptTest); -} - -void CXFA_ValidateData::SetScriptMessageText(const WideString& wsMessage) { - SetMessageText(kScriptTest, wsMessage); -} - -void CXFA_ValidateData::SetMessageText(const WideString& wsMessageType, - const WideString& wsMessage) { - CXFA_Node* pNode = - m_pNode->JSObject()->GetProperty(0, XFA_Element::Message, true); - if (!pNode) - return; - - for (CXFA_Node* pItemNode = pNode->GetNodeItem(XFA_NODEITEM_FirstChild); - pItemNode; - pItemNode = pItemNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - if (pItemNode->GetElementType() != XFA_Element::Text) - continue; - - WideString wsName = pItemNode->JSObject()->GetCData(XFA_Attribute::Name); - if (wsName.IsEmpty() || wsName == wsMessageType) { - pItemNode->JSObject()->SetContent(wsMessage, wsMessage, false, false, - true); - return; - } - } - - CXFA_Node* pTextNode = pNode->CreateSamePacketNode(XFA_Element::Text); - pNode->InsertChild(pTextNode, nullptr); - pTextNode->JSObject()->SetCData(XFA_Attribute::Name, wsMessageType, false, - false); - pTextNode->JSObject()->SetContent(wsMessage, wsMessage, false, false, true); -} - -WideString CXFA_ValidateData::GetPicture() const { - CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Picture, false); - if (pNode) - return pNode->JSObject()->GetContent(false); - return L""; -} - -CXFA_ScriptData CXFA_ValidateData::GetScriptData() const { - return CXFA_ScriptData(m_pNode->GetChild(0, XFA_Element::Script, false)); -} diff --git a/xfa/fxfa/parser/cxfa_validatedata.h b/xfa/fxfa/parser/cxfa_validatedata.h deleted file mode 100644 index 309db62ab6..0000000000 --- a/xfa/fxfa/parser/cxfa_validatedata.h +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#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" -#include "xfa/fxfa/parser/cxfa_datadata.h" -#include "xfa/fxfa/parser/cxfa_scriptdata.h" - -class CXFA_Node; - -class CXFA_ValidateData : public CXFA_DataData { - public: - explicit CXFA_ValidateData(CXFA_Node* pNode); - - XFA_AttributeEnum GetFormatTest() const; - WideString GetFormatMessageText() const; - void SetFormatMessageText(const WideString& wsMessage); - - XFA_AttributeEnum GetNullTest() const; - void SetNullTest(const WideString& wsValue); - - WideString GetNullMessageText() const; - void SetNullMessageText(const WideString& wsMessage); - - XFA_AttributeEnum GetScriptTest() const; - WideString GetScriptMessageText() const; - void SetScriptMessageText(const WideString& wsMessage); - - WideString GetPicture() const; - - CXFA_ScriptData GetScriptData() const; - - private: - WideString GetMessageText(const WideString& wsMessageType) const; - void SetMessageText(const WideString& wsMessageType, - const WideString& wsMessage); -}; - -#endif // XFA_FXFA_PARSER_CXFA_VALIDATEDATA_H_ diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index 4ba6b418de..58c934132c 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -15,6 +15,7 @@ #include "xfa/fxfa/parser/cxfa_localevalue.h" #include "xfa/fxfa/parser/cxfa_measurement.h" #include "xfa/fxfa/parser/cxfa_node.h" +#include "xfa/fxfa/parser/cxfa_validate.h" #include "xfa/fxfa/parser/xfa_utils.h" namespace { @@ -311,8 +312,8 @@ CXFA_CalculateData CXFA_WidgetData::GetCalculateData() { m_pNode->JSObject()->GetProperty(0, XFA_Element::Calculate, false)); } -CXFA_ValidateData CXFA_WidgetData::GetValidateData(bool bModified) { - return CXFA_ValidateData( +CXFA_Validate* CXFA_WidgetData::GetValidate(bool bModified) { + return static_cast<CXFA_Validate*>( m_pNode->JSObject()->GetProperty(0, XFA_Element::Validate, bModified)); } diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h index fab11ce235..592226cb0b 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.h +++ b/xfa/fxfa/parser/cxfa_widgetdata.h @@ -22,7 +22,6 @@ #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_validatedata.h" enum XFA_CHECKSTATE { XFA_CHECKSTATE_On = 0, @@ -38,6 +37,7 @@ enum XFA_VALUEPICTURE { }; class CXFA_Node; +class CXFA_Validate; class IFX_Locale; class CXFA_WidgetData : public CXFA_DataData { @@ -66,7 +66,7 @@ class CXFA_WidgetData : public CXFA_DataData { CXFA_ValueData GetDefaultValueData(); CXFA_ValueData GetFormValueData(); CXFA_CalculateData GetCalculateData(); - CXFA_ValidateData GetValidateData(bool bModified); + CXFA_Validate* GetValidate(bool bModified); CXFA_BorderData GetUIBorderData(); std::vector<CXFA_Node*> GetEventByActivity(XFA_AttributeEnum iActivity, |