| 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 if (pXMLNode->GetType() == FDE_XMLNODE_Element) { | 274 if (pXMLNode->GetType() == FDE_XMLNODE_Element) { |
| 275 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); | 275 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); |
| 276 pXMLElement->GetLocalTagName(wsName); | 276 pXMLElement->GetLocalTagName(wsName); |
| 277 tagProvider.SetTagNameObj(wsName); | 277 tagProvider.SetTagNameObj(wsName); |
| 278 uint32_t dwHashCode = FX_HashCode_GetW(wsName.AsStringC(), true); | 278 uint32_t dwHashCode = FX_HashCode_GetW(wsName.AsStringC(), true); |
| 279 static const int32_t s_iCount = sizeof(s_XFATagName) / sizeof(uint32_t); | 279 static const int32_t s_iCount = sizeof(s_XFATagName) / sizeof(uint32_t); |
| 280 CFX_DSPATemplate<uint32_t> lookup; | 280 CFX_DSPATemplate<uint32_t> lookup; |
| 281 tagProvider.m_bTagAviliable = | 281 tagProvider.m_bTagAviliable = |
| 282 lookup.Lookup(dwHashCode, s_XFATagName, s_iCount) > -1; | 282 lookup.Lookup(dwHashCode, s_XFATagName, s_iCount) > -1; |
| 283 CFX_WideString wsValue; | 283 CFX_WideString wsValue; |
| 284 pXMLElement->GetString(FX_WSTRC(L"style").c_str(), wsValue); | 284 pXMLElement->GetString(L"style", wsValue); |
| 285 if (!wsValue.IsEmpty()) { | 285 if (!wsValue.IsEmpty()) { |
| 286 tagProvider.SetAttribute(L"style", wsValue); | 286 tagProvider.SetAttribute(L"style", wsValue); |
| 287 } | 287 } |
| 288 } else if (pXMLNode->GetType() == FDE_XMLNODE_Text) { | 288 } else if (pXMLNode->GetType() == FDE_XMLNODE_Text) { |
| 289 tagProvider.m_bTagAviliable = TRUE; | 289 tagProvider.m_bTagAviliable = TRUE; |
| 290 tagProvider.m_bContent = TRUE; | 290 tagProvider.m_bContent = TRUE; |
| 291 } | 291 } |
| 292 } | 292 } |
| 293 | 293 |
| 294 int32_t CXFA_TextParser::GetVAlign(CXFA_TextProvider* pTextProvider) const { | 294 int32_t CXFA_TextParser::GetVAlign(CXFA_TextProvider* pTextProvider) const { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 CFDE_XMLNode* pXMLNode, | 490 CFDE_XMLNode* pXMLNode, |
| 491 CFX_WideString& wsValue) { | 491 CFX_WideString& wsValue) { |
| 492 wsValue.clear(); | 492 wsValue.clear(); |
| 493 if (pXMLNode == NULL) { | 493 if (pXMLNode == NULL) { |
| 494 return FALSE; | 494 return FALSE; |
| 495 } | 495 } |
| 496 FX_BOOL bRet = FALSE; | 496 FX_BOOL bRet = FALSE; |
| 497 if (pXMLNode->GetType() == FDE_XMLNODE_Element) { | 497 if (pXMLNode->GetType() == FDE_XMLNODE_Element) { |
| 498 CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLNode); | 498 CFDE_XMLElement* pElement = static_cast<CFDE_XMLElement*>(pXMLNode); |
| 499 CFX_WideString wsAttr; | 499 CFX_WideString wsAttr; |
| 500 pElement->GetString(FX_WSTRC(L"xfa:embed").c_str(), wsAttr); | 500 pElement->GetString(L"xfa:embed", wsAttr); |
| 501 if (wsAttr.IsEmpty()) { | 501 if (wsAttr.IsEmpty()) { |
| 502 return FALSE; | 502 return FALSE; |
| 503 } | 503 } |
| 504 if (wsAttr.GetAt(0) == L'#') { | 504 if (wsAttr.GetAt(0) == L'#') { |
| 505 wsAttr.Delete(0); | 505 wsAttr.Delete(0); |
| 506 } | 506 } |
| 507 CFX_WideString ws; | 507 CFX_WideString ws; |
| 508 pElement->GetString(FX_WSTRC(L"xfa:embedType").c_str(), ws); | 508 pElement->GetString(L"xfa:embedType", ws); |
| 509 if (ws.IsEmpty()) { | 509 if (ws.IsEmpty()) { |
| 510 ws = L"som"; | 510 ws = L"som"; |
| 511 } else { | 511 } else { |
| 512 ws.MakeLower(); | 512 ws.MakeLower(); |
| 513 } | 513 } |
| 514 FX_BOOL bURI = (ws == FX_WSTRC(L"uri")); | 514 FX_BOOL bURI = (ws == FX_WSTRC(L"uri")); |
| 515 if (!bURI && ws != FX_WSTRC(L"som")) { | 515 if (!bURI && ws != FX_WSTRC(L"som")) { |
| 516 return FALSE; | 516 return FALSE; |
| 517 } | 517 } |
| 518 ws.clear(); | 518 ws.clear(); |
| 519 pElement->GetString(FX_WSTRC(L"xfa:embedMode").c_str(), ws); | 519 pElement->GetString(L"xfa:embedMode", ws); |
| 520 if (ws.IsEmpty()) { | 520 if (ws.IsEmpty()) { |
| 521 ws = L"formatted"; | 521 ws = L"formatted"; |
| 522 } else { | 522 } else { |
| 523 ws.MakeLower(); | 523 ws.MakeLower(); |
| 524 } | 524 } |
| 525 FX_BOOL bRaw = (ws == FX_WSTRC(L"raw")); | 525 FX_BOOL bRaw = (ws == FX_WSTRC(L"raw")); |
| 526 if (!bRaw && ws != FX_WSTRC(L"formatted")) { | 526 if (!bRaw && ws != FX_WSTRC(L"formatted")) { |
| 527 return FALSE; | 527 return FALSE; |
| 528 } | 528 } |
| 529 bRet = pTextProvider->GetEmbbedObj(bURI, bRaw, wsAttr, wsValue); | 529 bRet = pTextProvider->GetEmbbedObj(bURI, bRaw, wsAttr, wsValue); |
| (...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 const FDE_CSSRECT* pRect = | 1379 const FDE_CSSRECT* pRect = |
| 1380 pStyle->GetBoundaryStyles()->GetMarginWidth(); | 1380 pStyle->GetBoundaryStyles()->GetMarginWidth(); |
| 1381 if (pRect) { | 1381 if (pRect) { |
| 1382 fLinePos += pRect->top.GetValue(); | 1382 fLinePos += pRect->top.GetValue(); |
| 1383 fSpaceBelow = pRect->bottom.GetValue(); | 1383 fSpaceBelow = pRect->bottom.GetValue(); |
| 1384 } | 1384 } |
| 1385 } | 1385 } |
| 1386 if (wsName == FX_WSTRC(L"a")) { | 1386 if (wsName == FX_WSTRC(L"a")) { |
| 1387 CFX_WideString wsLinkContent; | 1387 CFX_WideString wsLinkContent; |
| 1388 ASSERT(pElement); | 1388 ASSERT(pElement); |
| 1389 pElement->GetString(FX_WSTRC(L"href").c_str(), wsLinkContent); | 1389 pElement->GetString(L"href", wsLinkContent); |
| 1390 if (!wsLinkContent.IsEmpty()) { | 1390 if (!wsLinkContent.IsEmpty()) { |
| 1391 pLinkData = FXTARGET_NewWith(m_pAllocator) CXFA_LinkUserData( | 1391 pLinkData = FXTARGET_NewWith(m_pAllocator) CXFA_LinkUserData( |
| 1392 m_pAllocator, | 1392 m_pAllocator, |
| 1393 wsLinkContent.GetBuffer(wsLinkContent.GetLength())); | 1393 wsLinkContent.GetBuffer(wsLinkContent.GetLength())); |
| 1394 wsLinkContent.ReleaseBuffer(wsLinkContent.GetLength()); | 1394 wsLinkContent.ReleaseBuffer(wsLinkContent.GetLength()); |
| 1395 } | 1395 } |
| 1396 } | 1396 } |
| 1397 int32_t iTabCount = | 1397 int32_t iTabCount = |
| 1398 m_textParser.CountTabs(bContentNode ? pParentStyle : pStyle); | 1398 m_textParser.CountTabs(bContentNode ? pParentStyle : pStyle); |
| 1399 FX_BOOL bSpaceRun = | 1399 FX_BOOL bSpaceRun = |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1955 tr.iLength = iLength; | 1955 tr.iLength = iLength; |
| 1956 tr.fFontSize = pPiece->fFontSize; | 1956 tr.fFontSize = pPiece->fFontSize; |
| 1957 tr.iBidiLevel = pPiece->iBidiLevel; | 1957 tr.iBidiLevel = pPiece->iBidiLevel; |
| 1958 tr.iCharRotation = 0; | 1958 tr.iCharRotation = 0; |
| 1959 tr.wLineBreakChar = L'\n'; | 1959 tr.wLineBreakChar = L'\n'; |
| 1960 tr.iVerticalScale = pPiece->iVerScale; | 1960 tr.iVerticalScale = pPiece->iVerScale; |
| 1961 tr.dwLayoutStyles = FX_RTFLAYOUTSTYLE_ExpandTab; | 1961 tr.dwLayoutStyles = FX_RTFLAYOUTSTYLE_ExpandTab; |
| 1962 tr.iHorizontalScale = pPiece->iHorScale; | 1962 tr.iHorizontalScale = pPiece->iHorScale; |
| 1963 return TRUE; | 1963 return TRUE; |
| 1964 } | 1964 } |
| OLD | NEW |