From f44cf89c0263708b7d475fb1aeba6ba42f54766f Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 7 Nov 2017 18:42:20 +0000 Subject: Rename CXFA_Calculate to CXFA_CalculateData This CL renames CXFA_Calculate to CXFA_CalculateData to make it clear it's part of the data hierarchy. Change-Id: I259b9816bde9cc6c70550944906fcafa954ef32e Reviewed-on: https://pdfium-review.googlesource.com/17976 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- BUILD.gn | 4 ++-- xfa/fxfa/cxfa_ffdocview.cpp | 6 +++--- xfa/fxfa/cxfa_fffield.cpp | 10 +++++----- xfa/fxfa/cxfa_ffwidgethandler.cpp | 10 +++++----- xfa/fxfa/cxfa_widgetacc.cpp | 6 +++--- xfa/fxfa/parser/cxfa_calculate.cpp | 32 -------------------------------- xfa/fxfa/parser/cxfa_calculate.h | 25 ------------------------- xfa/fxfa/parser/cxfa_calculatedata.cpp | 32 ++++++++++++++++++++++++++++++++ xfa/fxfa/parser/cxfa_calculatedata.h | 25 +++++++++++++++++++++++++ xfa/fxfa/parser/cxfa_widgetdata.cpp | 4 ++-- xfa/fxfa/parser/cxfa_widgetdata.h | 4 ++-- 11 files changed, 79 insertions(+), 79 deletions(-) delete mode 100644 xfa/fxfa/parser/cxfa_calculate.cpp delete mode 100644 xfa/fxfa/parser/cxfa_calculate.h create mode 100644 xfa/fxfa/parser/cxfa_calculatedata.cpp create mode 100644 xfa/fxfa/parser/cxfa_calculatedata.h diff --git a/BUILD.gn b/BUILD.gn index 6a93f8edd5..9fde65ab32 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -1799,8 +1799,8 @@ if (pdf_enable_xfa) { "xfa/fxfa/parser/cxfa_borderdata.h", "xfa/fxfa/parser/cxfa_boxdata.cpp", "xfa/fxfa/parser/cxfa_boxdata.h", - "xfa/fxfa/parser/cxfa_calculate.cpp", - "xfa/fxfa/parser/cxfa_calculate.h", + "xfa/fxfa/parser/cxfa_calculatedata.cpp", + "xfa/fxfa/parser/cxfa_calculatedata.h", "xfa/fxfa/parser/cxfa_caption.cpp", "xfa/fxfa/parser/cxfa_caption.h", "xfa/fxfa/parser/cxfa_containerlayoutitem.cpp", diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp index 3302e40f5d..ae277f05e4 100644 --- a/xfa/fxfa/cxfa_ffdocview.cpp +++ b/xfa/fxfa/cxfa_ffdocview.cpp @@ -412,13 +412,13 @@ static int32_t XFA_ProcessEvent(CXFA_FFDocView* pDocView, } return XFA_EVENTERROR_Disabled; case XFA_EVENT_InitCalculate: { - CXFA_Calculate calc = pWidgetAcc->GetCalculate(); - if (!calc) + CXFA_CalculateData calcData = pWidgetAcc->GetCalculateData(); + if (!calcData) return XFA_EVENTERROR_NotExist; if (pWidgetAcc->GetNode()->IsUserInteractive()) return XFA_EVENTERROR_Disabled; - CXFA_Script script = calc.GetScript(); + CXFA_Script script = calcData.GetScript(); return pWidgetAcc->ExecuteScript(script, pParam); } default: diff --git a/xfa/fxfa/cxfa_fffield.cpp b/xfa/fxfa/cxfa_fffield.cpp index f6c21d9fd7..b1c8c32684 100644 --- a/xfa/fxfa/cxfa_fffield.cpp +++ b/xfa/fxfa/cxfa_fffield.cpp @@ -662,12 +662,12 @@ int32_t CXFA_FFField::CalculateOverride() { } int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) { - CXFA_Calculate calc = pAcc->GetCalculate(); - if (!calc) + CXFA_CalculateData calcData = pAcc->GetCalculateData(); + if (!calcData) return 1; XFA_VERSION version = pAcc->GetDoc()->GetXFADoc()->GetCurVersionMode(); - switch (calc.GetOverride()) { + switch (calcData.GetOverride()) { case XFA_ATTRIBUTEENUM_Error: { if (version <= XFA_VERSION_204) return 1; @@ -682,7 +682,7 @@ int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) { } case XFA_ATTRIBUTEENUM_Warning: { if (version <= XFA_VERSION_204) { - CXFA_Script script = calc.GetScript(); + CXFA_Script script = calcData.GetScript(); if (!script) return 1; @@ -700,7 +700,7 @@ int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) { return 0; WideString wsMessage; - calc.GetMessageText(wsMessage); + calcData.GetMessageText(wsMessage); if (!wsMessage.IsEmpty()) wsMessage += L"\r\n"; diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp index e68b2192e9..7de7d27748 100644 --- a/xfa/fxfa/cxfa_ffwidgethandler.cpp +++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp @@ -189,8 +189,8 @@ bool CXFA_FFWidgetHandler::HasEvent(CXFA_WidgetAcc* pWidgetAcc, switch (eEventType) { case XFA_EVENT_Calculate: { - CXFA_Calculate calc = pWidgetAcc->GetCalculate(); - return calc && calc.GetScript(); + CXFA_CalculateData calcData = pWidgetAcc->GetCalculateData(); + return calcData && calcData.GetScript(); } case XFA_EVENT_Validate: { CXFA_Validate val = pWidgetAcc->GetValidate(false); @@ -220,13 +220,13 @@ int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_WidgetAcc* pWidgetAcc, } return XFA_EVENTERROR_Disabled; case XFA_EVENT_InitCalculate: { - CXFA_Calculate calc = pWidgetAcc->GetCalculate(); - if (!calc) + CXFA_CalculateData calcData = pWidgetAcc->GetCalculateData(); + if (!calcData) return XFA_EVENTERROR_NotExist; if (pWidgetAcc->GetNode()->IsUserInteractive()) return XFA_EVENTERROR_Disabled; - CXFA_Script script = calc.GetScript(); + CXFA_Script script = calcData.GetScript(); return pWidgetAcc->ExecuteScript(script, pParam); } default: diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp index c4ecd6db9e..59046d3313 100644 --- a/xfa/fxfa/cxfa_widgetacc.cpp +++ b/xfa/fxfa/cxfa_widgetacc.cpp @@ -319,15 +319,15 @@ int32_t CXFA_WidgetAcc::ProcessCalculate() { if (GetElementType() == XFA_Element::Draw) return XFA_EVENTERROR_NotExist; - CXFA_Calculate calc = GetCalculate(); - if (!calc) + CXFA_CalculateData calcData = GetCalculateData(); + if (!calcData) return XFA_EVENTERROR_NotExist; if (GetNode()->IsUserInteractive()) return XFA_EVENTERROR_Disabled; CXFA_EventParam EventParam; EventParam.m_eType = XFA_EVENT_Calculate; - CXFA_Script script = calc.GetScript(); + CXFA_Script script = calcData.GetScript(); int32_t iRet = ExecuteScript(script, &EventParam); if (iRet != XFA_EVENTERROR_Success) return iRet; diff --git a/xfa/fxfa/parser/cxfa_calculate.cpp b/xfa/fxfa/parser/cxfa_calculate.cpp deleted file mode 100644 index 6f5c8a664a..0000000000 --- a/xfa/fxfa/parser/cxfa_calculate.cpp +++ /dev/null @@ -1,32 +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_calculate.h" - -#include "xfa/fxfa/parser/cxfa_node.h" -#include "xfa/fxfa/parser/cxfa_text.h" - -CXFA_Calculate::CXFA_Calculate(CXFA_Node* pNode) : CXFA_Data(pNode) {} - -int32_t CXFA_Calculate::GetOverride() { - XFA_ATTRIBUTEENUM eAtt = XFA_ATTRIBUTEENUM_Error; - m_pNode->JSNode()->TryEnum(XFA_ATTRIBUTE_Override, eAtt, false); - return eAtt; -} - -CXFA_Script CXFA_Calculate::GetScript() { - return CXFA_Script(m_pNode->GetChild(0, XFA_Element::Script, false)); -} - -void CXFA_Calculate::GetMessageText(WideString& wsMessage) { - CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Message, false); - if (!pNode) - return; - - CXFA_Text text(pNode->GetChild(0, XFA_Element::Text, false)); - if (text) - text.GetContent(wsMessage); -} diff --git a/xfa/fxfa/parser/cxfa_calculate.h b/xfa/fxfa/parser/cxfa_calculate.h deleted file mode 100644 index b3a6ef2eaa..0000000000 --- a/xfa/fxfa/parser/cxfa_calculate.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_CALCULATE_H_ -#define XFA_FXFA_PARSER_CXFA_CALCULATE_H_ - -#include "core/fxcrt/fx_string.h" -#include "xfa/fxfa/parser/cxfa_data.h" -#include "xfa/fxfa/parser/cxfa_script.h" - -class CXFA_Node; - -class CXFA_Calculate : public CXFA_Data { - public: - explicit CXFA_Calculate(CXFA_Node* pNode); - - int32_t GetOverride(); - CXFA_Script GetScript(); - void GetMessageText(WideString& wsMessage); -}; - -#endif // XFA_FXFA_PARSER_CXFA_CALCULATE_H_ diff --git a/xfa/fxfa/parser/cxfa_calculatedata.cpp b/xfa/fxfa/parser/cxfa_calculatedata.cpp new file mode 100644 index 0000000000..1db5779486 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_calculatedata.cpp @@ -0,0 +1,32 @@ +// 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_node.h" +#include "xfa/fxfa/parser/cxfa_text.h" + +CXFA_CalculateData::CXFA_CalculateData(CXFA_Node* pNode) : CXFA_Data(pNode) {} + +int32_t CXFA_CalculateData::GetOverride() { + XFA_ATTRIBUTEENUM eAtt = XFA_ATTRIBUTEENUM_Error; + m_pNode->JSNode()->TryEnum(XFA_ATTRIBUTE_Override, eAtt, false); + return eAtt; +} + +CXFA_Script CXFA_CalculateData::GetScript() { + return CXFA_Script(m_pNode->GetChild(0, XFA_Element::Script, false)); +} + +void CXFA_CalculateData::GetMessageText(WideString& wsMessage) { + CXFA_Node* pNode = m_pNode->GetChild(0, XFA_Element::Message, false); + if (!pNode) + return; + + CXFA_Text text(pNode->GetChild(0, XFA_Element::Text, false)); + if (text) + text.GetContent(wsMessage); +} diff --git a/xfa/fxfa/parser/cxfa_calculatedata.h b/xfa/fxfa/parser/cxfa_calculatedata.h new file mode 100644 index 0000000000..0c1a8220c1 --- /dev/null +++ b/xfa/fxfa/parser/cxfa_calculatedata.h @@ -0,0 +1,25 @@ +// 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_data.h" +#include "xfa/fxfa/parser/cxfa_script.h" + +class CXFA_Node; + +class CXFA_CalculateData : public CXFA_Data { + public: + explicit CXFA_CalculateData(CXFA_Node* pNode); + + int32_t GetOverride(); + CXFA_Script GetScript(); + void GetMessageText(WideString& wsMessage); +}; + +#endif // XFA_FXFA_PARSER_CXFA_CALCULATEDATA_H_ diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index ae857cb9c5..d8d5cfcc1d 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -343,8 +343,8 @@ CXFA_Value CXFA_WidgetData::GetFormValue() { m_pNode->JSNode()->GetProperty(0, XFA_Element::Value, false)); } -CXFA_Calculate CXFA_WidgetData::GetCalculate() { - return CXFA_Calculate( +CXFA_CalculateData CXFA_WidgetData::GetCalculateData() { + return CXFA_CalculateData( m_pNode->JSNode()->GetProperty(0, XFA_Element::Calculate, false)); } diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h index f741a33858..4689878e9f 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.h +++ b/xfa/fxfa/parser/cxfa_widgetdata.h @@ -15,7 +15,7 @@ #include "xfa/fxfa/parser/cxfa_assistdata.h" #include "xfa/fxfa/parser/cxfa_binddata.h" #include "xfa/fxfa/parser/cxfa_borderdata.h" -#include "xfa/fxfa/parser/cxfa_calculate.h" +#include "xfa/fxfa/parser/cxfa_calculatedata.h" #include "xfa/fxfa/parser/cxfa_caption.h" #include "xfa/fxfa/parser/cxfa_data.h" #include "xfa/fxfa/parser/cxfa_font.h" @@ -60,7 +60,7 @@ class CXFA_WidgetData : public CXFA_Data { bool bIsFormReady); CXFA_Value GetDefaultValue(); CXFA_Value GetFormValue(); - CXFA_Calculate GetCalculate(); + CXFA_CalculateData GetCalculateData(); CXFA_Validate GetValidate(bool bModified); bool GetWidth(float& fWidth); -- cgit v1.2.3