From 6aec70bc09cb65b169fe6ca1af65e8929aeea43a Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 23 Nov 2017 17:02:23 +0000 Subject: Cleanup CXFA_WidgetData This CL cleans up return values, out-params and changes simple methods to boolean checks where possible in CXFA_WidgetData. Change-Id: I29daa67993730f3e9d61cb6fdf918a886cc9120e Reviewed-on: https://pdfium-review.googlesource.com/19230 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- xfa/fxfa/parser/cxfa_widgetdata.h | 87 ++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 42 deletions(-) (limited to 'xfa/fxfa/parser/cxfa_widgetdata.h') diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h index c6f07e2f2a..7e17323ec8 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.h +++ b/xfa/fxfa/parser/cxfa_widgetdata.h @@ -7,11 +7,13 @@ #ifndef XFA_FXFA_PARSER_CXFA_WIDGETDATA_H_ #define XFA_FXFA_PARSER_CXFA_WIDGETDATA_H_ +#include #include #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" +#include "fxbarcode/BC_Library.h" #include "xfa/fxfa/parser/cxfa_binddata.h" #include "xfa/fxfa/parser/cxfa_borderdata.h" #include "xfa/fxfa/parser/cxfa_calculatedata.h" @@ -47,7 +49,7 @@ class CXFA_WidgetData : public CXFA_DataData { CFX_RectF GetUIMargin(); WideString GetRawValue() const; - int32_t GetRotate(); + int32_t GetRotate() const; bool IsOpenAccess() const; bool IsListBox(); @@ -67,7 +69,7 @@ class CXFA_WidgetData : public CXFA_DataData { CXFA_ValidateData GetValidateData(bool bModified); CXFA_BorderData GetUIBorderData(); - std::vector GetEventByActivity(int32_t iActivity, + std::vector GetEventByActivity(XFA_ATTRIBUTEENUM iActivity, bool bIsFormReady); pdfium::Optional TryWidth(); @@ -78,10 +80,10 @@ class CXFA_WidgetData : public CXFA_DataData { pdfium::Optional TryMaxHeight(); XFA_ATTRIBUTEENUM GetButtonHighlight(); - bool GetButtonRollover(WideString& wsRollover, bool& bRichText); - bool GetButtonDown(WideString& wsDown, bool& bRichText); + bool HasButtonRollover() const; + bool HasButtonDown() const; - XFA_ATTRIBUTEENUM GetCheckButtonShape(); + bool IsCheckButtonRound(); XFA_ATTRIBUTEENUM GetCheckButtonMark(); float GetCheckButtonSize(); @@ -99,9 +101,10 @@ class CXFA_WidgetData : public CXFA_DataData { CXFA_Node* GetExclGroupNextMember(CXFA_Node* pNode); int32_t CountChoiceListItems(bool bSaveValue); - bool GetChoiceListItem(WideString& wsText, int32_t nIndex, bool bSaveValue); - XFA_ATTRIBUTEENUM GetChoiceListOpen(); - XFA_ATTRIBUTEENUM GetChoiceListCommitOn(); + pdfium::Optional GetChoiceListItem(int32_t nIndex, + bool bSaveValue); + bool IsChoiceListMultiSelect(); + bool IsChoiceListCommitOnSelect(); std::vector GetChoiceListItems(bool bSaveValue); int32_t CountSelectedItems(); @@ -125,49 +128,49 @@ class CXFA_WidgetData : public CXFA_DataData { bool bScriptModify, bool bSyncData); - void GetItemValue(const WideStringView& wsLabel, WideString& wsValue); + WideString GetItemValue(const WideStringView& wsLabel); - int32_t GetHorizontalScrollPolicy(); - XFA_ATTRIBUTEENUM GetVerticalScrollPolicy(); - int32_t GetNumberOfCells(); + bool IsHorizontalScrollPolicyOff(); + bool IsVerticalScrollPolicyOff(); + pdfium::Optional GetNumberOfCells(); - bool SetValue(const WideString& wsValue, XFA_VALUEPICTURE eValueType); - bool GetValue(WideString& wsValue, XFA_VALUEPICTURE eValueType); + bool SetValue(XFA_VALUEPICTURE eValueType, const WideString& wsValue); + WideString GetValue(XFA_VALUEPICTURE eValueType); WideString GetPictureContent(XFA_VALUEPICTURE ePicture); - IFX_Locale* GetLocal(); + IFX_Locale* GetLocale(); - bool GetNormalizeDataValue(const WideString& wsValue, - WideString& wsNormalizeValue); - bool GetFormatDataValue(const WideString& wsValue, - WideString& wsFormattedValue); - void NormalizeNumStr(const WideString& wsValue, WideString& wsOutput); + WideString GetNormalizeDataValue(const WideString& wsValue); + WideString GetFormatDataValue(const WideString& wsValue); + WideString NormalizeNumStr(const WideString& wsValue); WideString GetBarcodeType(); - bool GetBarcodeAttribute_CharEncoding(int32_t* val); - bool GetBarcodeAttribute_Checksum(bool* val); - bool GetBarcodeAttribute_DataLength(int32_t* val); - bool GetBarcodeAttribute_StartChar(char* val); - bool GetBarcodeAttribute_EndChar(char* val); - bool GetBarcodeAttribute_ECLevel(int32_t* val); - bool GetBarcodeAttribute_ModuleWidth(int32_t* val); - bool GetBarcodeAttribute_ModuleHeight(int32_t* val); - bool GetBarcodeAttribute_PrintChecksum(bool* val); - bool GetBarcodeAttribute_TextLocation(int32_t* val); - bool GetBarcodeAttribute_Truncate(bool* val); - bool GetBarcodeAttribute_WideNarrowRatio(float* val); - void GetPasswordChar(WideString& wsPassWord); - - int32_t GetMaxChars(XFA_Element& eType); - bool GetFracDigits(int32_t& iFracDigits); - bool GetLeadDigits(int32_t& iLeadDigits); + pdfium::Optional GetBarcodeAttribute_CharEncoding(); + pdfium::Optional GetBarcodeAttribute_Checksum(); + pdfium::Optional GetBarcodeAttribute_DataLength(); + pdfium::Optional GetBarcodeAttribute_StartChar(); + pdfium::Optional GetBarcodeAttribute_EndChar(); + pdfium::Optional GetBarcodeAttribute_ECLevel(); + pdfium::Optional GetBarcodeAttribute_ModuleWidth(); + pdfium::Optional GetBarcodeAttribute_ModuleHeight(); + pdfium::Optional GetBarcodeAttribute_PrintChecksum(); + pdfium::Optional GetBarcodeAttribute_TextLocation(); + pdfium::Optional GetBarcodeAttribute_Truncate(); + pdfium::Optional GetBarcodeAttribute_WideNarrowRatio(); + + WideString GetPasswordChar(); + std::pair GetMaxChars(); + int32_t GetFracDigits(); + int32_t GetLeadDigits(); WideString NumericLimit(const WideString& wsValue, int32_t iLead, int32_t iTread) const; - bool m_bIsNull; - bool m_bPreNull; + bool IsPreNull() const { return m_bPreNull; } + void SetPreNull(bool val) { m_bPreNull = val; } + bool IsNull() const { return m_bIsNull; } + void SetIsNull(bool val) { m_bIsNull = val; } private: CXFA_BindData GetBindData(); @@ -175,13 +178,13 @@ class CXFA_WidgetData : public CXFA_DataData { void InsertListTextItem(CXFA_Node* pItems, const WideString& wsText, int32_t nIndex); - void FormatNumStr(const WideString& wsValue, - IFX_Locale* pLocale, - WideString& wsOutput); + WideString FormatNumStr(const WideString& wsValue, IFX_Locale* pLocale); CXFA_Node* GetExclGroupNode(); void GetItemLabel(const WideStringView& wsValue, WideString& wsLabel); std::vector GetEventList(); + bool m_bIsNull; + bool m_bPreNull; CXFA_Node* m_pUiChildNode; XFA_Element m_eUIType; }; -- cgit v1.2.3