From cf3d40d10276686f972761bafd005a7715f6eb1c Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 3 Jan 2018 10:43:51 -0500 Subject: Fold CXFA_CalculateData into CXFA_Calculate This CL folds CXFA_CalculateData into CXFA_Calculate as it is just a thin wrapper. Change-Id: I35efbee6c0244139a7ece19f3e8ee18bfb931dda Reviewed-on: https://pdfium-review.googlesource.com/22090 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- xfa/fxfa/parser/cxfa_calculate.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'xfa/fxfa/parser/cxfa_calculate.cpp') diff --git a/xfa/fxfa/parser/cxfa_calculate.cpp b/xfa/fxfa/parser/cxfa_calculate.cpp index 714dfdecd7..cacb326f0f 100644 --- a/xfa/fxfa/parser/cxfa_calculate.cpp +++ b/xfa/fxfa/parser/cxfa_calculate.cpp @@ -8,6 +8,9 @@ #include "fxjs/xfa/cjx_calculate.h" #include "third_party/base/ptr_util.h" +#include "xfa/fxfa/parser/cxfa_message.h" +#include "xfa/fxfa/parser/cxfa_script.h" +#include "xfa/fxfa/parser/cxfa_text.h" namespace { @@ -39,3 +42,22 @@ CXFA_Calculate::CXFA_Calculate(CXFA_Document* doc, XFA_PacketType packet) pdfium::MakeUnique(this)) {} CXFA_Calculate::~CXFA_Calculate() {} + +XFA_AttributeEnum CXFA_Calculate::GetOverride() { + return JSObject() + ->TryEnum(XFA_Attribute::Override, false) + .value_or(XFA_AttributeEnum::Error); +} + +CXFA_Script* CXFA_Calculate::GetScript() { + return GetChild(0, XFA_Element::Script, false); +} + +WideString CXFA_Calculate::GetMessageText() { + CXFA_Message* pNode = GetChild(0, XFA_Element::Message, false); + if (!pNode) + return L""; + + CXFA_Text* text = pNode->GetChild(0, XFA_Element::Text, false); + return text ? text->GetContent() : L""; +} -- cgit v1.2.3