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

Unified Diff: fpdfsdk/cpdfsdk_widget.cpp

Issue 2323493002: Pass CFX_WideString further down widget callers (Closed)
Patch Set: Fix comments Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/cpdfsdk_interform.cpp ('k') | fpdfsdk/cpdfsdk_widgethandler.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/cpdfsdk_widget.cpp
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index d518a561097d5bcd682aaed52167608ad6d4d036..a8ebef6e995115efbb0791999d168ee91102a227 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -739,7 +739,7 @@ void CPDFSDK_Widget::ResetAppearance(FX_BOOL bValueChanged) {
case FIELDTYPE_COMBOBOX: {
FX_BOOL bFormatted = FALSE;
CFX_WideString sValue = OnFormat(bFormatted);
- ResetAppearance(bFormatted ? sValue.c_str() : nullptr, TRUE);
+ ResetAppearance(bFormatted ? &sValue : nullptr, TRUE);
break;
}
default:
@@ -749,7 +749,7 @@ void CPDFSDK_Widget::ResetAppearance(FX_BOOL bValueChanged) {
}
#endif // PDF_ENABLE_XFA
-void CPDFSDK_Widget::ResetAppearance(const FX_WCHAR* sValue,
+void CPDFSDK_Widget::ResetAppearance(const CFX_WideString* sValue,
FX_BOOL bValueChanged) {
SetAppModified();
@@ -1353,7 +1353,7 @@ void CPDFSDK_Widget::ResetAppearance_RadioButton() {
SetAppState("Off");
}
-void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) {
+void CPDFSDK_Widget::ResetAppearance_ComboBox(const CFX_WideString* sValue) {
CPDF_FormControl* pControl = GetFormControl();
CPDF_FormField* pField = pControl->GetField();
CFX_ByteTextBuf sBody, sLines;
@@ -1387,10 +1387,9 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) {
pEdit->Initialize();
if (sValue) {
- pEdit->SetText(sValue);
+ pEdit->SetText(*sValue);
} else {
int32_t nCurSel = pField->GetSelectedIndex(0);
-
if (nCurSel < 0)
pEdit->SetText(pField->GetValue().c_str());
else
@@ -1512,7 +1511,7 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() {
WriteAppearance("N", GetRotatedRect(), GetMatrix(), sAP);
}
-void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) {
+void CPDFSDK_Widget::ResetAppearance_TextField(const CFX_WideString* sValue) {
CPDF_FormControl* pControl = GetFormControl();
CPDF_FormField* pField = pControl->GetField();
CFX_ByteTextBuf sBody, sLines;
@@ -1554,7 +1553,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) {
CFX_WideString sValueTmp;
if (!sValue && GetMixXFAWidget()) {
sValueTmp = GetValue(TRUE);
- sValue = sValueTmp.c_str();
+ sValue = &sValueTmp;
}
#endif // PDF_ENABLE_XFA
@@ -1568,7 +1567,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) {
}
} else {
if (sValue)
- nMaxLen = wcslen((const wchar_t*)sValue);
+ nMaxLen = sValue->GetLength();
pEdit->SetLimitChar(nMaxLen);
}
}
@@ -1581,7 +1580,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) {
pEdit->Initialize();
if (sValue)
- pEdit->SetText(sValue);
+ pEdit->SetText(*sValue);
else
pEdit->SetText(pField->GetValue().c_str());
« no previous file with comments | « fpdfsdk/cpdfsdk_interform.cpp ('k') | fpdfsdk/cpdfsdk_widgethandler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698