summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_node.h
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/parser/cxfa_node.h')
-rw-r--r--xfa/fxfa/parser/cxfa_node.h174
1 files changed, 168 insertions, 6 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index 0991a533c8..6b6e865353 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -18,6 +18,8 @@
#include "third_party/base/optional.h"
#include "xfa/fxfa/parser/cxfa_object.h"
+class CFGAS_GEFont;
+class CFX_DIBitmap;
class CFX_XMLNode;
class CXFA_Bind;
class CXFA_Border;
@@ -25,21 +27,37 @@ class CXFA_Calculate;
class CXFA_Caption;
class CXFA_Event;
class CXFA_EventParam;
+class CXFA_FFDoc;
class CXFA_FFDocView;
+class CXFA_FFWidget;
class CXFA_Font;
class CXFA_Margin;
class CXFA_Occur;
class CXFA_Para;
class CXFA_Script;
+class CXFA_TextLayout;
class CXFA_Validate;
class CXFA_Value;
-class CXFA_WidgetAcc;
+class CXFA_WidgetLayoutData;
class IFX_Locale;
#define XFA_NODEFILTER_Children 0x01
#define XFA_NODEFILTER_Properties 0x02
#define XFA_NODEFILTER_OneOfProperty 0x04
+enum XFA_CHECKSTATE {
+ XFA_CHECKSTATE_On = 0,
+ XFA_CHECKSTATE_Off = 1,
+ XFA_CHECKSTATE_Neutral = 2,
+};
+
+enum XFA_VALUEPICTURE {
+ XFA_VALUEPICTURE_Raw = 0,
+ XFA_VALUEPICTURE_Display,
+ XFA_VALUEPICTURE_Edit,
+ XFA_VALUEPICTURE_DataBind,
+};
+
enum XFA_NodeFlag {
XFA_NodeFlag_None = 0,
XFA_NodeFlag_Initialized = 1 << 0,
@@ -304,17 +322,130 @@ class CXFA_Node : public CXFA_Object {
bool IsNull() const { return m_bIsNull; }
void SetIsNull(bool val) { m_bIsNull = val; }
- void SetWidgetReady();
+ void SetWidgetReady() { is_widget_ready_ = true; }
bool IsWidgetReady() const { return is_widget_ready_; }
- CXFA_WidgetAcc* GetWidgetAcc() {
+ // TODO(dsinclair): Remove post WidgetAcc merge.
+ CXFA_Node* GetWidgetAcc() {
ASSERT(IsWidgetReady());
- ASSERT(acc_.get() != nullptr);
- return acc_.get();
+ return this;
}
std::vector<CXFA_Event*> GetEventByActivity(XFA_AttributeEnum iActivity,
bool bIsFormReady);
+ void ResetData();
+
+ CXFA_FFWidget* GetNextWidget(CXFA_FFWidget* pWidget);
+ void StartWidgetLayout(CXFA_FFDoc* doc,
+ float& fCalcWidth,
+ float& fCalcHeight);
+ bool FindSplitPos(CXFA_FFDocView* docView,
+ int32_t iBlockIndex,
+ float& fCalcHeight);
+
+ bool LoadCaption(CXFA_FFDoc* doc);
+ CXFA_TextLayout* GetCaptionTextLayout();
+
+ void LoadText(CXFA_FFDoc* doc);
+ CXFA_TextLayout* GetTextLayout();
+
+ bool LoadImageImage(CXFA_FFDoc* doc);
+ bool LoadImageEditImage(CXFA_FFDoc* doc);
+ void GetImageDpi(int32_t& iImageXDpi, int32_t& iImageYDpi);
+ void GetImageEditDpi(int32_t& iImageXDpi, int32_t& iImageYDpi);
+
+ RetainPtr<CFX_DIBitmap> GetImageImage();
+ RetainPtr<CFX_DIBitmap> GetImageEditImage();
+ void SetImageEdit(const WideString& wsContentType,
+ const WideString& wsHref,
+ const WideString& wsData);
+ void SetImageImage(const RetainPtr<CFX_DIBitmap>& newImage);
+ void SetImageEditImage(const RetainPtr<CFX_DIBitmap>& newImage);
+ void UpdateUIDisplay(CXFA_FFDocView* docView, CXFA_FFWidget* pExcept);
+
+ RetainPtr<CFGAS_GEFont> GetFDEFont(CXFA_FFDoc* doc);
+
+ // TODO(dsinclair): Remove post WidgetAcc merge.
+ CXFA_Node* GetNode() { return this; }
+
+ bool IsOpenAccess() const;
+ bool IsListBox();
+ bool IsAllowNeutral();
+ bool IsRadioButton();
+ bool IsChoiceListAllowTextEntry();
+ bool IsMultiLine();
+
+ XFA_AttributeEnum GetButtonHighlight();
+ bool HasButtonRollover() const;
+ bool HasButtonDown() const;
+
+ bool IsCheckButtonRound();
+ XFA_AttributeEnum GetCheckButtonMark();
+ float GetCheckButtonSize();
+
+ XFA_CHECKSTATE GetCheckState();
+ void SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify);
+
+ CXFA_Node* GetSelectedMember();
+ CXFA_Node* SetSelectedMember(const WideStringView& wsName, bool bNotify);
+ void SetSelectedMemberByValue(const WideStringView& wsValue,
+ bool bNotify,
+ bool bScriptModify,
+ bool bSyncData);
+
+ CXFA_Node* GetExclGroupFirstMember();
+ CXFA_Node* GetExclGroupNextMember(CXFA_Node* pNode);
+
+ int32_t CountChoiceListItems(bool bSaveValue);
+ Optional<WideString> GetChoiceListItem(int32_t nIndex, bool bSaveValue);
+ bool IsChoiceListMultiSelect();
+ bool IsChoiceListCommitOnSelect();
+ std::vector<WideString> GetChoiceListItems(bool bSaveValue);
+
+ int32_t CountSelectedItems();
+ int32_t GetSelectedItem(int32_t nIndex);
+ std::vector<int32_t> GetSelectedItems();
+ std::vector<WideString> GetSelectedItemsValue();
+ void SetSelectedItems(const std::vector<int32_t>& iSelArray,
+ bool bNotify,
+ bool bScriptModify,
+ bool bSyncData);
+ void InsertItem(const WideString& wsLabel,
+ const WideString& wsValue,
+ bool bNotify);
+ bool DeleteItem(int32_t nIndex, bool bNotify, bool bScriptModify);
+ void ClearAllSelections();
+
+ bool GetItemState(int32_t nIndex);
+ void SetItemState(int32_t nIndex,
+ bool bSelected,
+ bool bNotify,
+ bool bScriptModify,
+ bool bSyncData);
+
+ WideString GetItemValue(const WideStringView& wsLabel);
+
+ bool IsHorizontalScrollPolicyOff();
+ bool IsVerticalScrollPolicyOff();
+ Optional<int32_t> GetNumberOfCells();
+
+ bool SetValue(XFA_VALUEPICTURE eValueType, const WideString& wsValue);
+ WideString GetValue(XFA_VALUEPICTURE eValueType);
+
+ WideString GetPictureContent(XFA_VALUEPICTURE ePicture);
+ WideString GetNormalizeDataValue(const WideString& wsValue);
+ WideString GetFormatDataValue(const WideString& wsValue);
+ WideString NormalizeNumStr(const WideString& wsValue);
+
+ WideString GetPasswordChar();
+ std::pair<XFA_Element, int32_t> GetMaxChars();
+ int32_t GetFracDigits();
+ int32_t GetLeadDigits();
+
+ WideString NumericLimit(const WideString& wsValue,
+ int32_t iLead,
+ int32_t iTread) const;
+
protected:
CXFA_Node(CXFA_Document* pDoc,
XFA_PacketType ePacket,
@@ -363,6 +494,35 @@ class CXFA_Node : public CXFA_Object {
CXFA_Node* GetNextSameNameSiblingInternal(
const WideStringView& wsNodeName) const;
CXFA_Node* GetNextSameClassSiblingInternal(XFA_Element eType) const;
+ void CalcCaptionSize(CXFA_FFDoc* doc, CFX_SizeF& szCap);
+ bool CalculateFieldAutoSize(CXFA_FFDoc* doc, CFX_SizeF& size);
+ bool CalculateWidgetAutoSize(CFX_SizeF& size);
+ bool CalculateTextEditAutoSize(CXFA_FFDoc* doc, CFX_SizeF& size);
+ bool CalculateCheckButtonAutoSize(CXFA_FFDoc* doc, CFX_SizeF& size);
+ bool CalculatePushButtonAutoSize(CXFA_FFDoc* doc, CFX_SizeF& size);
+ CFX_SizeF CalculateImageSize(float img_width,
+ float img_height,
+ float dpi_x,
+ float dpi_y);
+ bool CalculateImageEditAutoSize(CXFA_FFDoc* doc, CFX_SizeF& size);
+ bool CalculateImageAutoSize(CXFA_FFDoc* doc, CFX_SizeF& size);
+ float CalculateWidgetAutoHeight(float fHeightCalc);
+ float CalculateWidgetAutoWidth(float fWidthCalc);
+ float GetWidthWithoutMargin(float fWidthCalc);
+ 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();
+ void StartTextLayout(CXFA_FFDoc* doc, float& fCalcWidth, float& fCalcHeight);
+
+ void InsertListTextItem(CXFA_Node* pItems,
+ const WideString& wsText,
+ int32_t nIndex);
+ WideString FormatNumStr(const WideString& wsValue, IFX_Locale* pLocale);
+ void GetItemLabel(const WideStringView& wsValue, WideString& wsLabel);
const PropertyData* const m_Properties;
const AttributeData* const m_Attributes;
@@ -383,7 +543,9 @@ class CXFA_Node : public CXFA_Object {
bool m_bIsNull = true;
bool m_bPreNull = true;
bool is_widget_ready_ = false;
- std::unique_ptr<CXFA_WidgetAcc> acc_;
+ std::unique_ptr<CXFA_WidgetLayoutData> m_pLayoutData;
+ // TODO(dsinclair): Remove post WidgetAcc merge.
+ CXFA_Node* m_pNode;
};
#endif // XFA_FXFA_PARSER_CXFA_NODE_H_