diff options
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r-- | xfa/fxfa/parser/cxfa_calculate.cpp | 22 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_calculate.h | 6 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_calculatedata.cpp | 35 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_calculatedata.h | 25 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_widgetdata.cpp | 6 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_widgetdata.h | 4 |
6 files changed, 33 insertions, 65 deletions
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<CJX_Calculate>(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<CXFA_Script>(0, XFA_Element::Script, false); +} + +WideString CXFA_Calculate::GetMessageText() { + CXFA_Message* pNode = GetChild<CXFA_Message>(0, XFA_Element::Message, false); + if (!pNode) + return L""; + + CXFA_Text* text = pNode->GetChild<CXFA_Text>(0, XFA_Element::Text, false); + return text ? text->GetContent() : L""; +} diff --git a/xfa/fxfa/parser/cxfa_calculate.h b/xfa/fxfa/parser/cxfa_calculate.h index 01fe853d4b..3f6ca6a8c7 100644 --- a/xfa/fxfa/parser/cxfa_calculate.h +++ b/xfa/fxfa/parser/cxfa_calculate.h @@ -9,10 +9,16 @@ #include "xfa/fxfa/parser/cxfa_node.h" +class CXFA_Script; + class CXFA_Calculate : public CXFA_Node { public: CXFA_Calculate(CXFA_Document* doc, XFA_PacketType packet); ~CXFA_Calculate() override; + + XFA_AttributeEnum GetOverride(); + CXFA_Script* GetScript(); + WideString GetMessageText(); }; #endif // XFA_FXFA_PARSER_CXFA_CALCULATE_H_ diff --git a/xfa/fxfa/parser/cxfa_calculatedata.cpp b/xfa/fxfa/parser/cxfa_calculatedata.cpp deleted file mode 100644 index f919224687..0000000000 --- a/xfa/fxfa/parser/cxfa_calculatedata.cpp +++ /dev/null @@ -1,35 +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_calculatedata.h" - -#include "xfa/fxfa/parser/cxfa_message.h" -#include "xfa/fxfa/parser/cxfa_node.h" -#include "xfa/fxfa/parser/cxfa_script.h" -#include "xfa/fxfa/parser/cxfa_text.h" - -CXFA_CalculateData::CXFA_CalculateData(CXFA_Node* pNode) - : CXFA_DataData(pNode) {} - -XFA_AttributeEnum CXFA_CalculateData::GetOverride() const { - return m_pNode->JSObject() - ->TryEnum(XFA_Attribute::Override, false) - .value_or(XFA_AttributeEnum::Error); -} - -CXFA_Script* CXFA_CalculateData::GetScript() const { - return m_pNode->GetChild<CXFA_Script>(0, XFA_Element::Script, false); -} - -WideString CXFA_CalculateData::GetMessageText() const { - CXFA_Message* pNode = - m_pNode->GetChild<CXFA_Message>(0, XFA_Element::Message, false); - if (!pNode) - return L""; - - CXFA_Text* text = pNode->GetChild<CXFA_Text>(0, XFA_Element::Text, false); - return text ? text->GetContent() : L""; -} diff --git a/xfa/fxfa/parser/cxfa_calculatedata.h b/xfa/fxfa/parser/cxfa_calculatedata.h deleted file mode 100644 index 3e0802e6c4..0000000000 --- a/xfa/fxfa/parser/cxfa_calculatedata.h +++ /dev/null @@ -1,25 +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_CALCULATEDATA_H_ -#define XFA_FXFA_PARSER_CXFA_CALCULATEDATA_H_ - -#include "core/fxcrt/fx_string.h" -#include "xfa/fxfa/parser/cxfa_datadata.h" - -class CXFA_Node; -class CXFA_Script; - -class CXFA_CalculateData : public CXFA_DataData { - public: - explicit CXFA_CalculateData(CXFA_Node* pNode); - - XFA_AttributeEnum GetOverride() const; - CXFA_Script* GetScript() const; - WideString GetMessageText() const; -}; - -#endif // XFA_FXFA_PARSER_CXFA_CALCULATEDATA_H_ diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index 6e68ee356b..ba10f244d3 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -324,9 +324,9 @@ CXFA_Value* CXFA_WidgetData::GetFormValue() { false); } -CXFA_CalculateData CXFA_WidgetData::GetCalculateData() { - return CXFA_CalculateData(m_pNode->JSObject()->GetProperty<CXFA_Calculate>( - 0, XFA_Element::Calculate, false)); +CXFA_Calculate* CXFA_WidgetData::GetCalculate() { + return m_pNode->JSObject()->GetProperty<CXFA_Calculate>( + 0, XFA_Element::Calculate, false); } CXFA_Validate* CXFA_WidgetData::GetValidate(bool bModified) { diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h index 2873ff9bc1..e7016bda91 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.h +++ b/xfa/fxfa/parser/cxfa_widgetdata.h @@ -16,7 +16,6 @@ #include "fxbarcode/BC_Library.h" #include "xfa/fxfa/parser/cxfa_binddata.h" #include "xfa/fxfa/parser/cxfa_borderdata.h" -#include "xfa/fxfa/parser/cxfa_calculatedata.h" #include "xfa/fxfa/parser/cxfa_captiondata.h" #include "xfa/fxfa/parser/cxfa_datadata.h" #include "xfa/fxfa/parser/cxfa_fontdata.h" @@ -35,6 +34,7 @@ enum XFA_VALUEPICTURE { XFA_VALUEPICTURE_DataBind, }; +class CXFA_Calculate; class CXFA_Node; class CXFA_Para; class CXFA_Validate; @@ -65,7 +65,7 @@ class CXFA_WidgetData : public CXFA_DataData { CXFA_Para* GetPara(); CXFA_Value* GetDefaultValue(); CXFA_Value* GetFormValue(); - CXFA_CalculateData GetCalculateData(); + CXFA_Calculate* GetCalculate(); CXFA_Validate* GetValidate(bool bModified); CXFA_BorderData GetUIBorderData(); |