From d49254bc9323883deba14d27026ec2bb9af096fa Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 22 Nov 2017 22:11:12 +0000 Subject: Rename CXFA_WidgetData::GetAccess to ::IsOpenAccess We never use ::GetAccess to get the value in general, just to see if it's set to Open or not. This CL makes the usage clearer. Change-Id: I0e978a8b8e642c7441ab2ceb8062f672ceea7d55 Reviewed-on: https://pdfium-review.googlesource.com/19210 Commit-Queue: dsinclair Reviewed-by: Henrique Nakashima --- xfa/fxfa/parser/cxfa_widgetdata.cpp | 18 +++++----- xfa/fxfa/parser/cxfa_widgetdata.h | 67 +++++++++++++++++++++++-------------- 2 files changed, 49 insertions(+), 36 deletions(-) (limited to 'xfa/fxfa/parser') diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index 13b1c7a3ae..9b0bbccde8 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -219,21 +219,19 @@ XFA_Element CXFA_WidgetData::GetUIType() { return m_eUIType; } -WideString CXFA_WidgetData::GetRawValue() { +WideString CXFA_WidgetData::GetRawValue() const { return m_pNode->JSNode()->GetContent(false); } -int32_t CXFA_WidgetData::GetAccess() { - CXFA_Node* pNode = m_pNode; - while (pNode) { - int32_t iAcc = pNode->JSNode()->GetEnum(XFA_Attribute::Access); +bool CXFA_WidgetData::IsOpenAccess() const { + for (CXFA_Node* pNode = m_pNode; pNode; + pNode = pNode->GetNodeItem(XFA_NODEITEM_Parent, + XFA_ObjectType::ContainerNode)) { + XFA_ATTRIBUTEENUM iAcc = pNode->JSNode()->GetEnum(XFA_Attribute::Access); if (iAcc != XFA_ATTRIBUTEENUM_Open) - return iAcc; - - pNode = - pNode->GetNodeItem(XFA_NODEITEM_Parent, XFA_ObjectType::ContainerNode); + return false; } - return XFA_ATTRIBUTEENUM_Open; + return true; } int32_t CXFA_WidgetData::GetRotate() { diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h index 309f00fe12..c6f07e2f2a 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.h +++ b/xfa/fxfa/parser/cxfa_widgetdata.h @@ -44,22 +44,31 @@ class CXFA_WidgetData : public CXFA_DataData { CXFA_Node* GetUIChild(); XFA_Element GetUIType(); - WideString GetRawValue(); - int32_t GetAccess(); + CFX_RectF GetUIMargin(); + + WideString GetRawValue() const; int32_t GetRotate(); + bool IsOpenAccess() const; + bool IsListBox(); + bool IsAllowNeutral(); + bool IsRadioButton(); + bool IsChoiceListAllowTextEntry(); + bool IsMultiLine(); + CXFA_BorderData GetBorderData(bool bModified); CXFA_CaptionData GetCaptionData(); CXFA_FontData GetFontData(bool bModified); CXFA_MarginData GetMarginData(); CXFA_ParaData GetParaData(); - std::vector GetEventList(); - std::vector GetEventByActivity(int32_t iActivity, - bool bIsFormReady); CXFA_ValueData GetDefaultValueData(); CXFA_ValueData GetFormValueData(); CXFA_CalculateData GetCalculateData(); CXFA_ValidateData GetValidateData(bool bModified); + CXFA_BorderData GetUIBorderData(); + + std::vector GetEventByActivity(int32_t iActivity, + bool bIsFormReady); pdfium::Optional TryWidth(); pdfium::Optional TryHeight(); @@ -68,61 +77,66 @@ class CXFA_WidgetData : public CXFA_DataData { pdfium::Optional TryMaxWidth(); pdfium::Optional TryMaxHeight(); - CXFA_BorderData GetUIBorderData(); - CFX_RectF GetUIMargin(); XFA_ATTRIBUTEENUM GetButtonHighlight(); bool GetButtonRollover(WideString& wsRollover, bool& bRichText); bool GetButtonDown(WideString& wsDown, bool& bRichText); + XFA_ATTRIBUTEENUM GetCheckButtonShape(); XFA_ATTRIBUTEENUM GetCheckButtonMark(); float GetCheckButtonSize(); - bool IsAllowNeutral(); - bool IsRadioButton(); + XFA_CHECKSTATE GetCheckState(); void SetCheckState(XFA_CHECKSTATE eCheckState, bool bNotify); - CXFA_Node* GetExclGroupNode(); + 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); - XFA_ATTRIBUTEENUM GetChoiceListCommitOn(); - bool IsChoiceListAllowTextEntry(); - XFA_ATTRIBUTEENUM GetChoiceListOpen(); - bool IsListBox(); + int32_t CountChoiceListItems(bool bSaveValue); bool GetChoiceListItem(WideString& wsText, int32_t nIndex, bool bSaveValue); + XFA_ATTRIBUTEENUM GetChoiceListOpen(); + XFA_ATTRIBUTEENUM GetChoiceListCommitOn(); std::vector GetChoiceListItems(bool bSaveValue); + int32_t CountSelectedItems(); int32_t GetSelectedItem(int32_t nIndex); std::vector GetSelectedItems(); std::vector GetSelectedItemsValue(); - bool GetItemState(int32_t nIndex); - void SetItemState(int32_t nIndex, - bool bSelected, - bool bNotify, - bool bScriptModify, - bool bSyncData); void SetSelectedItems(const std::vector& iSelArray, bool bNotify, bool bScriptModify, bool bSyncData); - void ClearAllSelections(); void InsertItem(const WideString& wsLabel, const WideString& wsValue, bool bNotify); - void GetItemLabel(const WideStringView& wsValue, WideString& wsLabel); - void GetItemValue(const WideStringView& wsLabel, WideString& wsValue); 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); + + void GetItemValue(const WideStringView& wsLabel, WideString& wsValue); + int32_t GetHorizontalScrollPolicy(); + XFA_ATTRIBUTEENUM GetVerticalScrollPolicy(); int32_t GetNumberOfCells(); + bool SetValue(const WideString& wsValue, XFA_VALUEPICTURE eValueType); + bool GetValue(WideString& wsValue, XFA_VALUEPICTURE eValueType); + WideString GetPictureContent(XFA_VALUEPICTURE ePicture); IFX_Locale* GetLocal(); - bool GetValue(WideString& wsValue, XFA_VALUEPICTURE eValueType); + bool GetNormalizeDataValue(const WideString& wsValue, WideString& wsNormalizeValue); bool GetFormatDataValue(const WideString& wsValue, @@ -144,8 +158,6 @@ class CXFA_WidgetData : public CXFA_DataData { bool GetBarcodeAttribute_WideNarrowRatio(float* val); void GetPasswordChar(WideString& wsPassWord); - bool IsMultiLine(); - XFA_ATTRIBUTEENUM GetVerticalScrollPolicy(); int32_t GetMaxChars(XFA_Element& eType); bool GetFracDigits(int32_t& iFracDigits); bool GetLeadDigits(int32_t& iLeadDigits); @@ -166,6 +178,9 @@ class CXFA_WidgetData : public CXFA_DataData { void FormatNumStr(const WideString& wsValue, IFX_Locale* pLocale, WideString& wsOutput); + CXFA_Node* GetExclGroupNode(); + void GetItemLabel(const WideStringView& wsValue, WideString& wsLabel); + std::vector GetEventList(); CXFA_Node* m_pUiChildNode; XFA_Element m_eUIType; -- cgit v1.2.3