diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-05-23 10:21:54 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-05-23 15:38:39 +0000 |
commit | c4ecd7b2e10e37a3b29eb380472fbee4936522ac (patch) | |
tree | 2823d3558eeae73e91731fd6e9f3d7b346a33393 /xfa/fxfa/parser | |
parent | 1b02d01804039a9f0584c081294ceb07e52b9bdc (diff) | |
download | pdfium-c4ecd7b2e10e37a3b29eb380472fbee4936522ac.tar.xz |
Cleanup default values and methods in CXFA_Widgetdata
Change-Id: Ie591de17aba54d6d0f96b1133be7d899bab577cf
Reviewed-on: https://pdfium-review.googlesource.com/5660
Reviewed-by: Nicolás Peña <npm@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r-- | xfa/fxfa/parser/cxfa_node.cpp | 8 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_widgetdata.cpp | 49 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_widgetdata.h | 43 |
3 files changed, 46 insertions, 54 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp index 3c254ef6fc..e7ec4cf890 100644 --- a/xfa/fxfa/parser/cxfa_node.cpp +++ b/xfa/fxfa/parser/cxfa_node.cpp @@ -1867,7 +1867,7 @@ void CXFA_Node::Script_Som_Message(CFXJSE_Value* pValue, return; } bool bNew = false; - CXFA_Validate validate = pWidgetData->GetValidate(); + CXFA_Validate validate = pWidgetData->GetValidate(false); if (!validate) { validate = pWidgetData->GetValidate(true); bNew = true; @@ -2349,7 +2349,7 @@ void CXFA_Node::Script_Field_SelectedIndex(CFXJSE_Value* pValue, } pWidgetData->SetItemState(iIndex, true, true, true, true); } else { - pValue->SetInteger(pWidgetData->GetSelectedItem()); + pValue->SetInteger(pWidgetData->GetSelectedItem(0)); } } @@ -2358,7 +2358,7 @@ void CXFA_Node::Script_Field_ClearItems(CFXJSE_Arguments* pArguments) { if (!pWidgetData) { return; } - pWidgetData->DeleteItem(-1, true); + pWidgetData->DeleteItem(-1, true, false); } void CXFA_Node::Script_Field_ExecEvent(CFXJSE_Arguments* pArguments) { @@ -2546,7 +2546,7 @@ void CXFA_Node::Script_Field_AddItem(CFXJSE_Arguments* pArguments) { CFX_ByteString bsValue = pArguments->GetUTF8String(1); wsValue = CFX_WideString::FromUTF8(bsValue.AsStringC()); } - pWidgetData->InsertItem(wsLabel, wsValue, -1, true); + pWidgetData->InsertItem(wsLabel, wsValue, true); } void CXFA_Node::Script_Field_ExecValidate(CFXJSE_Arguments* pArguments) { diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp index f11a668276..bf9afc062f 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.cpp +++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp @@ -256,13 +256,7 @@ CFX_WideString CXFA_WidgetData::GetRawValue() { return m_pNode->GetContent(); } -int32_t CXFA_WidgetData::GetAccess(bool bTemplate) { - if (bTemplate) { - CXFA_Node* pNode = m_pNode->GetTemplateNode(); - if (pNode) - return pNode->GetEnum(XFA_ATTRIBUTE_Access); - return XFA_ATTRIBUTEENUM_Open; - } +int32_t CXFA_WidgetData::GetAccess() { CXFA_Node* pNode = m_pNode; while (pNode) { int32_t iAcc = pNode->GetEnum(XFA_ATTRIBUTE_Access); @@ -289,20 +283,20 @@ CXFA_Border CXFA_WidgetData::GetBorder(bool bModified) { return CXFA_Border(m_pNode->GetProperty(0, XFA_Element::Border, bModified)); } -CXFA_Caption CXFA_WidgetData::GetCaption(bool bModified) { - return CXFA_Caption(m_pNode->GetProperty(0, XFA_Element::Caption, bModified)); +CXFA_Caption CXFA_WidgetData::GetCaption() { + return CXFA_Caption(m_pNode->GetProperty(0, XFA_Element::Caption, false)); } CXFA_Font CXFA_WidgetData::GetFont(bool bModified) { return CXFA_Font(m_pNode->GetProperty(0, XFA_Element::Font, bModified)); } -CXFA_Margin CXFA_WidgetData::GetMargin(bool bModified) { - return CXFA_Margin(m_pNode->GetProperty(0, XFA_Element::Margin, bModified)); +CXFA_Margin CXFA_WidgetData::GetMargin() { + return CXFA_Margin(m_pNode->GetProperty(0, XFA_Element::Margin, false)); } -CXFA_Para CXFA_WidgetData::GetPara(bool bModified) { - return CXFA_Para(m_pNode->GetProperty(0, XFA_Element::Para, bModified)); +CXFA_Para CXFA_WidgetData::GetPara() { + return CXFA_Para(m_pNode->GetProperty(0, XFA_Element::Para, false)); } std::vector<CXFA_Node*> CXFA_WidgetData::GetEventList() { @@ -333,20 +327,18 @@ std::vector<CXFA_Node*> CXFA_WidgetData::GetEventByActivity(int32_t iActivity, return events; } -CXFA_Value CXFA_WidgetData::GetDefaultValue(bool bModified) { +CXFA_Value CXFA_WidgetData::GetDefaultValue() { CXFA_Node* pTemNode = m_pNode->GetTemplateNode(); return CXFA_Value( - pTemNode ? pTemNode->GetProperty(0, XFA_Element::Value, bModified) - : nullptr); + pTemNode ? pTemNode->GetProperty(0, XFA_Element::Value, false) : nullptr); } -CXFA_Value CXFA_WidgetData::GetFormValue(bool bModified) { - return CXFA_Value(m_pNode->GetProperty(0, XFA_Element::Value, bModified)); +CXFA_Value CXFA_WidgetData::GetFormValue() { + return CXFA_Value(m_pNode->GetProperty(0, XFA_Element::Value, false)); } -CXFA_Calculate CXFA_WidgetData::GetCalculate(bool bModified) { - return CXFA_Calculate( - m_pNode->GetProperty(0, XFA_Element::Calculate, bModified)); +CXFA_Calculate CXFA_WidgetData::GetCalculate() { + return CXFA_Calculate(m_pNode->GetProperty(0, XFA_Element::Calculate, false)); } CXFA_Validate CXFA_WidgetData::GetValidate(bool bModified) { @@ -354,12 +346,12 @@ CXFA_Validate CXFA_WidgetData::GetValidate(bool bModified) { m_pNode->GetProperty(0, XFA_Element::Validate, bModified)); } -CXFA_Bind CXFA_WidgetData::GetBind(bool bModified) { - return CXFA_Bind(m_pNode->GetProperty(0, XFA_Element::Bind, bModified)); +CXFA_Bind CXFA_WidgetData::GetBind() { + return CXFA_Bind(m_pNode->GetProperty(0, XFA_Element::Bind, false)); } -CXFA_Assist CXFA_WidgetData::GetAssist(bool bModified) { - return CXFA_Assist(m_pNode->GetProperty(0, XFA_Element::Assist, bModified)); +CXFA_Assist CXFA_WidgetData::GetAssist() { + return CXFA_Assist(m_pNode->GetProperty(0, XFA_Element::Assist, false)); } bool CXFA_WidgetData::GetWidth(float& fWidth) { @@ -968,8 +960,8 @@ void CXFA_WidgetData::ClearAllSelections() { void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel, const CFX_WideString& wsValue, - int32_t nIndex, bool bNotify) { + int32_t nIndex = -1; CFX_WideString wsNewValue(wsValue); if (wsNewValue.IsEmpty()) wsNewValue = wsLabel; @@ -1114,8 +1106,7 @@ void CXFA_WidgetData::GetItemValue(const CFX_WideStringC& wsLabel, bool CXFA_WidgetData::DeleteItem(int32_t nIndex, bool bNotify, - bool bScriptModify, - bool bSyncData) { + bool bScriptModify) { bool bSetValue = false; CXFA_Node* pItems = m_pNode->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pItems; pItems = pItems->GetNodeItem(XFA_NODEITEM_NextSibling)) { @@ -1128,7 +1119,7 @@ bool CXFA_WidgetData::DeleteItem(int32_t nIndex, } } else { if (!bSetValue && pItems->GetBoolean(XFA_ATTRIBUTE_Save)) { - SetItemState(nIndex, false, true, bScriptModify, bSyncData); + SetItemState(nIndex, false, true, bScriptModify, true); bSetValue = true; } int32_t i = 0; diff --git a/xfa/fxfa/parser/cxfa_widgetdata.h b/xfa/fxfa/parser/cxfa_widgetdata.h index c38ea3502a..f53d926655 100644 --- a/xfa/fxfa/parser/cxfa_widgetdata.h +++ b/xfa/fxfa/parser/cxfa_widgetdata.h @@ -46,28 +46,30 @@ class CXFA_WidgetData : public CXFA_Data { CXFA_Node* GetUIChild(); XFA_Element GetUIType(); CFX_WideString GetRawValue(); - int32_t GetAccess(bool bTemplate = false); + int32_t GetAccess(); int32_t GetRotate(); - CXFA_Border GetBorder(bool bModified = false); - CXFA_Caption GetCaption(bool bModified = false); - CXFA_Font GetFont(bool bModified = false); - CXFA_Margin GetMargin(bool bModified = false); - CXFA_Para GetPara(bool bModified = false); + + CXFA_Assist GetAssist(); + CXFA_Border GetBorder(bool bModified); + CXFA_Caption GetCaption(); + CXFA_Font GetFont(bool bModified); + CXFA_Margin GetMargin(); + CXFA_Para GetPara(); std::vector<CXFA_Node*> GetEventList(); std::vector<CXFA_Node*> GetEventByActivity(int32_t iActivity, - bool bIsFormReady = false); - CXFA_Value GetDefaultValue(bool bModified = false); - CXFA_Value GetFormValue(bool bModified = false); - CXFA_Calculate GetCalculate(bool bModified = false); - CXFA_Validate GetValidate(bool bModified = false); - CXFA_Bind GetBind(bool bModified = false); - CXFA_Assist GetAssist(bool bModified = false); + bool bIsFormReady); + CXFA_Value GetDefaultValue(); + CXFA_Value GetFormValue(); + CXFA_Calculate GetCalculate(); + CXFA_Validate GetValidate(bool bModified); + bool GetWidth(float& fWidth); bool GetHeight(float& fHeight); bool GetMinWidth(float& fMinWidth); bool GetMinHeight(float& fMinHeight); bool GetMaxWidth(float& fMaxWidth); bool GetMaxHeight(float& fMaxHeight); + CXFA_Border GetUIBorder(); CFX_RectF GetUIMargin(); int32_t GetButtonHighlight(); @@ -99,7 +101,7 @@ class CXFA_WidgetData : public CXFA_Data { bool bSaveValue); std::vector<CFX_WideString> GetChoiceListItems(bool bSaveValue); int32_t CountSelectedItems(); - int32_t GetSelectedItem(int32_t nIndex = 0); + int32_t GetSelectedItem(int32_t nIndex); std::vector<int32_t> GetSelectedItems(); std::vector<CFX_WideString> GetSelectedItemsValue(); bool GetItemState(int32_t nIndex); @@ -115,14 +117,10 @@ class CXFA_WidgetData : public CXFA_Data { void ClearAllSelections(); void InsertItem(const CFX_WideString& wsLabel, const CFX_WideString& wsValue, - int32_t nIndex = -1, - bool bNotify = false); + bool bNotify); void GetItemLabel(const CFX_WideStringC& wsValue, CFX_WideString& wsLabel); void GetItemValue(const CFX_WideStringC& wsLabel, CFX_WideString& wsValue); - bool DeleteItem(int32_t nIndex, - bool bNotify = false, - bool bScriptModify = false, - bool bSyncData = true); + bool DeleteItem(int32_t nIndex, bool bNotify, bool bScriptModify); int32_t GetHorizontalScrollPolicy(); int32_t GetNumberOfCells(); bool SetValue(const CFX_WideString& wsValue, XFA_VALUEPICTURE eValueType); @@ -134,6 +132,7 @@ class CXFA_WidgetData : public CXFA_Data { bool GetFormatDataValue(const CFX_WideString& wsValue, CFX_WideString& wsFormattedValue); void NormalizeNumStr(const CFX_WideString& wsValue, CFX_WideString& wsOutput); + CFX_WideString GetBarcodeType(); bool GetBarcodeAttribute_CharEncoding(int32_t* val); bool GetBarcodeAttribute_Checksum(bool* val); @@ -148,6 +147,7 @@ class CXFA_WidgetData : public CXFA_Data { bool GetBarcodeAttribute_Truncate(bool* val); bool GetBarcodeAttribute_WideNarrowRatio(float* val); void GetPasswordChar(CFX_WideString& wsPassWord); + bool IsMultiLine(); int32_t GetVerticalScrollPolicy(); int32_t GetMaxChars(XFA_Element& eType); @@ -162,10 +162,11 @@ class CXFA_WidgetData : public CXFA_Data { bool m_bPreNull; private: + CXFA_Bind GetBind(); void SyncValue(const CFX_WideString& wsValue, bool bNotify); void InsertListTextItem(CXFA_Node* pItems, const CFX_WideString& wsText, - int32_t nIndex = -1); + int32_t nIndex); void FormatNumStr(const CFX_WideString& wsValue, IFX_Locale* pLocale, CFX_WideString& wsOutput); |