summaryrefslogtreecommitdiff
path: root/xfa/fxfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa')
-rw-r--r--xfa/fxfa/parser/cxfa_boxdata.cpp19
-rw-r--r--xfa/fxfa/parser/cxfa_filldata.cpp28
-rw-r--r--xfa/fxfa/parser/cxfa_filldata.h12
-rw-r--r--xfa/fxfa/parser/cxfa_fontdata.cpp3
-rw-r--r--xfa/fxfa/parser/cxfa_layoutpagemgr.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_strokedata.cpp4
-rw-r--r--xfa/fxfa/parser/cxfa_validate.cpp7
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp65
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp14
9 files changed, 93 insertions, 63 deletions
diff --git a/xfa/fxfa/parser/cxfa_boxdata.cpp b/xfa/fxfa/parser/cxfa_boxdata.cpp
index 7ada3bf00b..6e27c71e56 100644
--- a/xfa/fxfa/parser/cxfa_boxdata.cpp
+++ b/xfa/fxfa/parser/cxfa_boxdata.cpp
@@ -6,7 +6,10 @@
#include "xfa/fxfa/parser/cxfa_boxdata.h"
+#include "xfa/fxfa/parser/cxfa_corner.h"
#include "xfa/fxfa/parser/cxfa_cornerdata.h"
+#include "xfa/fxfa/parser/cxfa_edge.h"
+#include "xfa/fxfa/parser/cxfa_fill.h"
#include "xfa/fxfa/parser/cxfa_margin.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
#include "xfa/fxfa/parser/cxfa_node.h"
@@ -21,8 +24,9 @@ std::vector<CXFA_StrokeData> GetStrokesInternal(CXFA_Node* pNode, bool bNull) {
strokes.resize(8);
int32_t i, j;
for (i = 0, j = 0; i < 4; i++) {
- CXFA_CornerData cornerData = CXFA_CornerData(
- pNode->JSObject()->GetProperty(i, XFA_Element::Corner, i == 0));
+ CXFA_CornerData cornerData =
+ CXFA_CornerData(pNode->JSObject()->GetProperty<CXFA_Corner>(
+ i, XFA_Element::Corner, i == 0));
if (cornerData.HasValidNode() || i == 0) {
strokes[j] = cornerData;
} else if (!bNull) {
@@ -32,8 +36,9 @@ std::vector<CXFA_StrokeData> GetStrokesInternal(CXFA_Node* pNode, bool bNull) {
strokes[j] = strokes[2];
}
j++;
- CXFA_EdgeData edgeData = CXFA_EdgeData(
- pNode->JSObject()->GetProperty(i, XFA_Element::Edge, i == 0));
+ CXFA_EdgeData edgeData =
+ CXFA_EdgeData(pNode->JSObject()->GetProperty<CXFA_Edge>(
+ i, XFA_Element::Edge, i == 0));
if (edgeData.HasValidNode() || i == 0) {
strokes[j] = edgeData;
} else if (!bNull) {
@@ -98,7 +103,7 @@ int32_t CXFA_BoxData::CountEdges() const {
}
CXFA_EdgeData CXFA_BoxData::GetEdgeData(int32_t nIndex) const {
- return CXFA_EdgeData(m_pNode ? m_pNode->JSObject()->GetProperty(
+ return CXFA_EdgeData(m_pNode ? m_pNode->JSObject()->GetProperty<CXFA_Edge>(
nIndex, XFA_Element::Edge, nIndex == 0)
: nullptr);
}
@@ -129,8 +134,8 @@ CXFA_FillData CXFA_BoxData::GetFillData(bool bModified) const {
if (!m_pNode)
return CXFA_FillData(nullptr);
- CXFA_Node* pFillNode =
- m_pNode->JSObject()->GetProperty(0, XFA_Element::Fill, bModified);
+ CXFA_Node* pFillNode = m_pNode->JSObject()->GetProperty<CXFA_Fill>(
+ 0, XFA_Element::Fill, bModified);
return CXFA_FillData(pFillNode);
}
diff --git a/xfa/fxfa/parser/cxfa_filldata.cpp b/xfa/fxfa/parser/cxfa_filldata.cpp
index 98df0aa3a4..067d75246c 100644
--- a/xfa/fxfa/parser/cxfa_filldata.cpp
+++ b/xfa/fxfa/parser/cxfa_filldata.cpp
@@ -7,7 +7,11 @@
#include "xfa/fxfa/parser/cxfa_filldata.h"
#include "xfa/fxfa/parser/cxfa_color.h"
+#include "xfa/fxfa/parser/cxfa_linear.h"
#include "xfa/fxfa/parser/cxfa_node.h"
+#include "xfa/fxfa/parser/cxfa_pattern.h"
+#include "xfa/fxfa/parser/cxfa_radial.h"
+#include "xfa/fxfa/parser/cxfa_stipple.h"
CXFA_FillData::CXFA_FillData(CXFA_Node* pNode) : CXFA_DataData(pNode) {}
@@ -21,8 +25,8 @@ bool CXFA_FillData::IsVisible() const {
}
void CXFA_FillData::SetColor(FX_ARGB color) {
- CXFA_Node* pNode =
- m_pNode->JSObject()->GetProperty(0, XFA_Element::Color, true);
+ CXFA_Color* pNode =
+ m_pNode->JSObject()->GetProperty<CXFA_Color>(0, XFA_Element::Color, true);
int a;
int r;
int g;
@@ -127,18 +131,22 @@ FX_ARGB CXFA_FillData::GetRadialColor() const {
return 0xFF000000;
}
-CXFA_Node* CXFA_FillData::GetStipple() const {
- return m_pNode->JSObject()->GetProperty(0, XFA_Element::Stipple, true);
+CXFA_Stipple* CXFA_FillData::GetStipple() const {
+ return m_pNode->JSObject()->GetProperty<CXFA_Stipple>(0, XFA_Element::Stipple,
+ true);
}
-CXFA_Node* CXFA_FillData::GetRadial() const {
- return m_pNode->JSObject()->GetProperty(0, XFA_Element::Radial, true);
+CXFA_Radial* CXFA_FillData::GetRadial() const {
+ return m_pNode->JSObject()->GetProperty<CXFA_Radial>(0, XFA_Element::Radial,
+ true);
}
-CXFA_Node* CXFA_FillData::GetLinear() const {
- return m_pNode->JSObject()->GetProperty(0, XFA_Element::Linear, true);
+CXFA_Linear* CXFA_FillData::GetLinear() const {
+ return m_pNode->JSObject()->GetProperty<CXFA_Linear>(0, XFA_Element::Linear,
+ true);
}
-CXFA_Node* CXFA_FillData::GetPattern() const {
- return m_pNode->JSObject()->GetProperty(0, XFA_Element::Pattern, true);
+CXFA_Pattern* CXFA_FillData::GetPattern() const {
+ return m_pNode->JSObject()->GetProperty<CXFA_Pattern>(0, XFA_Element::Pattern,
+ true);
}
diff --git a/xfa/fxfa/parser/cxfa_filldata.h b/xfa/fxfa/parser/cxfa_filldata.h
index 8331123404..94e840e230 100644
--- a/xfa/fxfa/parser/cxfa_filldata.h
+++ b/xfa/fxfa/parser/cxfa_filldata.h
@@ -11,7 +11,11 @@
#include "core/fxge/fx_dib.h"
#include "xfa/fxfa/parser/cxfa_datadata.h"
+class CXFA_Linear;
class CXFA_Node;
+class CXFA_Pattern;
+class CXFA_Radial;
+class CXFA_Stipple;
class CXFA_FillData : public CXFA_DataData {
public:
@@ -38,10 +42,10 @@ class CXFA_FillData : public CXFA_DataData {
FX_ARGB GetRadialColor() const;
private:
- CXFA_Node* GetStipple() const;
- CXFA_Node* GetRadial() const;
- CXFA_Node* GetLinear() const;
- CXFA_Node* GetPattern() const;
+ CXFA_Stipple* GetStipple() const;
+ CXFA_Radial* GetRadial() const;
+ CXFA_Linear* GetLinear() const;
+ CXFA_Pattern* GetPattern() const;
};
#endif // XFA_FXFA_PARSER_CXFA_FILLDATA_H_
diff --git a/xfa/fxfa/parser/cxfa_fontdata.cpp b/xfa/fxfa/parser/cxfa_fontdata.cpp
index 78ff2e89aa..88dc930dab 100644
--- a/xfa/fxfa/parser/cxfa_fontdata.cpp
+++ b/xfa/fxfa/parser/cxfa_fontdata.cpp
@@ -78,7 +78,8 @@ bool CXFA_FontData::IsItalic() const {
}
void CXFA_FontData::SetColor(FX_ARGB color) {
- CXFA_FillData(m_pNode->JSObject()->GetProperty(0, XFA_Element::Fill, true))
+ CXFA_FillData(
+ m_pNode->JSObject()->GetProperty<CXFA_Fill>(0, XFA_Element::Fill, true))
.SetColor(color);
}
diff --git a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
index 5cd7b76ddc..b511cf8d3d 100644
--- a/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
+++ b/xfa/fxfa/parser/cxfa_layoutpagemgr.cpp
@@ -287,8 +287,8 @@ bool CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) {
if (!pTemplateNode)
return false;
- m_pTemplatePageSetRoot =
- pTemplateNode->JSObject()->GetProperty(0, XFA_Element::PageSet, true);
+ m_pTemplatePageSetRoot = pTemplateNode->JSObject()->GetProperty<CXFA_PageSet>(
+ 0, XFA_Element::PageSet, true);
ASSERT(m_pTemplatePageSetRoot);
if (m_pPageSetLayoutItemRoot) {
m_pPageSetLayoutItemRoot->m_pParent = nullptr;
diff --git a/xfa/fxfa/parser/cxfa_strokedata.cpp b/xfa/fxfa/parser/cxfa_strokedata.cpp
index 4c4e810555..7886730d39 100644
--- a/xfa/fxfa/parser/cxfa_strokedata.cpp
+++ b/xfa/fxfa/parser/cxfa_strokedata.cpp
@@ -65,8 +65,8 @@ void CXFA_StrokeData::SetColor(FX_ARGB argb) {
if (!m_pNode)
return;
- CXFA_Node* pNode =
- m_pNode->JSObject()->GetProperty(0, XFA_Element::Color, true);
+ CXFA_Color* pNode =
+ m_pNode->JSObject()->GetProperty<CXFA_Color>(0, XFA_Element::Color, true);
int a;
int r;
int g;
diff --git a/xfa/fxfa/parser/cxfa_validate.cpp b/xfa/fxfa/parser/cxfa_validate.cpp
index 49f7f1aeff..665c606632 100644
--- a/xfa/fxfa/parser/cxfa_validate.cpp
+++ b/xfa/fxfa/parser/cxfa_validate.cpp
@@ -8,6 +8,7 @@
#include "fxjs/xfa/cjx_validate.h"
#include "third_party/base/ptr_util.h"
+#include "xfa/fxfa/parser/cxfa_message.h"
#include "xfa/fxfa/parser/cxfa_picture.h"
#include "xfa/fxfa/parser/cxfa_script.h"
@@ -73,7 +74,8 @@ XFA_AttributeEnum CXFA_Validate::GetScriptTest() {
}
WideString CXFA_Validate::GetMessageText(const WideString& wsMessageType) {
- CXFA_Node* pNode = JSObject()->GetProperty(0, XFA_Element::Message, false);
+ CXFA_Message* pNode =
+ JSObject()->GetProperty<CXFA_Message>(0, XFA_Element::Message, false);
if (!pNode)
return L"";
@@ -116,7 +118,8 @@ void CXFA_Validate::SetScriptMessageText(const WideString& wsMessage) {
void CXFA_Validate::SetMessageText(const WideString& wsMessageType,
const WideString& wsMessage) {
- CXFA_Node* pNode = JSObject()->GetProperty(0, XFA_Element::Message, true);
+ CXFA_Message* pNode =
+ JSObject()->GetProperty<CXFA_Message>(0, XFA_Element::Message, true);
if (!pNode)
return;
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index 38f85e715b..fd722ad464 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -10,15 +10,22 @@
#include "core/fxcrt/fx_extension.h"
#include "third_party/base/stl_util.h"
#include "xfa/fxfa/cxfa_ffnotify.h"
+#include "xfa/fxfa/parser/cxfa_bind.h"
+#include "xfa/fxfa/parser/cxfa_border.h"
+#include "xfa/fxfa/parser/cxfa_calculate.h"
+#include "xfa/fxfa/parser/cxfa_caption.h"
#include "xfa/fxfa/parser/cxfa_comb.h"
#include "xfa/fxfa/parser/cxfa_decimal.h"
#include "xfa/fxfa/parser/cxfa_document.h"
#include "xfa/fxfa/parser/cxfa_eventdata.h"
+#include "xfa/fxfa/parser/cxfa_font.h"
#include "xfa/fxfa/parser/cxfa_format.h"
#include "xfa/fxfa/parser/cxfa_items.h"
#include "xfa/fxfa/parser/cxfa_localevalue.h"
+#include "xfa/fxfa/parser/cxfa_margin.h"
#include "xfa/fxfa/parser/cxfa_measurement.h"
#include "xfa/fxfa/parser/cxfa_node.h"
+#include "xfa/fxfa/parser/cxfa_para.h"
#include "xfa/fxfa/parser/cxfa_picture.h"
#include "xfa/fxfa/parser/cxfa_ui.h"
#include "xfa/fxfa/parser/cxfa_validate.h"
@@ -76,8 +83,8 @@ CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) {
eWidgetType = XFA_Element::Unknown;
XFA_Element eUIType = XFA_Element::Unknown;
- auto* defValue = static_cast<CXFA_Value*>(
- pNode->JSObject()->GetProperty(0, XFA_Element::Value, true));
+ auto* defValue =
+ pNode->JSObject()->GetProperty<CXFA_Value>(0, XFA_Element::Value, true);
XFA_Element eValueType =
defValue ? defValue->GetChildValueClassID() : XFA_Element::Unknown;
switch (eValueType) {
@@ -114,7 +121,8 @@ CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) {
}
CXFA_Node* pUIChild = nullptr;
- CXFA_Node* pUI = pNode->JSObject()->GetProperty(0, XFA_Element::Ui, true);
+ CXFA_Ui* pUI =
+ pNode->JSObject()->GetProperty<CXFA_Ui>(0, XFA_Element::Ui, true);
CXFA_Node* pChild = pUI->GetNodeItem(XFA_NODEITEM_FirstChild);
for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
XFA_Element eChildType = pChild->GetElementType();
@@ -160,9 +168,9 @@ CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) {
if (!pUIChild) {
if (eUIType == XFA_Element::Unknown) {
eUIType = XFA_Element::TextEdit;
- defValue->JSObject()->GetProperty(0, XFA_Element::Text, true);
+ defValue->JSObject()->GetProperty<CXFA_Text>(0, XFA_Element::Text, true);
}
- return pUI->JSObject()->GetProperty(0, eUIType, true);
+ return pUI->JSObject()->GetProperty<CXFA_Node>(0, eUIType, true);
}
if (eUIType != XFA_Element::Unknown)
@@ -205,7 +213,7 @@ CXFA_Node* CreateUIChild(CXFA_Node* pNode, XFA_Element& eWidgetType) {
eValueType = XFA_Element::Text;
break;
}
- defValue->JSObject()->GetProperty(0, eValueType, true);
+ defValue->JSObject()->GetProperty<CXFA_Node>(0, eValueType, true);
return pUIChild;
}
@@ -253,28 +261,28 @@ int32_t CXFA_WidgetData::GetRotate() const {
}
CXFA_BorderData CXFA_WidgetData::GetBorderData(bool bModified) {
- return CXFA_BorderData(
- m_pNode->JSObject()->GetProperty(0, XFA_Element::Border, bModified));
+ return CXFA_BorderData(m_pNode->JSObject()->GetProperty<CXFA_Border>(
+ 0, XFA_Element::Border, bModified));
}
CXFA_CaptionData CXFA_WidgetData::GetCaptionData() {
- return CXFA_CaptionData(
- m_pNode->JSObject()->GetProperty(0, XFA_Element::Caption, false));
+ return CXFA_CaptionData(m_pNode->JSObject()->GetProperty<CXFA_Caption>(
+ 0, XFA_Element::Caption, false));
}
CXFA_FontData CXFA_WidgetData::GetFontData(bool bModified) {
- return CXFA_FontData(
- m_pNode->JSObject()->GetProperty(0, XFA_Element::Font, bModified));
+ return CXFA_FontData(m_pNode->JSObject()->GetProperty<CXFA_Font>(
+ 0, XFA_Element::Font, bModified));
}
CXFA_MarginData CXFA_WidgetData::GetMarginData() {
- return CXFA_MarginData(
- m_pNode->JSObject()->GetProperty(0, XFA_Element::Margin, false));
+ return CXFA_MarginData(m_pNode->JSObject()->GetProperty<CXFA_Margin>(
+ 0, XFA_Element::Margin, false));
}
CXFA_ParaData CXFA_WidgetData::GetParaData() {
return CXFA_ParaData(
- m_pNode->JSObject()->GetProperty(0, XFA_Element::Para, false));
+ m_pNode->JSObject()->GetProperty<CXFA_Para>(0, XFA_Element::Para, false));
}
std::vector<CXFA_Node*> CXFA_WidgetData::GetEventList() {
@@ -307,28 +315,28 @@ std::vector<CXFA_Node*> CXFA_WidgetData::GetEventByActivity(
CXFA_Value* CXFA_WidgetData::GetDefaultValue() {
CXFA_Node* pTemNode = m_pNode->GetTemplateNode();
- return static_cast<CXFA_Value*>(
- pTemNode->JSObject()->GetProperty(0, XFA_Element::Value, false));
+ return pTemNode->JSObject()->GetProperty<CXFA_Value>(0, XFA_Element::Value,
+ false);
}
CXFA_Value* CXFA_WidgetData::GetFormValue() {
- return static_cast<CXFA_Value*>(
- m_pNode->JSObject()->GetProperty(0, XFA_Element::Value, false));
+ return m_pNode->JSObject()->GetProperty<CXFA_Value>(0, XFA_Element::Value,
+ false);
}
CXFA_CalculateData CXFA_WidgetData::GetCalculateData() {
- return CXFA_CalculateData(
- m_pNode->JSObject()->GetProperty(0, XFA_Element::Calculate, false));
+ return CXFA_CalculateData(m_pNode->JSObject()->GetProperty<CXFA_Calculate>(
+ 0, XFA_Element::Calculate, false));
}
CXFA_Validate* CXFA_WidgetData::GetValidate(bool bModified) {
- return static_cast<CXFA_Validate*>(
- m_pNode->JSObject()->GetProperty(0, XFA_Element::Validate, bModified));
+ return m_pNode->JSObject()->GetProperty<CXFA_Validate>(
+ 0, XFA_Element::Validate, bModified);
}
CXFA_BindData CXFA_WidgetData::GetBindData() {
return CXFA_BindData(
- m_pNode->JSObject()->GetProperty(0, XFA_Element::Bind, false));
+ m_pNode->JSObject()->GetProperty<CXFA_Bind>(0, XFA_Element::Bind, false));
}
pdfium::Optional<float> CXFA_WidgetData::TryWidth() {
@@ -357,15 +365,16 @@ pdfium::Optional<float> CXFA_WidgetData::TryMaxHeight() {
CXFA_BorderData CXFA_WidgetData::GetUIBorderData() {
CXFA_Node* pUIChild = GetUIChild();
- return CXFA_BorderData(pUIChild ? pUIChild->JSObject()->GetProperty(
- 0, XFA_Element::Border, false)
- : nullptr);
+ return CXFA_BorderData(pUIChild
+ ? pUIChild->JSObject()->GetProperty<CXFA_Border>(
+ 0, XFA_Element::Border, false)
+ : nullptr);
}
CFX_RectF CXFA_WidgetData::GetUIMargin() {
CXFA_Node* pUIChild = GetUIChild();
CXFA_MarginData mgUI =
- CXFA_MarginData(pUIChild ? pUIChild->JSObject()->GetProperty(
+ CXFA_MarginData(pUIChild ? pUIChild->JSObject()->GetProperty<CXFA_Margin>(
0, XFA_Element::Margin, false)
: nullptr);
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index 6b7488c4a7..551f9df3fa 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -60,7 +60,7 @@ CXFA_Node* FormValueNode_CreateChild(CXFA_Node* pValueNode, XFA_Element iType) {
if (!pChildNode) {
if (iType == XFA_Element::Unknown)
return nullptr;
- pChildNode = pValueNode->JSObject()->GetProperty(0, iType, true);
+ pChildNode = pValueNode->JSObject()->GetProperty<CXFA_Node>(0, iType, true);
}
return pChildNode;
}
@@ -132,8 +132,8 @@ void CreateDataBinding(CXFA_Node* pFormNode,
CXFA_WidgetData* pWidgetData = pFormNode->GetWidgetData();
ASSERT(pWidgetData);
XFA_Element eUIType = pWidgetData->GetUIType();
- auto* defValue = static_cast<CXFA_Value*>(
- pFormNode->JSObject()->GetProperty(0, XFA_Element::Value, true));
+ auto* defValue = pFormNode->JSObject()->GetProperty<CXFA_Value>(
+ 0, XFA_Element::Value, true);
if (!bDataToForm) {
WideString wsValue;
switch (eUIType) {
@@ -240,8 +240,8 @@ void CreateDataBinding(CXFA_Node* pFormNode,
if (pChild->GetElementType() != XFA_Element::Field)
continue;
- CXFA_Node* pValue =
- pChild->JSObject()->GetProperty(0, XFA_Element::Value, true);
+ CXFA_Value* pValue = pChild->JSObject()->GetProperty<CXFA_Value>(
+ 0, XFA_Element::Value, true);
CXFA_Items* pItems =
pChild->GetChild<CXFA_Items>(0, XFA_Element::Items, false);
CXFA_Node* pText =
@@ -265,8 +265,8 @@ void CreateDataBinding(CXFA_Node* pFormNode,
wsValue = pWidgetData->NormalizeNumStr(wsValue);
pDataNode->JSObject()->SetAttributeValue(
wsValue, pWidgetData->GetFormatDataValue(wsValue), false, false);
- CXFA_Node* pValue =
- pFormNode->JSObject()->GetProperty(0, XFA_Element::Value, true);
+ CXFA_Value* pValue = pFormNode->JSObject()->GetProperty<CXFA_Value>(
+ 0, XFA_Element::Value, true);
FormValueNode_SetChildContent(pValue, wsValue, XFA_Element::Float);
break;
}