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

Side by Side Diff: fpdfsdk/fsdk_baseform.cpp

Issue 1857073002: Make down-conversion explicit from CFX_Widetring to CFX_WideStringC. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: String argument type 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 | « fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp ('k') | fpdfsdk/javascript/PublicMethods.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 "fpdfsdk/include/fsdk_baseform.h" 7 #include "fpdfsdk/include/fsdk_baseform.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 CFX_WideString sName; 62 CFX_WideString sName;
63 if (GetFieldType() == FIELDTYPE_RADIOBUTTON) { 63 if (GetFieldType() == FIELDTYPE_RADIOBUTTON) {
64 sName = GetAnnotName(); 64 sName = GetAnnotName();
65 if (sName.IsEmpty()) 65 if (sName.IsEmpty())
66 sName = GetName(); 66 sName = GetName();
67 } else { 67 } else {
68 sName = GetName(); 68 sName = GetName();
69 } 69 }
70 70
71 if (!sName.IsEmpty()) 71 if (!sName.IsEmpty())
72 m_hMixXFAWidget = pDocView->GetWidgetByName(sName); 72 m_hMixXFAWidget = pDocView->GetWidgetByName(sName.AsWideStringC());
73 } 73 }
74 } 74 }
75 return m_hMixXFAWidget; 75 return m_hMixXFAWidget;
76 } 76 }
77 77
78 return NULL; 78 return NULL;
79 } 79 }
80 80
81 CXFA_FFWidget* CPDFSDK_Widget::GetGroupMixXFAWidget() { 81 CXFA_FFWidget* CPDFSDK_Widget::GetGroupMixXFAWidget() {
82 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); 82 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument();
83 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); 83 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
84 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) { 84 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
85 if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) { 85 if (CXFA_FFDocView* pDocView = pDoc->GetXFADocView()) {
86 CFX_WideString sName = GetName(); 86 CFX_WideString sName = GetName();
87 if (!sName.IsEmpty()) 87 if (!sName.IsEmpty())
88 return pDocView->GetWidgetByName(sName); 88 return pDocView->GetWidgetByName(sName.AsWideStringC());
89 } 89 }
90 } 90 }
91 91
92 return nullptr; 92 return nullptr;
93 } 93 }
94 94
95 CXFA_FFWidgetHandler* CPDFSDK_Widget::GetXFAWidgetHandler() const { 95 CXFA_FFWidgetHandler* CPDFSDK_Widget::GetXFAWidgetHandler() const {
96 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument(); 96 CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument();
97 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); 97 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
98 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) { 98 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
(...skipping 2347 matching lines...) Expand 10 before | Expand all | Expand 10 after
2446 FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize); 2446 FXSYS_memcpy(pBuf, fdfEncodedData.GetBuffer(), nBufSize);
2447 } 2447 }
2448 return TRUE; 2448 return TRUE;
2449 } 2449 }
2450 2450
2451 FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf( 2451 FX_BOOL CPDFSDK_InterForm::ExportFieldsToFDFTextBuf(
2452 const std::vector<CPDF_FormField*>& fields, 2452 const std::vector<CPDF_FormField*>& fields,
2453 bool bIncludeOrExclude, 2453 bool bIncludeOrExclude,
2454 CFX_ByteTextBuf& textBuf) { 2454 CFX_ByteTextBuf& textBuf) {
2455 std::unique_ptr<CFDF_Document> pFDF(m_pInterForm->ExportToFDF( 2455 std::unique_ptr<CFDF_Document> pFDF(m_pInterForm->ExportToFDF(
2456 m_pDocument->GetPath(), fields, bIncludeOrExclude)); 2456 m_pDocument->GetPath().AsWideStringC(), fields, bIncludeOrExclude));
2457 return pFDF ? pFDF->WriteBuf(textBuf) : FALSE; 2457 return pFDF ? pFDF->WriteBuf(textBuf) : FALSE;
2458 } 2458 }
2459 2459
2460 #ifdef PDF_ENABLE_XFA 2460 #ifdef PDF_ENABLE_XFA
2461 void CPDFSDK_InterForm::SynchronizeField(CPDF_FormField* pFormField, 2461 void CPDFSDK_InterForm::SynchronizeField(CPDF_FormField* pFormField,
2462 FX_BOOL bSynchronizeElse) { 2462 FX_BOOL bSynchronizeElse) {
2463 int x = 0; 2463 int x = 0;
2464 if (m_FieldSynchronizeMap.Lookup(pFormField, x)) 2464 if (m_FieldSynchronizeMap.Lookup(pFormField, x))
2465 return; 2465 return;
2466 2466
(...skipping 17 matching lines...) Expand all
2484 FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, 2484 FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination,
2485 FX_BOOL bUrlEncoded) { 2485 FX_BOOL bUrlEncoded) {
2486 if (sDestination.IsEmpty()) 2486 if (sDestination.IsEmpty())
2487 return FALSE; 2487 return FALSE;
2488 2488
2489 if (!m_pDocument || !m_pInterForm) 2489 if (!m_pDocument || !m_pInterForm)
2490 return FALSE; 2490 return FALSE;
2491 2491
2492 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); 2492 CPDFDoc_Environment* pEnv = m_pDocument->GetEnv();
2493 CFX_WideString wsPDFFilePath = m_pDocument->GetPath(); 2493 CFX_WideString wsPDFFilePath = m_pDocument->GetPath();
2494 CFDF_Document* pFDFDoc = m_pInterForm->ExportToFDF(wsPDFFilePath); 2494 CFDF_Document* pFDFDoc =
2495 m_pInterForm->ExportToFDF(wsPDFFilePath.AsWideStringC());
2495 if (!pFDFDoc) 2496 if (!pFDFDoc)
2496 return FALSE; 2497 return FALSE;
2497 2498
2498 CFX_ByteTextBuf FdfBuffer; 2499 CFX_ByteTextBuf FdfBuffer;
2499 FX_BOOL bRet = pFDFDoc->WriteBuf(FdfBuffer); 2500 FX_BOOL bRet = pFDFDoc->WriteBuf(FdfBuffer);
2500 delete pFDFDoc; 2501 delete pFDFDoc;
2501 if (!bRet) 2502 if (!bRet)
2502 return FALSE; 2503 return FALSE;
2503 2504
2504 uint8_t* pBuffer = FdfBuffer.GetBuffer(); 2505 uint8_t* pBuffer = FdfBuffer.GetBuffer();
2505 FX_STRSIZE nBufSize = FdfBuffer.GetLength(); 2506 FX_STRSIZE nBufSize = FdfBuffer.GetLength();
2506 2507
2507 if (bUrlEncoded) { 2508 if (bUrlEncoded) {
2508 if (!FDFToURLEncodedData(pBuffer, nBufSize)) 2509 if (!FDFToURLEncodedData(pBuffer, nBufSize))
2509 return FALSE; 2510 return FALSE;
2510 } 2511 }
2511 2512
2512 pEnv->JS_docSubmitForm(pBuffer, nBufSize, sDestination.c_str()); 2513 pEnv->JS_docSubmitForm(pBuffer, nBufSize, sDestination.c_str());
2513 2514
2514 if (bUrlEncoded) { 2515 if (bUrlEncoded) {
2515 FX_Free(pBuffer); 2516 FX_Free(pBuffer);
2516 pBuffer = NULL; 2517 pBuffer = NULL;
2517 } 2518 }
2518 2519
2519 return TRUE; 2520 return TRUE;
2520 } 2521 }
2521 2522
2522 FX_BOOL CPDFSDK_InterForm::ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf) { 2523 FX_BOOL CPDFSDK_InterForm::ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf) {
2523 CFDF_Document* pFDF = m_pInterForm->ExportToFDF(m_pDocument->GetPath()); 2524 CFDF_Document* pFDF =
2525 m_pInterForm->ExportToFDF(m_pDocument->GetPath().AsWideStringC());
2524 if (!pFDF) 2526 if (!pFDF)
2525 return FALSE; 2527 return FALSE;
2526 2528
2527 FX_BOOL bRet = pFDF->WriteBuf(textBuf); 2529 FX_BOOL bRet = pFDF->WriteBuf(textBuf);
2528 delete pFDF; 2530 delete pFDF;
2529 2531
2530 return bRet; 2532 return bRet;
2531 } 2533 }
2532 2534
2533 FX_BOOL CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) { 2535 FX_BOOL CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) {
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
2829 break; 2831 break;
2830 } 2832 }
2831 } 2833 }
2832 } 2834 }
2833 2835
2834 CFX_FloatRect CBA_AnnotIterator::GetAnnotRect(const CPDFSDK_Annot* pAnnot) { 2836 CFX_FloatRect CBA_AnnotIterator::GetAnnotRect(const CPDFSDK_Annot* pAnnot) {
2835 CFX_FloatRect rcAnnot; 2837 CFX_FloatRect rcAnnot;
2836 pAnnot->GetPDFAnnot()->GetRect(rcAnnot); 2838 pAnnot->GetPDFAnnot()->GetRect(rcAnnot);
2837 return rcAnnot; 2839 return rcAnnot;
2838 } 2840 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp ('k') | fpdfsdk/javascript/PublicMethods.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698