From 5e332f1275dd6f4b6d487d313f4db8497df339ab Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Mon, 29 Jan 2018 19:52:07 +0000 Subject: Cleanup the FFWidget determination code. This CL converts the UIType to an XFA_FFWidgetType instead of reusing the XFA_Element type. The creation code is cleaned up to make it clearer what's happening. Change-Id: I5d3e4967d5c8b8a50dbb25e574b0d31fe0cf407a Reviewed-on: https://pdfium-review.googlesource.com/24390 Reviewed-by: Ryan Harrison Commit-Queue: dsinclair --- xfa/fxfa/parser/cxfa_node.h | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'xfa/fxfa/parser/cxfa_node.h') diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h index 5e1a31c63b..ae7f4bae99 100644 --- a/xfa/fxfa/parser/cxfa_node.h +++ b/xfa/fxfa/parser/cxfa_node.h @@ -16,6 +16,7 @@ #include "core/fxge/fx_dib.h" #include "fxbarcode/BC_Library.h" #include "third_party/base/optional.h" +#include "xfa/fxfa/cxfa_ffwidget.h" #include "xfa/fxfa/parser/cxfa_object.h" class CFGAS_GEFont; @@ -36,6 +37,7 @@ class CXFA_Occur; class CXFA_Para; class CXFA_Script; class CXFA_TextLayout; +class CXFA_Ui; class CXFA_Validate; class CXFA_Value; class CXFA_WidgetLayoutData; @@ -312,8 +314,9 @@ class CXFA_Node : public CXFA_Object { Optional GetBarcodeAttribute_Truncate(); Optional GetBarcodeAttribute_WideNarrowRatio(); - CXFA_Node* GetUIChild(); - XFA_Element GetUIType(); + CXFA_Node* GetUIChildNode(); + XFA_FFWidgetType GetFFWidgetType(); + CFX_RectF GetUIMargin(); CXFA_Border* GetUIBorder(); @@ -438,6 +441,7 @@ class CXFA_Node : public CXFA_Object { int32_t iTread) const; virtual XFA_Element GetValueNodeType() const; + virtual XFA_FFWidgetType GetDefaultFFWidgetType() const; protected: CXFA_Node(CXFA_Document* pDoc, @@ -505,7 +509,6 @@ class CXFA_Node : public CXFA_Object { float GetHeightWithoutMargin(float fHeightCalc); void CalculateTextContentSize(CXFA_FFDoc* doc, CFX_SizeF& size); void CalculateAccWidthAndHeight(CXFA_FFDoc* doc, - XFA_Element eUIType, float& fWidth, float& fCalcHeight); void InitLayoutData(); @@ -516,8 +519,10 @@ class CXFA_Node : public CXFA_Object { int32_t nIndex); WideString FormatNumStr(const WideString& wsValue, IFX_Locale* pLocale); void GetItemLabel(const WideStringView& wsValue, WideString& wsLabel); - std::pair CreateUIChild(); + + std::pair CreateChildUIAndValueNodesIfNeeded(); void CreateValueNodeIfNeeded(CXFA_Value* value, CXFA_Node* pUIChild); + CXFA_Node* CreateUINodeIfNeeded(CXFA_Ui* ui, XFA_Element type); const PropertyData* const m_Properties; const AttributeData* const m_Attributes; @@ -533,12 +538,13 @@ class CXFA_Node : public CXFA_Object { uint32_t m_dwNameHash; CXFA_Node* m_pAuxNode; std::vector> binding_nodes_; - CXFA_Node* m_pUiChildNode = nullptr; - XFA_Element m_eUIType = XFA_Element::Unknown; bool m_bIsNull = true; bool m_bPreNull = true; bool is_widget_ready_ = false; std::unique_ptr m_pLayoutData; + + CXFA_Ui* ui_ = nullptr; + XFA_FFWidgetType ff_widget_type_ = XFA_FFWidgetType::kNone; }; #endif // XFA_FXFA_PARSER_CXFA_NODE_H_ -- cgit v1.2.3