| 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 CFX_WideString wsValue; | 310 CFX_WideString wsValue; |
| 311 pXMLElement->GetString(FX_WSTRC(L"style").raw_str(), 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 |
| 320 int32_t CXFA_TextParser::GetVAlgin(CXFA_TextProvider* pTextProvider) const { | 321 int32_t CXFA_TextParser::GetVAlgin(CXFA_TextProvider* pTextProvider) const { |
| 321 int32_t iAlign = XFA_ATTRIBUTEENUM_Top; | |
| 322 CXFA_Para para = pTextProvider->GetParaNode(); | 322 CXFA_Para para = pTextProvider->GetParaNode(); |
| 323 if (para) { | 323 return para ? para.GetVerticalAlign() : XFA_ATTRIBUTEENUM_Top; |
| 324 iAlign = para.GetVerticalAlign(); | |
| 325 } | |
| 326 return iAlign; | |
| 327 } | 324 } |
| 325 |
| 328 FX_FLOAT CXFA_TextParser::GetTabInterval(IFDE_CSSComputedStyle* pStyle) const { | 326 FX_FLOAT CXFA_TextParser::GetTabInterval(IFDE_CSSComputedStyle* pStyle) const { |
| 329 CFX_WideString wsValue; | 327 CFX_WideString wsValue; |
| 330 if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"tab-interval"), wsValue)) { | 328 if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"tab-interval"), wsValue)) |
| 331 CXFA_Measurement ms(wsValue); | 329 return CXFA_Measurement(wsValue.AsWideStringC()).ToUnit(XFA_UNIT_Pt); |
| 332 return ms.ToUnit(XFA_UNIT_Pt); | |
| 333 } | |
| 334 return 36; | 330 return 36; |
| 335 } | 331 } |
| 332 |
| 336 int32_t CXFA_TextParser::CountTabs(IFDE_CSSComputedStyle* pStyle) const { | 333 int32_t CXFA_TextParser::CountTabs(IFDE_CSSComputedStyle* pStyle) const { |
| 337 CFX_WideString wsValue; | 334 CFX_WideString wsValue; |
| 338 if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"xfa-tab-count"), wsValue)) { | 335 if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"xfa-tab-count"), wsValue)) |
| 339 return wsValue.GetInteger(); | 336 return wsValue.GetInteger(); |
| 340 } | |
| 341 return 0; | 337 return 0; |
| 342 } | 338 } |
| 339 |
| 343 FX_BOOL CXFA_TextParser::IsSpaceRun(IFDE_CSSComputedStyle* pStyle) const { | 340 FX_BOOL CXFA_TextParser::IsSpaceRun(IFDE_CSSComputedStyle* pStyle) const { |
| 344 CFX_WideString wsValue; | 341 CFX_WideString wsValue; |
| 345 if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"xfa-spacerun"), wsValue)) { | 342 if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"xfa-spacerun"), wsValue)) { |
| 346 wsValue.MakeLower(); | 343 wsValue.MakeLower(); |
| 347 return wsValue == FX_WSTRC(L"yes"); | 344 return wsValue == FX_WSTRC(L"yes"); |
| 348 } | 345 } |
| 349 return FALSE; | 346 return FALSE; |
| 350 } | 347 } |
| 351 IFX_Font* CXFA_TextParser::GetFont(CXFA_TextProvider* pTextProvider, | 348 IFX_Font* CXFA_TextParser::GetFont(CXFA_TextProvider* pTextProvider, |
| 352 IFDE_CSSComputedStyle* pStyle) const { | 349 IFDE_CSSComputedStyle* pStyle) const { |
| (...skipping 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1994 tr.iLength = iLength; | 1991 tr.iLength = iLength; |
| 1995 tr.fFontSize = pPiece->fFontSize; | 1992 tr.fFontSize = pPiece->fFontSize; |
| 1996 tr.iBidiLevel = pPiece->iBidiLevel; | 1993 tr.iBidiLevel = pPiece->iBidiLevel; |
| 1997 tr.iCharRotation = 0; | 1994 tr.iCharRotation = 0; |
| 1998 tr.wLineBreakChar = L'\n'; | 1995 tr.wLineBreakChar = L'\n'; |
| 1999 tr.iVerticalScale = pPiece->iVerScale; | 1996 tr.iVerticalScale = pPiece->iVerScale; |
| 2000 tr.dwLayoutStyles = FX_RTFLAYOUTSTYLE_ExpandTab; | 1997 tr.dwLayoutStyles = FX_RTFLAYOUTSTYLE_ExpandTab; |
| 2001 tr.iHorizontalScale = pPiece->iHorScale; | 1998 tr.iHorizontalScale = pPiece->iHorScale; |
| 2002 return TRUE; | 1999 return TRUE; |
| 2003 } | 2000 } |
| OLD | NEW |