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

Side by Side Diff: xfa/fxfa/app/xfa_ffwidgetacc.cpp

Issue 1882043004: Remove implicit cast from CFX_WideString to (const wchar_t*) (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: win error #2 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/app/xfa_fftextedit.cpp ('k') | xfa/fxfa/app/xfa_fontmgr.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 "xfa/fxfa/app/xfa_ffwidgetacc.h" 7 #include "xfa/fxfa/app/xfa_ffwidgetacc.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 } 193 }
194 } 194 }
195 FX_BOOL CXFA_WidgetAcc::GetName(CFX_WideString& wsName, int32_t iNameType) { 195 FX_BOOL CXFA_WidgetAcc::GetName(CFX_WideString& wsName, int32_t iNameType) {
196 if (iNameType == 0) { 196 if (iNameType == 0) {
197 m_pNode->TryCData(XFA_ATTRIBUTE_Name, wsName); 197 m_pNode->TryCData(XFA_ATTRIBUTE_Name, wsName);
198 return !wsName.IsEmpty(); 198 return !wsName.IsEmpty();
199 } 199 }
200 m_pNode->GetSOMExpression(wsName); 200 m_pNode->GetSOMExpression(wsName);
201 if (iNameType == 2 && wsName.GetLength() >= 15) { 201 if (iNameType == 2 && wsName.GetLength() >= 15) {
202 CFX_WideStringC wsPre = FX_WSTRC(L"xfa[0].form[0]."); 202 CFX_WideStringC wsPre = FX_WSTRC(L"xfa[0].form[0].");
203 if (wsPre == CFX_WideStringC(wsName, wsPre.GetLength())) { 203 if (wsPre == CFX_WideStringC(wsName.c_str(), wsPre.GetLength())) {
204 wsName.Delete(0, wsPre.GetLength()); 204 wsName.Delete(0, wsPre.GetLength());
205 } 205 }
206 } 206 }
207 return TRUE; 207 return TRUE;
208 } 208 }
209 CXFA_Node* CXFA_WidgetAcc::GetDatasets() { 209 CXFA_Node* CXFA_WidgetAcc::GetDatasets() {
210 return m_pNode->GetBindData(); 210 return m_pNode->GetBindData();
211 } 211 }
212 FX_BOOL CXFA_WidgetAcc::ProcessValueChanged() { 212 FX_BOOL CXFA_WidgetAcc::ProcessValueChanged() {
213 m_pDocView->AddValidateWidget(this); 213 m_pDocView->AddValidateWidget(this);
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 } 521 }
522 CFX_WideString wsCaptionName; 522 CFX_WideString wsCaptionName;
523 CFX_WideString wsTitle; 523 CFX_WideString wsTitle;
524 pAppProvider->LoadString(XFA_IDS_AppName, wsTitle); 524 pAppProvider->LoadString(XFA_IDS_AppName, wsTitle);
525 switch (eNullTest) { 525 switch (eNullTest) {
526 case XFA_ATTRIBUTEENUM_Error: { 526 case XFA_ATTRIBUTEENUM_Error: {
527 if (wsNullMsg.IsEmpty()) { 527 if (wsNullMsg.IsEmpty()) {
528 GetValidateCaptionName(wsCaptionName, bVersionFlag); 528 GetValidateCaptionName(wsCaptionName, bVersionFlag);
529 CFX_WideString wsError; 529 CFX_WideString wsError;
530 pAppProvider->LoadString(XFA_IDS_ValidateNullError, wsError); 530 pAppProvider->LoadString(XFA_IDS_ValidateNullError, wsError);
531 wsNullMsg.Format(wsError, (const FX_WCHAR*)wsCaptionName); 531 wsNullMsg.Format(wsError.c_str(), wsCaptionName.c_str());
532 } 532 }
533 pAppProvider->MsgBox(wsNullMsg.AsStringC(), wsTitle.AsStringC(), 533 pAppProvider->MsgBox(wsNullMsg.AsStringC(), wsTitle.AsStringC(),
534 XFA_MBICON_Status, XFA_MB_OK); 534 XFA_MBICON_Status, XFA_MB_OK);
535 return XFA_EVENTERROR_Error; 535 return XFA_EVENTERROR_Error;
536 } 536 }
537 case XFA_ATTRIBUTEENUM_Warning: { 537 case XFA_ATTRIBUTEENUM_Warning: {
538 if (GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) { 538 if (GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) {
539 return TRUE; 539 return TRUE;
540 } 540 }
541 if (wsNullMsg.IsEmpty()) { 541 if (wsNullMsg.IsEmpty()) {
542 GetValidateCaptionName(wsCaptionName, bVersionFlag); 542 GetValidateCaptionName(wsCaptionName, bVersionFlag);
543 CFX_WideString wsWarning; 543 CFX_WideString wsWarning;
544 pAppProvider->LoadString(XFA_IDS_ValidateNullWarning, wsWarning); 544 pAppProvider->LoadString(XFA_IDS_ValidateNullWarning, wsWarning);
545 wsNullMsg.Format(wsWarning, (const FX_WCHAR*)wsCaptionName, 545 wsNullMsg.Format(wsWarning.c_str(), wsCaptionName.c_str(),
546 (const FX_WCHAR*)wsCaptionName); 546 wsCaptionName.c_str());
547 } 547 }
548 if (pAppProvider->MsgBox(wsNullMsg.AsStringC(), wsTitle.AsStringC(), 548 if (pAppProvider->MsgBox(wsNullMsg.AsStringC(), wsTitle.AsStringC(),
549 XFA_MBICON_Warning, XFA_MB_YesNo) == XFA_IDYes) { 549 XFA_MBICON_Warning, XFA_MB_YesNo) == XFA_IDYes) {
550 GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, TRUE, FALSE); 550 GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, TRUE, FALSE);
551 } 551 }
552 return XFA_EVENTERROR_Error; 552 return XFA_EVENTERROR_Error;
553 } 553 }
554 case XFA_ATTRIBUTEENUM_Disabled: 554 case XFA_ATTRIBUTEENUM_Disabled:
555 default: 555 default:
556 break; 556 break;
(...skipping 20 matching lines...) Expand all
577 } 577 }
578 void CXFA_WidgetAcc::GetValidateMessage(IXFA_AppProvider* pAppProvider, 578 void CXFA_WidgetAcc::GetValidateMessage(IXFA_AppProvider* pAppProvider,
579 CFX_WideString& wsMessage, 579 CFX_WideString& wsMessage,
580 FX_BOOL bError, 580 FX_BOOL bError,
581 FX_BOOL bVersionFlag) { 581 FX_BOOL bVersionFlag) {
582 CFX_WideString wsCaptionName; 582 CFX_WideString wsCaptionName;
583 GetValidateCaptionName(wsCaptionName, bVersionFlag); 583 GetValidateCaptionName(wsCaptionName, bVersionFlag);
584 CFX_WideString wsError; 584 CFX_WideString wsError;
585 if (bVersionFlag) { 585 if (bVersionFlag) {
586 pAppProvider->LoadString(XFA_IDS_ValidateFailed, wsError); 586 pAppProvider->LoadString(XFA_IDS_ValidateFailed, wsError);
587 wsMessage.Format(wsError, (const FX_WCHAR*)wsCaptionName); 587 wsMessage.Format(wsError.c_str(), wsCaptionName.c_str());
588 return; 588 return;
589 } 589 }
590 if (bError) { 590 if (bError) {
591 pAppProvider->LoadString(XFA_IDS_ValidateError, wsError); 591 pAppProvider->LoadString(XFA_IDS_ValidateError, wsError);
592 wsMessage.Format(wsError, (const FX_WCHAR*)wsCaptionName); 592 wsMessage.Format(wsError.c_str(), wsCaptionName.c_str());
593 return; 593 return;
594 } 594 }
595 CFX_WideString wsWarning; 595 CFX_WideString wsWarning;
596 pAppProvider->LoadString(XFA_IDS_ValidateWarning, wsWarning); 596 pAppProvider->LoadString(XFA_IDS_ValidateWarning, wsWarning);
597 wsMessage.Format(wsWarning, (const FX_WCHAR*)wsCaptionName, 597 wsMessage.Format(wsWarning.c_str(), wsCaptionName.c_str(),
598 (const FX_WCHAR*)wsCaptionName); 598 wsCaptionName.c_str());
599 } 599 }
600 int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) { 600 int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) {
601 if (GetClassID() == XFA_ELEMENT_Draw) { 601 if (GetClassID() == XFA_ELEMENT_Draw) {
602 return XFA_EVENTERROR_NotExist; 602 return XFA_EVENTERROR_NotExist;
603 } 603 }
604 CXFA_Validate validate = GetValidate(); 604 CXFA_Validate validate = GetValidate();
605 if (!validate) { 605 if (!validate) {
606 return XFA_EVENTERROR_NotExist; 606 return XFA_EVENTERROR_NotExist;
607 } 607 }
608 FX_BOOL bInitDoc = validate.GetNode()->HasFlag(XFA_NODEFLAG_NeedsInitApp); 608 FX_BOOL bInitDoc = validate.GetNode()->HasFlag(XFA_NODEFLAG_NeedsInitApp);
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 pTextOut->SetFontSize(fFontSize); 909 pTextOut->SetFontSize(fFontSize);
910 pTextOut->SetLineBreakTolerance(fFontSize * 0.2f); 910 pTextOut->SetLineBreakTolerance(fFontSize * 0.2f);
911 pTextOut->SetLineSpace(GetLineHeight()); 911 pTextOut->SetLineSpace(GetLineHeight());
912 uint32_t dwStyles = FDE_TTOSTYLE_LastLineHeight; 912 uint32_t dwStyles = FDE_TTOSTYLE_LastLineHeight;
913 if (GetUIType() == XFA_ELEMENT_TextEdit && IsMultiLine()) { 913 if (GetUIType() == XFA_ELEMENT_TextEdit && IsMultiLine()) {
914 dwStyles |= FDE_TTOSTYLE_LineWrap; 914 dwStyles |= FDE_TTOSTYLE_LineWrap;
915 } 915 }
916 pTextOut->SetStyles(dwStyles); 916 pTextOut->SetStyles(dwStyles);
917 } 917 }
918 ((CXFA_FieldLayoutData*)m_pLayoutData) 918 ((CXFA_FieldLayoutData*)m_pLayoutData)
919 ->m_pTextOut->CalcLogicSize(wsText, wsText.GetLength(), size); 919 ->m_pTextOut->CalcLogicSize(wsText.c_str(), wsText.GetLength(), size);
920 } 920 }
921 FX_BOOL CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) { 921 FX_BOOL CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) {
922 if (size.x > 0) { 922 if (size.x > 0) {
923 CFX_SizeF szOrz = size; 923 CFX_SizeF szOrz = size;
924 CFX_SizeF szCap; 924 CFX_SizeF szCap;
925 CalcCaptionSize(szCap); 925 CalcCaptionSize(szCap);
926 FX_BOOL bCapExit = szCap.x > 0.01 && szCap.y > 0.01; 926 FX_BOOL bCapExit = szCap.x > 0.01 && szCap.y > 0.01;
927 int32_t iCapPlacement = XFA_ATTRIBUTEENUM_Unknown; 927 int32_t iCapPlacement = XFA_ATTRIBUTEENUM_Unknown;
928 if (bCapExit) { 928 if (bCapExit) {
929 iCapPlacement = GetCaption().GetPlacementType(); 929 iCapPlacement = GetCaption().GetPlacementType();
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
1716 if (pIDNode) { 1716 if (pIDNode) {
1717 pEmbAcc = (CXFA_WidgetAcc*)pIDNode->GetWidgetData(); 1717 pEmbAcc = (CXFA_WidgetAcc*)pIDNode->GetWidgetData();
1718 } 1718 }
1719 if (pEmbAcc) { 1719 if (pEmbAcc) {
1720 pEmbAcc->GetValue(wsValue, XFA_VALUEPICTURE_Display); 1720 pEmbAcc->GetValue(wsValue, XFA_VALUEPICTURE_Display);
1721 return TRUE; 1721 return TRUE;
1722 } 1722 }
1723 } 1723 }
1724 return FALSE; 1724 return FALSE;
1725 } 1725 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_fftextedit.cpp ('k') | xfa/fxfa/app/xfa_fontmgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698