Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Side by Side Diff: xfa/fxfa/parser/cxfa_widgetdata.cpp

Issue 1889983002: Change string argument type to GetFormatDataValue. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/parser/cxfa_widgetdata.h ('k') | xfa/fxfa/parser/xfa_document_datamerger_imp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fxfa/parser/cxfa_widgetdata.h" 7 #include "xfa/fxfa/parser/cxfa_widgetdata.h"
8 8
9 #include "core/fxcrt/include/fx_ext.h" 9 #include "core/fxcrt/include/fx_ext.h"
10 #include "xfa/fxbarcode/include/BC_Library.h" 10 #include "xfa/fxbarcode/include/BC_Library.h"
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 break; 813 break;
814 } 814 }
815 } 815 }
816 SetSelectedItems(iSelArray, bNotify, bScriptModify, bSyncData); 816 SetSelectedItems(iSelArray, bNotify, bScriptModify, bSyncData);
817 } 817 }
818 } else { 818 } else {
819 if (bSelected) { 819 if (bSelected) {
820 if (iSel < 0) { 820 if (iSel < 0) {
821 CFX_WideString wsSaveText = wsSaveTextArray[nIndex]; 821 CFX_WideString wsSaveText = wsSaveTextArray[nIndex];
822 CFX_WideString wsFormatText(wsSaveText); 822 CFX_WideString wsFormatText(wsSaveText);
823 GetFormatDataValue(wsSaveText.AsStringC(), wsFormatText); 823 GetFormatDataValue(wsSaveText, wsFormatText);
824 m_pNode->SetContent(wsSaveText, wsFormatText, bNotify, bScriptModify, 824 m_pNode->SetContent(wsSaveText, wsFormatText, bNotify, bScriptModify,
825 bSyncData); 825 bSyncData);
826 } 826 }
827 } else if (iSel >= 0) { 827 } else if (iSel >= 0) {
828 m_pNode->SetContent(CFX_WideString(), CFX_WideString(), bNotify, 828 m_pNode->SetContent(CFX_WideString(), CFX_WideString(), bNotify,
829 bScriptModify, bSyncData); 829 bScriptModify, bSyncData);
830 } 830 }
831 } 831 }
832 } 832 }
833 833
834 void CXFA_WidgetData::SetSelectedItems(CFX_Int32Array& iSelArray, 834 void CXFA_WidgetData::SetSelectedItems(CFX_Int32Array& iSelArray,
835 FX_BOOL bNotify, 835 FX_BOOL bNotify,
836 FX_BOOL bScriptModify, 836 FX_BOOL bScriptModify,
837 FX_BOOL bSyncData) { 837 FX_BOOL bSyncData) {
838 CFX_WideString wsValue; 838 CFX_WideString wsValue;
839 int32_t iSize = iSelArray.GetSize(); 839 int32_t iSize = iSelArray.GetSize();
840 if (iSize >= 1) { 840 if (iSize >= 1) {
841 CFX_WideStringArray wsSaveTextArray; 841 CFX_WideStringArray wsSaveTextArray;
842 GetChoiceListItems(wsSaveTextArray, TRUE); 842 GetChoiceListItems(wsSaveTextArray, TRUE);
843 CFX_WideString wsItemValue; 843 CFX_WideString wsItemValue;
844 for (int32_t i = 0; i < iSize; i++) { 844 for (int32_t i = 0; i < iSize; i++) {
845 wsItemValue = (iSize == 1) 845 wsItemValue = (iSize == 1)
846 ? wsSaveTextArray[iSelArray[i]] 846 ? wsSaveTextArray[iSelArray[i]]
847 : wsSaveTextArray[iSelArray[i]] + FX_WSTRC(L"\n"); 847 : wsSaveTextArray[iSelArray[i]] + FX_WSTRC(L"\n");
848 wsValue += wsItemValue; 848 wsValue += wsItemValue;
849 } 849 }
850 } 850 }
851 CFX_WideString wsFormat(wsValue); 851 CFX_WideString wsFormat(wsValue);
852 if (GetChoiceListOpen() != XFA_ATTRIBUTEENUM_MultiSelect) 852 if (GetChoiceListOpen() != XFA_ATTRIBUTEENUM_MultiSelect)
853 GetFormatDataValue(wsValue.AsStringC(), wsFormat); 853 GetFormatDataValue(wsValue, wsFormat);
854 854
855 m_pNode->SetContent(wsValue, wsFormat, bNotify, bScriptModify, bSyncData); 855 m_pNode->SetContent(wsValue, wsFormat, bNotify, bScriptModify, bSyncData);
856 } 856 }
857 857
858 void CXFA_WidgetData::ClearAllSelections() { 858 void CXFA_WidgetData::ClearAllSelections() {
859 CXFA_Node* pBind = m_pNode->GetBindData(); 859 CXFA_Node* pBind = m_pNode->GetBindData();
860 if (pBind && GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { 860 if (pBind && GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) {
861 while (CXFA_Node* pChildNode = 861 while (CXFA_Node* pChildNode =
862 pBind->GetNodeItem(XFA_NODEITEM_FirstChild)) { 862 pBind->GetNodeItem(XFA_NODEITEM_FirstChild)) {
863 pBind->RemoveChild(pChildNode); 863 pBind->RemoveChild(pChildNode);
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
1552 } 1552 }
1553 default: 1553 default:
1554 break; 1554 break;
1555 } 1555 }
1556 widgetValue.FormatPatterns(wsValue, wsPicture, pLocale, eValueType); 1556 widgetValue.FormatPatterns(wsValue, wsPicture, pLocale, eValueType);
1557 } 1557 }
1558 return TRUE; 1558 return TRUE;
1559 } 1559 }
1560 1560
1561 FX_BOOL CXFA_WidgetData::GetNormalizeDataValue( 1561 FX_BOOL CXFA_WidgetData::GetNormalizeDataValue(
1562 const CFX_WideStringC& wsValue, 1562 const CFX_WideString& wsValue,
1563 CFX_WideString& wsNormalizeValue) { 1563 CFX_WideString& wsNormalizeValue) {
1564 wsNormalizeValue = wsValue; 1564 wsNormalizeValue = wsValue;
1565 if (wsValue.IsEmpty()) 1565 if (wsValue.IsEmpty())
1566 return TRUE; 1566 return TRUE;
1567 1567
1568 CFX_WideString wsPicture; 1568 CFX_WideString wsPicture;
1569 GetPictureContent(wsPicture, XFA_VALUEPICTURE_DataBind); 1569 GetPictureContent(wsPicture, XFA_VALUEPICTURE_DataBind);
1570 if (wsPicture.IsEmpty()) 1570 if (wsPicture.IsEmpty())
1571 return TRUE; 1571 return TRUE;
1572 1572
1573 FXSYS_assert(GetNode()); 1573 FXSYS_assert(GetNode());
1574 CXFA_LocaleMgr* pLocalMgr = GetNode()->GetDocument()->GetLocalMgr(); 1574 CXFA_LocaleMgr* pLocalMgr = GetNode()->GetDocument()->GetLocalMgr();
1575 IFX_Locale* pLocale = GetLocal(); 1575 IFX_Locale* pLocale = GetLocal();
1576 CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(this); 1576 CXFA_LocaleValue widgetValue = XFA_GetLocaleValue(this);
1577 if (widgetValue.ValidateValue(wsValue, wsPicture, pLocale, &wsPicture)) { 1577 if (widgetValue.ValidateValue(wsValue, wsPicture, pLocale, &wsPicture)) {
1578 widgetValue = CXFA_LocaleValue(widgetValue.GetType(), wsNormalizeValue, 1578 widgetValue = CXFA_LocaleValue(widgetValue.GetType(), wsNormalizeValue,
1579 wsPicture, pLocale, pLocalMgr); 1579 wsPicture, pLocale, pLocalMgr);
1580 wsNormalizeValue = widgetValue.GetValue(); 1580 wsNormalizeValue = widgetValue.GetValue();
1581 return TRUE; 1581 return TRUE;
1582 } 1582 }
1583 return FALSE; 1583 return FALSE;
1584 } 1584 }
1585 1585
1586 FX_BOOL CXFA_WidgetData::GetFormatDataValue(const CFX_WideStringC& wsValue, 1586 FX_BOOL CXFA_WidgetData::GetFormatDataValue(const CFX_WideString& wsValue,
1587 CFX_WideString& wsFormatedValue) { 1587 CFX_WideString& wsFormatedValue) {
1588 wsFormatedValue = wsValue; 1588 wsFormatedValue = wsValue;
1589 if (wsValue.IsEmpty()) 1589 if (wsValue.IsEmpty())
1590 return TRUE; 1590 return TRUE;
1591 1591
1592 CFX_WideString wsPicture; 1592 CFX_WideString wsPicture;
1593 GetPictureContent(wsPicture, XFA_VALUEPICTURE_DataBind); 1593 GetPictureContent(wsPicture, XFA_VALUEPICTURE_DataBind);
1594 if (wsPicture.IsEmpty()) 1594 if (wsPicture.IsEmpty())
1595 return TRUE; 1595 return TRUE;
1596 1596
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1731 } 1731 }
1732 1732
1733 void CXFA_WidgetData::SyncValue(const CFX_WideString& wsValue, 1733 void CXFA_WidgetData::SyncValue(const CFX_WideString& wsValue,
1734 FX_BOOL bNotify) { 1734 FX_BOOL bNotify) {
1735 if (!m_pNode) 1735 if (!m_pNode)
1736 return; 1736 return;
1737 1737
1738 CFX_WideString wsFormatValue(wsValue); 1738 CFX_WideString wsFormatValue(wsValue);
1739 CXFA_WidgetData* pContainerWidgetData = m_pNode->GetContainerWidgetData(); 1739 CXFA_WidgetData* pContainerWidgetData = m_pNode->GetContainerWidgetData();
1740 if (pContainerWidgetData) 1740 if (pContainerWidgetData)
1741 pContainerWidgetData->GetFormatDataValue(wsValue.AsStringC(), 1741 pContainerWidgetData->GetFormatDataValue(wsValue, wsFormatValue);
1742 wsFormatValue);
1743 1742
1744 m_pNode->SetContent(wsValue, wsFormatValue, bNotify); 1743 m_pNode->SetContent(wsValue, wsFormatValue, bNotify);
1745 } 1744 }
1746 1745
1747 void CXFA_WidgetData::InsertListTextItem(CXFA_Node* pItems, 1746 void CXFA_WidgetData::InsertListTextItem(CXFA_Node* pItems,
1748 const CFX_WideStringC& wsText, 1747 const CFX_WideStringC& wsText,
1749 int32_t nIndex) { 1748 int32_t nIndex) {
1750 CXFA_Node* pText = pItems->CreateSamePacketNode(XFA_ELEMENT_Text); 1749 CXFA_Node* pText = pItems->CreateSamePacketNode(XFA_ELEMENT_Text);
1751 pItems->InsertChild(nIndex, pText); 1750 pItems->InsertChild(nIndex, pText);
1752 pText->SetContent(wsText, wsText, FALSE, FALSE, FALSE); 1751 pText->SetContent(wsText, wsText, FALSE, FALSE, FALSE);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1788 } 1787 }
1789 } 1788 }
1790 } else if (wc == L'.') { 1789 } else if (wc == L'.') {
1791 iTread_ = 0; 1790 iTread_ = 0;
1792 iLead = -1; 1791 iLead = -1;
1793 } 1792 }
1794 wsRet += wc; 1793 wsRet += wc;
1795 } 1794 }
1796 return wsRet; 1795 return wsRet;
1797 } 1796 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/cxfa_widgetdata.h ('k') | xfa/fxfa/parser/xfa_document_datamerger_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698