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

Side by Side Diff: fpdfsdk/src/fsdk_baseform.cpp

Issue 733693003: Getting rid of more (FX_LPCWSTR) casts and fixing two bugs revealed by this. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Simplified GetAttrValue to just assign *pValue and to share code. Created 6 years 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 | « fpdfsdk/include/javascript/JS_Define.h ('k') | fpdfsdk/src/javascript/Document.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 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 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 "../include/fsdk_define.h" 7 #include "../include/fsdk_define.h"
8 #include "../include/fsdk_mgr.h" 8 #include "../include/fsdk_mgr.h"
9 #include "../include/fsdk_baseannot.h" 9 #include "../include/fsdk_baseannot.h"
10 #include "../include/fsdk_baseform.h" 10 #include "../include/fsdk_baseform.h"
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 1067
1068 pEdit->Initialize(); 1068 pEdit->Initialize();
1069 1069
1070 if (sValue) 1070 if (sValue)
1071 pEdit->SetText(sValue); 1071 pEdit->SetText(sValue);
1072 else 1072 else
1073 { 1073 {
1074 FX_INT32 nCurSel = pField->GetSelectedIndex(0); 1074 FX_INT32 nCurSel = pField->GetSelectedIndex(0);
1075 1075
1076 if (nCurSel < 0) 1076 if (nCurSel < 0)
1077 » » » » pEdit->SetText((FX_LPCWSTR)pField->GetValue()); 1077 » » » » pEdit->SetText(pField->GetValue().c_str());
1078 else 1078 else
1079 » » » » pEdit->SetText((FX_LPCWSTR)pField->GetOptionLabe l(nCurSel)); 1079 » » » » pEdit->SetText(pField->GetOptionLabel(nCurSel).c _str());
1080 } 1080 }
1081 1081
1082 CPDF_Rect rcContent = pEdit->GetContentRect(); 1082 CPDF_Rect rcContent = pEdit->GetContentRect();
1083 1083
1084 CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(pEdit,CPDF_P oint(0.0f,0.0f)); 1084 CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(pEdit,CPDF_P oint(0.0f,0.0f));
1085 if (sEdit.GetLength() > 0) 1085 if (sEdit.GetLength() > 0)
1086 { 1086 {
1087 sBody << "/Tx BMC\n" << "q\n"; 1087 sBody << "/Tx BMC\n" << "q\n";
1088 if (rcContent.Width() > rcEdit.Width() || 1088 if (rcContent.Width() > rcEdit.Width() ||
1089 rcContent.Height() > rcEdit.Height()) 1089 rcContent.Height() > rcEdit.Height())
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 FX_BOOL bSelected = FALSE; 1154 FX_BOOL bSelected = FALSE;
1155 for (FX_INT32 j=0; j<nSelCount; j++) 1155 for (FX_INT32 j=0; j<nSelCount; j++)
1156 { 1156 {
1157 if (pField->GetSelectedIndex(j) == i) 1157 if (pField->GetSelectedIndex(j) == i)
1158 { 1158 {
1159 bSelected = TRUE; 1159 bSelected = TRUE;
1160 break; 1160 break;
1161 } 1161 }
1162 } 1162 }
1163 1163
1164 » » » pEdit->SetText((FX_LPCWSTR)pField->GetOptionLabel(i)); 1164 » » » pEdit->SetText(pField->GetOptionLabel(i).c_str());
1165 1165
1166 CPDF_Rect rcContent = pEdit->GetContentRect(); 1166 CPDF_Rect rcContent = pEdit->GetContentRect();
1167 FX_FLOAT fItemHeight = rcContent.Height(); 1167 FX_FLOAT fItemHeight = rcContent.Height();
1168 1168
1169 if (bSelected) 1169 if (bSelected)
1170 { 1170 {
1171 CPDF_Rect rcItem = CPDF_Rect(rcClient.left,fy-fI temHeight,rcClient.right,fy); 1171 CPDF_Rect rcItem = CPDF_Rect(rcClient.left,fy-fI temHeight,rcClient.right,fy);
1172 sList << "q\n" << CPWL_Utils::GetColorAppStream( CPWL_Color(COLORTYPE_RGB,0,51.0f/255.0f,113.0f/255.0f),TRUE) 1172 sList << "q\n" << CPWL_Utils::GetColorAppStream( CPWL_Color(COLORTYPE_RGB,0,51.0f/255.0f,113.0f/255.0f),TRUE)
1173 << rcItem.left << " " << rcItem.bottom < < " " << rcItem.Width() << " " << rcItem.Height() << " re f\n" << "Q\n"; 1173 << rcItem.left << " " << rcItem.bottom < < " " << rcItem.Width() << " " << rcItem.Height() << " re f\n" << "Q\n";
1174 1174
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 if (IsFloatZero(fFontSize)) 1273 if (IsFloatZero(fFontSize))
1274 pEdit->SetAutoFontSize(TRUE); 1274 pEdit->SetAutoFontSize(TRUE);
1275 else 1275 else
1276 pEdit->SetFontSize(fFontSize); 1276 pEdit->SetFontSize(fFontSize);
1277 1277
1278 pEdit->Initialize(); 1278 pEdit->Initialize();
1279 1279
1280 if (sValue) 1280 if (sValue)
1281 pEdit->SetText(sValue); 1281 pEdit->SetText(sValue);
1282 else 1282 else
1283 » » » pEdit->SetText((FX_LPCWSTR)pField->GetValue()); 1283 » » » pEdit->SetText(pField->GetValue().c_str());
1284 1284
1285 CPDF_Rect rcContent = pEdit->GetContentRect(); 1285 CPDF_Rect rcContent = pEdit->GetContentRect();
1286 1286
1287 CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(pEdit,CPDF_P oint(0.0f,0.0f), 1287 CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(pEdit,CPDF_P oint(0.0f,0.0f),
1288 NULL,!bCharArray,subWord ); 1288 NULL,!bCharArray,subWord );
1289 1289
1290 if (sEdit.GetLength() > 0) 1290 if (sEdit.GetLength() > 0)
1291 { 1291 {
1292 sBody << "/Tx BMC\n" << "q\n"; 1292 sBody << "/Tx BMC\n" << "q\n";
1293 if (rcContent.Width() > rcClient.Width() || 1293 if (rcContent.Width() > rcClient.Width() ||
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after
2275 2275
2276 FX_LPBYTE pBuffer = textBuf.GetBuffer(); 2276 FX_LPBYTE pBuffer = textBuf.GetBuffer();
2277 FX_STRSIZE nBufSize = textBuf.GetLength(); 2277 FX_STRSIZE nBufSize = textBuf.GetLength();
2278 2278
2279 if (bUrlEncoded) 2279 if (bUrlEncoded)
2280 { 2280 {
2281 if(!FDFToURLEncodedData(pBuffer, nBufSize)) 2281 if(!FDFToURLEncodedData(pBuffer, nBufSize))
2282 return FALSE; 2282 return FALSE;
2283 } 2283 }
2284 2284
2285 » pEnv->JS_docSubmitForm(pBuffer, nBufSize, (FX_LPCWSTR)csDestination); 2285 » pEnv->JS_docSubmitForm(pBuffer, nBufSize, csDestination.c_str());
2286 2286
2287 return TRUE; 2287 return TRUE;
2288 } 2288 }
2289 2289
2290 void CPDFSDK_InterForm::DoFDFBuffer(CFX_ByteString sBuffer) 2290 void CPDFSDK_InterForm::DoFDFBuffer(CFX_ByteString sBuffer)
2291 { 2291 {
2292 ASSERT(m_pDocument != NULL); 2292 ASSERT(m_pDocument != NULL);
2293 2293
2294 if (CFDF_Document *pFDFDocument = CFDF_Document::ParseMemory((const unsi gned char *)sBuffer.GetBuffer(sBuffer.GetLength()), sBuffer.GetLength())) 2294 if (CFDF_Document *pFDFDocument = CFDF_Document::ParseMemory((const unsi gned char *)sBuffer.GetBuffer(sBuffer.GetLength()), sBuffer.GetLength()))
2295 { 2295 {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
2426 2426
2427 FX_LPBYTE pBuffer = FdfBuffer.GetBuffer(); 2427 FX_LPBYTE pBuffer = FdfBuffer.GetBuffer();
2428 FX_STRSIZE nBufSize = FdfBuffer.GetLength(); 2428 FX_STRSIZE nBufSize = FdfBuffer.GetLength();
2429 2429
2430 if (bUrlEncoded) 2430 if (bUrlEncoded)
2431 { 2431 {
2432 if(!FDFToURLEncodedData(pBuffer, nBufSize)) 2432 if(!FDFToURLEncodedData(pBuffer, nBufSize))
2433 return FALSE; 2433 return FALSE;
2434 } 2434 }
2435 2435
2436 » pEnv->JS_docSubmitForm(pBuffer, nBufSize, (FX_LPCWSTR)sDestination); 2436 » pEnv->JS_docSubmitForm(pBuffer, nBufSize, sDestination.c_str());
2437 2437
2438 if (bUrlEncoded && pBuffer) 2438 if (bUrlEncoded && pBuffer)
2439 { 2439 {
2440 FX_Free(pBuffer); 2440 FX_Free(pBuffer);
2441 pBuffer = NULL; 2441 pBuffer = NULL;
2442 } 2442 }
2443 2443
2444 return TRUE; 2444 return TRUE;
2445 } 2445 }
2446 2446
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
3096 3096
3097 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); 3097 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
3098 ASSERT(pPDFAnnot != NULL); 3098 ASSERT(pPDFAnnot != NULL);
3099 3099
3100 CPDF_Rect rcAnnot; 3100 CPDF_Rect rcAnnot;
3101 pPDFAnnot->GetRect(rcAnnot); 3101 pPDFAnnot->GetRect(rcAnnot);
3102 3102
3103 return rcAnnot; 3103 return rcAnnot;
3104 } 3104 }
3105 3105
OLDNEW
« no previous file with comments | « fpdfsdk/include/javascript/JS_Define.h ('k') | fpdfsdk/src/javascript/Document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698