summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-07 20:59:00 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-07 20:59:00 +0000
commitc3ef52cf3c26d47877740dc46faa3088be44cfae (patch)
tree27cb3e37aa958fd1237fd7d314e6ac1361108461
parent2a69b9ef97ddf46fe01de432bd0ccc1b7ce92bcb (diff)
downloadpdfium-c3ef52cf3c26d47877740dc46faa3088be44cfae.tar.xz
Rename CXFA_Occur to CXFA_OccurData
This CL renames CXFA_Occur to CXFA_OccurData to show it is part of the data hierarchy. Change-Id: I55096747338a9ff83ab24f528f6715a6f4302ba7 Reviewed-on: https://pdfium-review.googlesource.com/17988 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
-rw-r--r--BUILD.gn4
-rw-r--r--fxjs/cjx_node.cpp69
-rw-r--r--xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp7
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp2
-rw-r--r--xfa/fxfa/parser/cxfa_occurdata.cpp (renamed from xfa/fxfa/parser/cxfa_occur.cpp)16
-rw-r--r--xfa/fxfa/parser/cxfa_occurdata.h (renamed from xfa/fxfa/parser/cxfa_occur.h)10
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp9
7 files changed, 58 insertions, 59 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 72a526d6fa..dee6505cdc 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -1858,8 +1858,8 @@ if (pdf_enable_xfa) {
"xfa/fxfa/parser/cxfa_nodelocale.h",
"xfa/fxfa/parser/cxfa_object.cpp",
"xfa/fxfa/parser/cxfa_object.h",
- "xfa/fxfa/parser/cxfa_occur.cpp",
- "xfa/fxfa/parser/cxfa_occur.h",
+ "xfa/fxfa/parser/cxfa_occurdata.cpp",
+ "xfa/fxfa/parser/cxfa_occurdata.h",
"xfa/fxfa/parser/cxfa_para.cpp",
"xfa/fxfa/parser/cxfa_para.h",
"xfa/fxfa/parser/cxfa_rectangle.h",
diff --git a/fxjs/cjx_node.cpp b/fxjs/cjx_node.cpp
index dcdd0c5bd3..d81c8d5f00 100644
--- a/fxjs/cjx_node.cpp
+++ b/fxjs/cjx_node.cpp
@@ -25,7 +25,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_occur.h"
+#include "xfa/fxfa/parser/cxfa_occurdata.h"
#include "xfa/fxfa/parser/cxfa_simple_parser.h"
#include "xfa/fxfa/parser/xfa_utils.h"
@@ -351,9 +351,9 @@ int32_t CJX_Node::Subform_and_SubformSet_InstanceIndex() {
}
int32_t CJX_Node::InstanceManager_SetInstances(int32_t iDesired) {
- CXFA_Occur nodeOccur(GetXFANode()->GetOccurNode());
- int32_t iMax = nodeOccur.GetMax();
- int32_t iMin = nodeOccur.GetMin();
+ CXFA_OccurData occurData(GetXFANode()->GetOccurNode());
+ int32_t iMax = occurData.GetMax();
+ int32_t iMin = occurData.GetMin();
if (iDesired < iMin) {
ThrowTooManyOccurancesException(L"min");
return 1;
@@ -2449,8 +2449,7 @@ void CJX_Node::Script_InstanceManager_Max(CFXJSE_Value* pValue,
ThrowInvalidPropertyException();
return;
}
- CXFA_Occur nodeOccur(GetXFANode()->GetOccurNode());
- pValue->SetInteger(nodeOccur.GetMax());
+ pValue->SetInteger(CXFA_OccurData(GetXFANode()->GetOccurNode()).GetMax());
}
void CJX_Node::Script_InstanceManager_Min(CFXJSE_Value* pValue,
@@ -2460,8 +2459,7 @@ void CJX_Node::Script_InstanceManager_Min(CFXJSE_Value* pValue,
ThrowInvalidPropertyException();
return;
}
- CXFA_Occur nodeOccur(GetXFANode()->GetOccurNode());
- pValue->SetInteger(nodeOccur.GetMin());
+ pValue->SetInteger(CXFA_OccurData(GetXFANode()->GetOccurNode()).GetMin());
}
void CJX_Node::Script_InstanceManager_Count(CFXJSE_Value* pValue,
@@ -2511,8 +2509,8 @@ void CJX_Node::Script_InstanceManager_RemoveInstance(
ThrowIndexOutOfBoundsException();
return;
}
- CXFA_Occur nodeOccur(GetXFANode()->GetOccurNode());
- int32_t iMin = nodeOccur.GetMin();
+
+ int32_t iMin = CXFA_OccurData(GetXFANode()->GetOccurNode()).GetMin();
if (iCount - 1 < iMin) {
ThrowTooManyOccurancesException(L"min");
return;
@@ -2554,30 +2552,31 @@ void CJX_Node::Script_InstanceManager_AddInstance(
ThrowParamCountMismatchException(L"addInstance");
return;
}
+
bool fFlags = true;
- if (argc == 1) {
+ if (argc == 1)
fFlags = pArguments->GetInt32(0) == 0 ? false : true;
- }
+
int32_t iCount = GetXFANode()->GetCount();
- CXFA_Occur nodeOccur(GetXFANode()->GetOccurNode());
- int32_t iMax = nodeOccur.GetMax();
+ int32_t iMax = CXFA_OccurData(GetXFANode()->GetOccurNode()).GetMax();
if (iMax >= 0 && iCount >= iMax) {
ThrowTooManyOccurancesException(L"max");
return;
}
+
CXFA_Node* pNewInstance = GetXFANode()->CreateInstance(fFlags);
GetXFANode()->InsertItem(pNewInstance, iCount, iCount, false);
pArguments->GetReturnValue()->Assign(
GetDocument()->GetScriptContext()->GetJSValueFromMap(pNewInstance));
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
- if (!pNotify) {
+ if (!pNotify)
return;
- }
+
pNotify->RunNodeInitialize(pNewInstance);
CXFA_LayoutProcessor* pLayoutPro = GetDocument()->GetLayoutProcessor();
- if (!pLayoutPro) {
+ if (!pLayoutPro)
return;
- }
+
pLayoutPro->AddChangedContainer(
ToNode(GetDocument()->GetXFAObject(XFA_HASHCODE_Form)));
}
@@ -2589,59 +2588,59 @@ void CJX_Node::Script_InstanceManager_InsertInstance(
ThrowParamCountMismatchException(L"insertInstance");
return;
}
+
int32_t iIndex = pArguments->GetInt32(0);
- bool bBind = false;
- if (argc == 2) {
- bBind = pArguments->GetInt32(1) == 0 ? false : true;
- }
- CXFA_Occur nodeOccur(GetXFANode()->GetOccurNode());
int32_t iCount = GetXFANode()->GetCount();
if (iIndex < 0 || iIndex > iCount) {
ThrowIndexOutOfBoundsException();
return;
}
- int32_t iMax = nodeOccur.GetMax();
+
+ int32_t iMax = CXFA_OccurData(GetXFANode()->GetOccurNode()).GetMax();
if (iMax >= 0 && iCount >= iMax) {
ThrowTooManyOccurancesException(L"max");
return;
}
- CXFA_Node* pNewInstance = GetXFANode()->CreateInstance(bBind);
+
+ CXFA_Node* pNewInstance =
+ GetXFANode()->CreateInstance(argc == 2 && pArguments->GetInt32(1) != 0);
GetXFANode()->InsertItem(pNewInstance, iIndex, iCount, true);
pArguments->GetReturnValue()->Assign(
GetDocument()->GetScriptContext()->GetJSValueFromMap(pNewInstance));
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
- if (!pNotify) {
+ if (!pNotify)
return;
- }
+
pNotify->RunNodeInitialize(pNewInstance);
CXFA_LayoutProcessor* pLayoutPro = GetDocument()->GetLayoutProcessor();
- if (!pLayoutPro) {
+ if (!pLayoutPro)
return;
- }
+
pLayoutPro->AddChangedContainer(
ToNode(GetDocument()->GetXFAObject(XFA_HASHCODE_Form)));
}
+
void CJX_Node::Script_Occur_Max(CFXJSE_Value* pValue,
bool bSetting,
XFA_ATTRIBUTE eAttribute) {
- CXFA_Occur occur(GetXFANode());
+ CXFA_OccurData occurData(GetXFANode());
if (bSetting) {
int32_t iMax = pValue->ToInteger();
- occur.SetMax(iMax);
+ occurData.SetMax(iMax);
} else {
- pValue->SetInteger(occur.GetMax());
+ pValue->SetInteger(occurData.GetMax());
}
}
void CJX_Node::Script_Occur_Min(CFXJSE_Value* pValue,
bool bSetting,
XFA_ATTRIBUTE eAttribute) {
- CXFA_Occur occur(GetXFANode());
+ CXFA_OccurData occurData(GetXFANode());
if (bSetting) {
int32_t iMin = pValue->ToInteger();
- occur.SetMin(iMin);
+ occurData.SetMin(iMin);
} else {
- pValue->SetInteger(occur.GetMin());
+ pValue->SetInteger(occurData.GetMin());
}
}
diff --git a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
index f408ec4d58..16b0dee096 100644
--- a/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
+++ b/xfa/fxfa/parser/cxfa_itemlayoutprocessor.cpp
@@ -23,7 +23,7 @@
#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
#include "xfa/fxfa/parser/cxfa_node.h"
-#include "xfa/fxfa/parser/cxfa_occur.h"
+#include "xfa/fxfa/parser/cxfa_occurdata.h"
#include "xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h"
#include "xfa/fxfa/parser/xfa_utils.h"
@@ -2820,8 +2820,9 @@ bool CXFA_ItemLayoutProcessor::JudgeLeaderOrTrailerForOccur(
if (!pTemplate)
pTemplate = pFormNode;
- CXFA_Occur NodeOccur(pTemplate->GetFirstChildByClass(XFA_Element::Occur));
- int32_t iMax = NodeOccur.GetMax();
+ int32_t iMax =
+ CXFA_OccurData(pTemplate->GetFirstChildByClass(XFA_Element::Occur))
+ .GetMax();
if (iMax < 0)
return true;
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 475295f9dd..64beeffa03 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -32,7 +32,7 @@
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
-#include "xfa/fxfa/parser/cxfa_occur.h"
+#include "xfa/fxfa/parser/cxfa_occurdata.h"
#include "xfa/fxfa/parser/cxfa_simple_parser.h"
#include "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h"
#include "xfa/fxfa/parser/xfa_basic_data.h"
diff --git a/xfa/fxfa/parser/cxfa_occur.cpp b/xfa/fxfa/parser/cxfa_occurdata.cpp
index 6c770d2e72..3bbe00cd35 100644
--- a/xfa/fxfa/parser/cxfa_occur.cpp
+++ b/xfa/fxfa/parser/cxfa_occurdata.cpp
@@ -4,13 +4,13 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "xfa/fxfa/parser/cxfa_occur.h"
+#include "xfa/fxfa/parser/cxfa_occurdata.h"
#include "xfa/fxfa/parser/cxfa_node.h"
-CXFA_Occur::CXFA_Occur(CXFA_Node* pNode) : CXFA_Data(pNode) {}
+CXFA_OccurData::CXFA_OccurData(CXFA_Node* pNode) : CXFA_Data(pNode) {}
-int32_t CXFA_Occur::GetMax() {
+int32_t CXFA_OccurData::GetMax() {
int32_t iMax = 1;
if (m_pNode) {
if (!m_pNode->JSNode()->TryInteger(XFA_ATTRIBUTE_Max, iMax, true))
@@ -19,7 +19,7 @@ int32_t CXFA_Occur::GetMax() {
return iMax;
}
-int32_t CXFA_Occur::GetMin() {
+int32_t CXFA_OccurData::GetMin() {
int32_t iMin = 1;
if (m_pNode) {
if (!m_pNode->JSNode()->TryInteger(XFA_ATTRIBUTE_Min, iMin, true) ||
@@ -29,7 +29,9 @@ int32_t CXFA_Occur::GetMin() {
return iMin;
}
-bool CXFA_Occur::GetOccurInfo(int32_t& iMin, int32_t& iMax, int32_t& iInit) {
+bool CXFA_OccurData::GetOccurInfo(int32_t& iMin,
+ int32_t& iMax,
+ int32_t& iInit) {
if (!m_pNode)
return false;
if (!m_pNode->JSNode()->TryInteger(XFA_ATTRIBUTE_Min, iMin, false) ||
@@ -48,7 +50,7 @@ bool CXFA_Occur::GetOccurInfo(int32_t& iMin, int32_t& iMax, int32_t& iInit) {
return true;
}
-void CXFA_Occur::SetMax(int32_t iMax) {
+void CXFA_OccurData::SetMax(int32_t iMax) {
iMax = (iMax != -1 && iMax < 1) ? 1 : iMax;
m_pNode->JSNode()->SetInteger(XFA_ATTRIBUTE_Max, iMax, false);
int32_t iMin = GetMin();
@@ -58,7 +60,7 @@ void CXFA_Occur::SetMax(int32_t iMax) {
}
}
-void CXFA_Occur::SetMin(int32_t iMin) {
+void CXFA_OccurData::SetMin(int32_t iMin) {
iMin = (iMin < 0) ? 1 : iMin;
m_pNode->JSNode()->SetInteger(XFA_ATTRIBUTE_Min, iMin, false);
int32_t iMax = GetMax();
diff --git a/xfa/fxfa/parser/cxfa_occur.h b/xfa/fxfa/parser/cxfa_occurdata.h
index 69db071a11..90554bd0eb 100644
--- a/xfa/fxfa/parser/cxfa_occur.h
+++ b/xfa/fxfa/parser/cxfa_occurdata.h
@@ -4,17 +4,17 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef XFA_FXFA_PARSER_CXFA_OCCUR_H_
-#define XFA_FXFA_PARSER_CXFA_OCCUR_H_
+#ifndef XFA_FXFA_PARSER_CXFA_OCCURDATA_H_
+#define XFA_FXFA_PARSER_CXFA_OCCURDATA_H_
#include "core/fxcrt/fx_system.h"
#include "xfa/fxfa/parser/cxfa_data.h"
class CXFA_Node;
-class CXFA_Occur : public CXFA_Data {
+class CXFA_OccurData : public CXFA_Data {
public:
- explicit CXFA_Occur(CXFA_Node* pNode);
+ explicit CXFA_OccurData(CXFA_Node* pNode);
int32_t GetMax();
int32_t GetMin();
@@ -23,4 +23,4 @@ class CXFA_Occur : public CXFA_Data {
void SetMin(int32_t iMin);
};
-#endif // XFA_FXFA_PARSER_CXFA_OCCUR_H_
+#endif // XFA_FXFA_PARSER_CXFA_OCCURDATA_H_
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index a6441a68db..f7df149ceb 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -19,7 +19,7 @@
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
#include "xfa/fxfa/parser/cxfa_localemgr.h"
#include "xfa/fxfa/parser/cxfa_node.h"
-#include "xfa/fxfa/parser/cxfa_occur.h"
+#include "xfa/fxfa/parser/cxfa_occurdata.h"
#include "xfa/fxfa/parser/cxfa_traversestrategy_xfacontainernode.h"
#include "xfa/fxfa/parser/cxfa_traversestrategy_xfanode.h"
#include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
@@ -49,11 +49,8 @@ bool GetOccurInfo(CXFA_Node* pOccurNode,
int32_t& iMin,
int32_t& iMax,
int32_t& iInit) {
- if (!pOccurNode)
- return false;
-
- CXFA_Occur occur(pOccurNode);
- return occur.GetOccurInfo(iMin, iMax, iInit);
+ return pOccurNode &&
+ CXFA_OccurData(pOccurNode).GetOccurInfo(iMin, iMax, iInit);
}
CXFA_Node* FormValueNode_CreateChild(CXFA_Node* pValueNode, XFA_Element iType) {