| 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/parser/xfa_utils.h" | 7 #include "xfa/fxfa/parser/xfa_utils.h" |
| 8 | 8 |
| 9 #include "core/fxcrt/include/fx_ext.h" | 9 #include "core/fxcrt/include/fx_ext.h" |
| 10 #include "xfa/fde/xml/fde_xml_imp.h" | 10 #include "xfa/fde/xml/fde_xml_imp.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode, | 190 void XFA_GetPlainTextFromRichText(CFDE_XMLNode* pXMLNode, |
| 191 CFX_WideString& wsPlainText) { | 191 CFX_WideString& wsPlainText) { |
| 192 if (pXMLNode == NULL) { | 192 if (pXMLNode == NULL) { |
| 193 return; | 193 return; |
| 194 } | 194 } |
| 195 switch (pXMLNode->GetType()) { | 195 switch (pXMLNode->GetType()) { |
| 196 case FDE_XMLNODE_Element: { | 196 case FDE_XMLNODE_Element: { |
| 197 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); | 197 CFDE_XMLElement* pXMLElement = static_cast<CFDE_XMLElement*>(pXMLNode); |
| 198 CFX_WideString wsTag; | 198 CFX_WideString wsTag; |
| 199 pXMLElement->GetLocalTagName(wsTag); | 199 pXMLElement->GetLocalTagName(wsTag); |
| 200 uint32_t uTag = FX_HashCode_String_GetW(wsTag, wsTag.GetLength(), TRUE); | 200 uint32_t uTag = |
| 201 FX_HashCode_String_GetW(wsTag.c_str(), wsTag.GetLength(), TRUE); |
| 201 if (uTag == 0x0001f714) { | 202 if (uTag == 0x0001f714) { |
| 202 wsPlainText += L"\n"; | 203 wsPlainText += L"\n"; |
| 203 } else if (uTag == 0x00000070) { | 204 } else if (uTag == 0x00000070) { |
| 204 if (!wsPlainText.IsEmpty()) { | 205 if (!wsPlainText.IsEmpty()) { |
| 205 wsPlainText += L"\n"; | 206 wsPlainText += L"\n"; |
| 206 } | 207 } |
| 207 } else if (uTag == 0xa48ac63) { | 208 } else if (uTag == 0xa48ac63) { |
| 208 if (!wsPlainText.IsEmpty() && | 209 if (!wsPlainText.IsEmpty() && |
| 209 wsPlainText[wsPlainText.GetLength() - 1] != '\n') { | 210 wsPlainText[wsPlainText.GetLength() - 1] != '\n') { |
| 210 wsPlainText += L"\n"; | 211 wsPlainText += L"\n"; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 0.0000000000000001}; | 315 0.0000000000000001}; |
| 315 FX_DOUBLE XFA_WideStringToDouble(const CFX_WideString& wsStringVal) { | 316 FX_DOUBLE XFA_WideStringToDouble(const CFX_WideString& wsStringVal) { |
| 316 CFX_WideString wsValue = wsStringVal; | 317 CFX_WideString wsValue = wsStringVal; |
| 317 wsValue.TrimLeft(); | 318 wsValue.TrimLeft(); |
| 318 wsValue.TrimRight(); | 319 wsValue.TrimRight(); |
| 319 int64_t nIntegral = 0; | 320 int64_t nIntegral = 0; |
| 320 uint32_t dwFractional = 0; | 321 uint32_t dwFractional = 0; |
| 321 int32_t nExponent = 0; | 322 int32_t nExponent = 0; |
| 322 int32_t cc = 0; | 323 int32_t cc = 0; |
| 323 FX_BOOL bNegative = FALSE, bExpSign = FALSE; | 324 FX_BOOL bNegative = FALSE, bExpSign = FALSE; |
| 324 const FX_WCHAR* str = (const FX_WCHAR*)wsValue; | 325 const FX_WCHAR* str = wsValue.c_str(); |
| 325 int32_t len = wsValue.GetLength(); | 326 int32_t len = wsValue.GetLength(); |
| 326 if (str[0] == '+') { | 327 if (str[0] == '+') { |
| 327 cc++; | 328 cc++; |
| 328 } else if (str[0] == '-') { | 329 } else if (str[0] == '-') { |
| 329 bNegative = TRUE; | 330 bNegative = TRUE; |
| 330 cc++; | 331 cc++; |
| 331 } | 332 } |
| 332 int32_t nIntegralLen = 0; | 333 int32_t nIntegralLen = 0; |
| 333 while (cc < len) { | 334 while (cc < len) { |
| 334 if (str[cc] == '.' || str[cc] == 'E' || str[cc] == 'e' || | 335 if (str[cc] == '.' || str[cc] == 'E' || str[cc] == 'e' || |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 FX_DOUBLE XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal) { | 395 FX_DOUBLE XFA_ByteStringToDouble(const CFX_ByteStringC& szStringVal) { |
| 395 CFX_WideString wsValue = CFX_WideString::FromUTF8(szStringVal); | 396 CFX_WideString wsValue = CFX_WideString::FromUTF8(szStringVal); |
| 396 return XFA_WideStringToDouble(wsValue); | 397 return XFA_WideStringToDouble(wsValue); |
| 397 } | 398 } |
| 398 | 399 |
| 399 int32_t XFA_MapRotation(int32_t nRotation) { | 400 int32_t XFA_MapRotation(int32_t nRotation) { |
| 400 nRotation = nRotation % 360; | 401 nRotation = nRotation % 360; |
| 401 nRotation = nRotation < 0 ? nRotation + 360 : nRotation; | 402 nRotation = nRotation < 0 ? nRotation + 360 : nRotation; |
| 402 return nRotation; | 403 return nRotation; |
| 403 } | 404 } |
| OLD | NEW |