| OLD | NEW |
| 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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); | 301 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); |
| 302 pXMLElement->GetLocalTagName(wsName); | 302 pXMLElement->GetLocalTagName(wsName); |
| 303 tagProvider.SetTagNameObj(wsName); | 303 tagProvider.SetTagNameObj(wsName); |
| 304 uint32_t dwHashCode = | 304 uint32_t dwHashCode = |
| 305 FX_HashCode_String_GetW(wsName, wsName.GetLength(), TRUE); | 305 FX_HashCode_String_GetW(wsName, wsName.GetLength(), TRUE); |
| 306 static const int32_t s_iCount = sizeof(s_XFATagName) / sizeof(uint32_t); | 306 static const int32_t s_iCount = sizeof(s_XFATagName) / sizeof(uint32_t); |
| 307 CFX_DSPATemplate<uint32_t> lookup; | 307 CFX_DSPATemplate<uint32_t> lookup; |
| 308 tagProvider.m_bTagAviliable = | 308 tagProvider.m_bTagAviliable = |
| 309 lookup.Lookup(dwHashCode, s_XFATagName, s_iCount) > -1; | 309 lookup.Lookup(dwHashCode, s_XFATagName, s_iCount) > -1; |
| 310 CFX_WideString wsValue; | 310 CFX_WideString wsValue; |
| 311 pXMLElement->GetString(FX_WSTRC(L"style").GetPtr(), wsValue); | 311 pXMLElement->GetString(FX_WSTRC(L"style").raw_str(), wsValue); |
| 312 if (!wsValue.IsEmpty()) { | 312 if (!wsValue.IsEmpty()) { |
| 313 tagProvider.SetAttribute(FX_WSTRC(L"style"), wsValue); | 313 tagProvider.SetAttribute(FX_WSTRC(L"style"), wsValue); |
| 314 } | 314 } |
| 315 } else if (pXMLNode->GetType() == FDE_XMLNODE_Text) { | 315 } else if (pXMLNode->GetType() == FDE_XMLNODE_Text) { |
| 316 tagProvider.m_bTagAviliable = TRUE; | 316 tagProvider.m_bTagAviliable = TRUE; |
| 317 tagProvider.m_bContent = TRUE; | 317 tagProvider.m_bContent = TRUE; |
| 318 } | 318 } |
| 319 } | 319 } |
| 320 int32_t CXFA_TextParser::GetVAlgin(CXFA_TextProvider* pTextProvider) const { | 320 int32_t CXFA_TextParser::GetVAlgin(CXFA_TextProvider* pTextProvider) const { |
| 321 int32_t iAlign = XFA_ATTRIBUTEENUM_Top; | 321 int32_t iAlign = XFA_ATTRIBUTEENUM_Top; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 CFDE_XMLNode* pXMLNode, | 520 CFDE_XMLNode* pXMLNode, |
| 521 CFX_WideString& wsValue) { | 521 CFX_WideString& wsValue) { |
| 522 wsValue.Empty(); | 522 wsValue.Empty(); |
| 523 if (pXMLNode == NULL) { | 523 if (pXMLNode == NULL) { |
| 524 return FALSE; | 524 return FALSE; |
| 525 } | 525 } |
| 526 FX_BOOL bRet = FALSE; | 526 FX_BOOL bRet = FALSE; |
| 527 if (pXMLNode->GetType() == FDE_XMLNODE_Element) { | 527 if (pXMLNode->GetType() == FDE_XMLNODE_Element) { |
| 528 CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLNode); | 528 CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLNode); |
| 529 CFX_WideString wsAttr; | 529 CFX_WideString wsAttr; |
| 530 pElement->GetString(FX_WSTRC(L"xfa:embed").GetPtr(), wsAttr); | 530 pElement->GetString(FX_WSTRC(L"xfa:embed").raw_str(), wsAttr); |
| 531 if (wsAttr.IsEmpty()) { | 531 if (wsAttr.IsEmpty()) { |
| 532 return FALSE; | 532 return FALSE; |
| 533 } | 533 } |
| 534 if (wsAttr.GetAt(0) == L'#') { | 534 if (wsAttr.GetAt(0) == L'#') { |
| 535 wsAttr.Delete(0); | 535 wsAttr.Delete(0); |
| 536 } | 536 } |
| 537 CFX_WideString ws; | 537 CFX_WideString ws; |
| 538 pElement->GetString(FX_WSTRC(L"xfa:embedType").GetPtr(), ws); | 538 pElement->GetString(FX_WSTRC(L"xfa:embedType").raw_str(), ws); |
| 539 if (ws.IsEmpty()) { | 539 if (ws.IsEmpty()) { |
| 540 ws = L"som"; | 540 ws = L"som"; |
| 541 } else { | 541 } else { |
| 542 ws.MakeLower(); | 542 ws.MakeLower(); |
| 543 } | 543 } |
| 544 FX_BOOL bURI = (ws == FX_WSTRC(L"uri")); | 544 FX_BOOL bURI = (ws == FX_WSTRC(L"uri")); |
| 545 if (!bURI && ws != FX_WSTRC(L"som")) { | 545 if (!bURI && ws != FX_WSTRC(L"som")) { |
| 546 return FALSE; | 546 return FALSE; |
| 547 } | 547 } |
| 548 ws.Empty(); | 548 ws.Empty(); |
| 549 pElement->GetString(FX_WSTRC(L"xfa:embedMode").GetPtr(), ws); | 549 pElement->GetString(FX_WSTRC(L"xfa:embedMode").raw_str(), ws); |
| 550 if (ws.IsEmpty()) { | 550 if (ws.IsEmpty()) { |
| 551 ws = L"formatted"; | 551 ws = L"formatted"; |
| 552 } else { | 552 } else { |
| 553 ws.MakeLower(); | 553 ws.MakeLower(); |
| 554 } | 554 } |
| 555 FX_BOOL bRaw = (ws == FX_WSTRC(L"raw")); | 555 FX_BOOL bRaw = (ws == FX_WSTRC(L"raw")); |
| 556 if (!bRaw && ws != FX_WSTRC(L"formatted")) { | 556 if (!bRaw && ws != FX_WSTRC(L"formatted")) { |
| 557 return FALSE; | 557 return FALSE; |
| 558 } | 558 } |
| 559 bRet = pTextProvider->GetEmbbedObj(bURI, bRaw, wsAttr, wsValue); | 559 bRet = pTextProvider->GetEmbbedObj(bURI, bRaw, wsAttr, wsValue); |
| (...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1418 const FDE_CSSRECT* pRect = | 1418 const FDE_CSSRECT* pRect = |
| 1419 pStyle->GetBoundaryStyles()->GetMarginWidth(); | 1419 pStyle->GetBoundaryStyles()->GetMarginWidth(); |
| 1420 if (pRect) { | 1420 if (pRect) { |
| 1421 fLinePos += pRect->top.GetValue(); | 1421 fLinePos += pRect->top.GetValue(); |
| 1422 fSpaceBelow = pRect->bottom.GetValue(); | 1422 fSpaceBelow = pRect->bottom.GetValue(); |
| 1423 } | 1423 } |
| 1424 } | 1424 } |
| 1425 if (wsName == FX_WSTRC(L"a")) { | 1425 if (wsName == FX_WSTRC(L"a")) { |
| 1426 CFX_WideString wsLinkContent; | 1426 CFX_WideString wsLinkContent; |
| 1427 FXSYS_assert(pElement); | 1427 FXSYS_assert(pElement); |
| 1428 pElement->GetString(FX_WSTRC(L"href").GetPtr(), wsLinkContent); | 1428 pElement->GetString(FX_WSTRC(L"href").raw_str(), wsLinkContent); |
| 1429 if (!wsLinkContent.IsEmpty()) { | 1429 if (!wsLinkContent.IsEmpty()) { |
| 1430 pLinkData = FXTARGET_NewWith(m_pAllocator) CXFA_LinkUserData( | 1430 pLinkData = FXTARGET_NewWith(m_pAllocator) CXFA_LinkUserData( |
| 1431 m_pAllocator, | 1431 m_pAllocator, |
| 1432 wsLinkContent.GetBuffer(wsLinkContent.GetLength())); | 1432 wsLinkContent.GetBuffer(wsLinkContent.GetLength())); |
| 1433 wsLinkContent.ReleaseBuffer(wsLinkContent.GetLength()); | 1433 wsLinkContent.ReleaseBuffer(wsLinkContent.GetLength()); |
| 1434 } | 1434 } |
| 1435 } | 1435 } |
| 1436 int32_t iTabCount = | 1436 int32_t iTabCount = |
| 1437 m_textParser.CountTabs(bContentNode ? pParentStyle : pStyle); | 1437 m_textParser.CountTabs(bContentNode ? pParentStyle : pStyle); |
| 1438 FX_BOOL bSpaceRun = | 1438 FX_BOOL bSpaceRun = |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1994 tr.iLength = iLength; | 1994 tr.iLength = iLength; |
| 1995 tr.fFontSize = pPiece->fFontSize; | 1995 tr.fFontSize = pPiece->fFontSize; |
| 1996 tr.iBidiLevel = pPiece->iBidiLevel; | 1996 tr.iBidiLevel = pPiece->iBidiLevel; |
| 1997 tr.iCharRotation = 0; | 1997 tr.iCharRotation = 0; |
| 1998 tr.wLineBreakChar = L'\n'; | 1998 tr.wLineBreakChar = L'\n'; |
| 1999 tr.iVerticalScale = pPiece->iVerScale; | 1999 tr.iVerticalScale = pPiece->iVerScale; |
| 2000 tr.dwLayoutStyles = FX_RTFLAYOUTSTYLE_ExpandTab; | 2000 tr.dwLayoutStyles = FX_RTFLAYOUTSTYLE_ExpandTab; |
| 2001 tr.iHorizontalScale = pPiece->iHorScale; | 2001 tr.iHorizontalScale = pPiece->iHorScale; |
| 2002 return TRUE; | 2002 return TRUE; |
| 2003 } | 2003 } |
| OLD | NEW |