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

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

Issue 1888103002: Replace calls to deprecated CFX_{Wide,Byte}String::Empty() (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/app/xfa_fwltheme.cpp ('k') | xfa/fxfa/fm2js/xfa_fm2jsapi.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_textlayout.h" 7 #include "xfa/fxfa/app/xfa_textlayout.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 } 510 }
511 } else if (fLineHeight < 0.1f) { 511 } else if (fLineHeight < 0.1f) {
512 fLineHeight = GetFontSize(pTextProvider, pStyle) * 1.2f; 512 fLineHeight = GetFontSize(pTextProvider, pStyle) * 1.2f;
513 } 513 }
514 fLineHeight *= fVerScale; 514 fLineHeight *= fVerScale;
515 return fLineHeight; 515 return fLineHeight;
516 } 516 }
517 FX_BOOL CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider, 517 FX_BOOL CXFA_TextParser::GetEmbbedObj(CXFA_TextProvider* pTextProvider,
518 CFDE_XMLNode* pXMLNode, 518 CFDE_XMLNode* pXMLNode,
519 CFX_WideString& wsValue) { 519 CFX_WideString& wsValue) {
520 wsValue.Empty(); 520 wsValue.clear();
521 if (pXMLNode == NULL) { 521 if (pXMLNode == NULL) {
522 return FALSE; 522 return FALSE;
523 } 523 }
524 FX_BOOL bRet = FALSE; 524 FX_BOOL bRet = FALSE;
525 if (pXMLNode->GetType() == FDE_XMLNODE_Element) { 525 if (pXMLNode->GetType() == FDE_XMLNODE_Element) {
526 CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLNode); 526 CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLNode);
527 CFX_WideString wsAttr; 527 CFX_WideString wsAttr;
528 pElement->GetString(FX_WSTRC(L"xfa:embed").c_str(), wsAttr); 528 pElement->GetString(FX_WSTRC(L"xfa:embed").c_str(), wsAttr);
529 if (wsAttr.IsEmpty()) { 529 if (wsAttr.IsEmpty()) {
530 return FALSE; 530 return FALSE;
531 } 531 }
532 if (wsAttr.GetAt(0) == L'#') { 532 if (wsAttr.GetAt(0) == L'#') {
533 wsAttr.Delete(0); 533 wsAttr.Delete(0);
534 } 534 }
535 CFX_WideString ws; 535 CFX_WideString ws;
536 pElement->GetString(FX_WSTRC(L"xfa:embedType").c_str(), ws); 536 pElement->GetString(FX_WSTRC(L"xfa:embedType").c_str(), ws);
537 if (ws.IsEmpty()) { 537 if (ws.IsEmpty()) {
538 ws = L"som"; 538 ws = L"som";
539 } else { 539 } else {
540 ws.MakeLower(); 540 ws.MakeLower();
541 } 541 }
542 FX_BOOL bURI = (ws == FX_WSTRC(L"uri")); 542 FX_BOOL bURI = (ws == FX_WSTRC(L"uri"));
543 if (!bURI && ws != FX_WSTRC(L"som")) { 543 if (!bURI && ws != FX_WSTRC(L"som")) {
544 return FALSE; 544 return FALSE;
545 } 545 }
546 ws.Empty(); 546 ws.clear();
547 pElement->GetString(FX_WSTRC(L"xfa:embedMode").c_str(), ws); 547 pElement->GetString(FX_WSTRC(L"xfa:embedMode").c_str(), ws);
548 if (ws.IsEmpty()) { 548 if (ws.IsEmpty()) {
549 ws = L"formatted"; 549 ws = L"formatted";
550 } else { 550 } else {
551 ws.MakeLower(); 551 ws.MakeLower();
552 } 552 }
553 FX_BOOL bRaw = (ws == FX_WSTRC(L"raw")); 553 FX_BOOL bRaw = (ws == FX_WSTRC(L"raw"));
554 if (!bRaw && ws != FX_WSTRC(L"formatted")) { 554 if (!bRaw && ws != FX_WSTRC(L"formatted")) {
555 return FALSE; 555 return FALSE;
556 } 556 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 eStatus = XFA_TABSTOPSSTATUS_Location; 638 eStatus = XFA_TABSTOPSSTATUS_Location;
639 } 639 }
640 break; 640 break;
641 case XFA_TABSTOPSSTATUS_Location: 641 case XFA_TABSTOPSSTATUS_Location:
642 if (ch == ' ') { 642 if (ch == ' ') {
643 uint32_t dwHashCode = FX_HashCode_String_GetW( 643 uint32_t dwHashCode = FX_HashCode_String_GetW(
644 wsAlign.c_str(), wsAlign.GetLength(), TRUE); 644 wsAlign.c_str(), wsAlign.GetLength(), TRUE);
645 CXFA_Measurement ms(CFX_WideStringC(pTabStops + iLast, iCur - iLast)); 645 CXFA_Measurement ms(CFX_WideStringC(pTabStops + iLast, iCur - iLast));
646 FX_FLOAT fPos = ms.ToUnit(XFA_UNIT_Pt); 646 FX_FLOAT fPos = ms.ToUnit(XFA_UNIT_Pt);
647 pTabstopContext->Append(dwHashCode, fPos); 647 pTabstopContext->Append(dwHashCode, fPos);
648 wsAlign.Empty(); 648 wsAlign.clear();
649 eStatus = XFA_TABSTOPSSTATUS_None; 649 eStatus = XFA_TABSTOPSSTATUS_None;
650 } 650 }
651 iCur++; 651 iCur++;
652 break; 652 break;
653 default: 653 default:
654 break; 654 break;
655 } 655 }
656 } 656 }
657 if (!wsAlign.IsEmpty()) { 657 if (!wsAlign.IsEmpty()) {
658 uint32_t dwHashCode = 658 uint32_t dwHashCode =
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 m_pBreak->SetFontSize(fFontSize); 881 m_pBreak->SetFontSize(fFontSize);
882 m_pBreak->SetLineBreakTolerance(fFontSize * 0.2f); 882 m_pBreak->SetLineBreakTolerance(fFontSize * 0.2f);
883 m_pBreak->SetFont(m_textParser.GetFont(m_pTextProvider, pStyle)); 883 m_pBreak->SetFont(m_textParser.GetFont(m_pTextProvider, pStyle));
884 m_pBreak->SetHorizontalScale( 884 m_pBreak->SetHorizontalScale(
885 m_textParser.GetHorScale(m_pTextProvider, pStyle, pXMLNode)); 885 m_textParser.GetHorScale(m_pTextProvider, pStyle, pXMLNode));
886 m_pBreak->SetVerticalScale(m_textParser.GetVerScale(m_pTextProvider, pStyle)); 886 m_pBreak->SetVerticalScale(m_textParser.GetVerScale(m_pTextProvider, pStyle));
887 m_pBreak->SetCharSpace(pParaStyle->GetLetterSpacing().GetValue()); 887 m_pBreak->SetCharSpace(pParaStyle->GetLetterSpacing().GetValue());
888 } 888 }
889 int32_t CXFA_TextLayout::GetText(CFX_WideString& wsText) { 889 int32_t CXFA_TextLayout::GetText(CFX_WideString& wsText) {
890 GetTextDataNode(); 890 GetTextDataNode();
891 wsText.Empty(); 891 wsText.clear();
892 if (m_bRichText) { 892 if (m_bRichText) {
893 } else { 893 } else {
894 wsText = m_pTextDataNode->GetContent(); 894 wsText = m_pTextDataNode->GetContent();
895 } 895 }
896 return wsText.GetLength(); 896 return wsText.GetLength();
897 } 897 }
898 FX_FLOAT CXFA_TextLayout::GetLayoutHeight() { 898 FX_FLOAT CXFA_TextLayout::GetLayoutHeight() {
899 if (m_pLoader == NULL) { 899 if (m_pLoader == NULL) {
900 return 0; 900 return 0;
901 } 901 }
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after
1990 tr.iLength = iLength; 1990 tr.iLength = iLength;
1991 tr.fFontSize = pPiece->fFontSize; 1991 tr.fFontSize = pPiece->fFontSize;
1992 tr.iBidiLevel = pPiece->iBidiLevel; 1992 tr.iBidiLevel = pPiece->iBidiLevel;
1993 tr.iCharRotation = 0; 1993 tr.iCharRotation = 0;
1994 tr.wLineBreakChar = L'\n'; 1994 tr.wLineBreakChar = L'\n';
1995 tr.iVerticalScale = pPiece->iVerScale; 1995 tr.iVerticalScale = pPiece->iVerScale;
1996 tr.dwLayoutStyles = FX_RTFLAYOUTSTYLE_ExpandTab; 1996 tr.dwLayoutStyles = FX_RTFLAYOUTSTYLE_ExpandTab;
1997 tr.iHorizontalScale = pPiece->iHorScale; 1997 tr.iHorizontalScale = pPiece->iHorScale;
1998 return TRUE; 1998 return TRUE;
1999 } 1999 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_fwltheme.cpp ('k') | xfa/fxfa/fm2js/xfa_fm2jsapi.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698