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_document_serialize.h" | 7 #include "xfa/fxfa/parser/xfa_document_serialize.h" |
8 | 8 |
9 #include "xfa/fde/xml/fde_xml_imp.h" | 9 #include "xfa/fde/xml/fde_xml_imp.h" |
10 #include "xfa/fgas/crt/fgas_codepage.h" | 10 #include "xfa/fgas/crt/fgas_codepage.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 pRawValueNode->GetClassID() != XFA_ELEMENT_Sharptext && | 235 pRawValueNode->GetClassID() != XFA_ELEMENT_Sharptext && |
236 pRawValueNode->GetClassID() != XFA_ELEMENT_Sharpxml) { | 236 pRawValueNode->GetClassID() != XFA_ELEMENT_Sharpxml) { |
237 pRawValueNode = pRawValueNode->GetNodeItem(XFA_NODEITEM_NextSibling); | 237 pRawValueNode = pRawValueNode->GetNodeItem(XFA_NODEITEM_NextSibling); |
238 } | 238 } |
239 if (!pRawValueNode) { | 239 if (!pRawValueNode) { |
240 break; | 240 break; |
241 } | 241 } |
242 CFX_WideString wsContentType; | 242 CFX_WideString wsContentType; |
243 pNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); | 243 pNode->GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); |
244 if (pRawValueNode->GetClassID() == XFA_ELEMENT_SharpxHTML && | 244 if (pRawValueNode->GetClassID() == XFA_ELEMENT_SharpxHTML && |
245 wsContentType.Equal(FX_WSTRC(L"text/html"))) { | 245 wsContentType == FX_WSTRC(L"text/html")) { |
246 CFDE_XMLNode* pExDataXML = pNode->GetXMLMappingNode(); | 246 CFDE_XMLNode* pExDataXML = pNode->GetXMLMappingNode(); |
247 if (!pExDataXML) { | 247 if (!pExDataXML) { |
248 break; | 248 break; |
249 } | 249 } |
250 CFDE_XMLNode* pRichTextXML = | 250 CFDE_XMLNode* pRichTextXML = |
251 pExDataXML->GetNodeItem(CFDE_XMLNode::FirstChild); | 251 pExDataXML->GetNodeItem(CFDE_XMLNode::FirstChild); |
252 if (!pRichTextXML) { | 252 if (!pRichTextXML) { |
253 break; | 253 break; |
254 } | 254 } |
255 IFX_MemoryStream* pMemStream = FX_CreateMemoryStream(TRUE); | 255 IFX_MemoryStream* pMemStream = FX_CreateMemoryStream(TRUE); |
256 IFX_Stream* pTempStream = IFX_Stream::CreateStream( | 256 IFX_Stream* pTempStream = IFX_Stream::CreateStream( |
257 (IFX_FileWrite*)pMemStream, FX_STREAMACCESS_Text | | 257 (IFX_FileWrite*)pMemStream, FX_STREAMACCESS_Text | |
258 FX_STREAMACCESS_Write | | 258 FX_STREAMACCESS_Write | |
259 FX_STREAMACCESS_Append); | 259 FX_STREAMACCESS_Append); |
260 pTempStream->SetCodePage(FX_CODEPAGE_UTF8); | 260 pTempStream->SetCodePage(FX_CODEPAGE_UTF8); |
261 pRichTextXML->SaveXMLNode(pTempStream); | 261 pRichTextXML->SaveXMLNode(pTempStream); |
262 wsChildren += CFX_WideString::FromUTF8( | 262 wsChildren += CFX_WideString::FromUTF8( |
263 (const FX_CHAR*)pMemStream->GetBuffer(), pMemStream->GetSize()); | 263 (const FX_CHAR*)pMemStream->GetBuffer(), pMemStream->GetSize()); |
264 pTempStream->Release(); | 264 pTempStream->Release(); |
265 pMemStream->Release(); | 265 pMemStream->Release(); |
266 } else if (pRawValueNode->GetClassID() == XFA_ELEMENT_Sharpxml && | 266 } else if (pRawValueNode->GetClassID() == XFA_ELEMENT_Sharpxml && |
267 wsContentType.Equal(FX_WSTRC(L"text/xml"))) { | 267 wsContentType == FX_WSTRC(L"text/xml")) { |
268 CFX_WideString wsRawValue; | 268 CFX_WideString wsRawValue; |
269 pRawValueNode->GetAttribute(XFA_ATTRIBUTE_Value, wsRawValue, FALSE); | 269 pRawValueNode->GetAttribute(XFA_ATTRIBUTE_Value, wsRawValue, FALSE); |
270 if (wsRawValue.IsEmpty()) { | 270 if (wsRawValue.IsEmpty()) { |
271 break; | 271 break; |
272 } | 272 } |
273 CFX_WideStringArray wsSelTextArray; | 273 CFX_WideStringArray wsSelTextArray; |
274 int32_t iStart = 0; | 274 int32_t iStart = 0; |
275 int32_t iEnd = wsRawValue.Find(L'\n', iStart); | 275 int32_t iEnd = wsRawValue.Find(L'\n', iStart); |
276 iEnd = (iEnd == -1) ? wsRawValue.GetLength() : iEnd; | 276 iEnd = (iEnd == -1) ? wsRawValue.GetLength() : iEnd; |
277 while (iEnd >= iStart) { | 277 while (iEnd >= iStart) { |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 pXMLElement->RemoveAttribute(L"xfa:dataNode"); | 577 pXMLElement->RemoveAttribute(L"xfa:dataNode"); |
578 } | 578 } |
579 } else { | 579 } else { |
580 CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); | 580 CFDE_XMLNode* pXMLNode = pDataNode->GetXMLMappingNode(); |
581 FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element); | 581 FXSYS_assert(pXMLNode->GetType() == FDE_XMLNODE_Element); |
582 static_cast<CFDE_XMLElement*>(pXMLNode) | 582 static_cast<CFDE_XMLElement*>(pXMLNode) |
583 ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); | 583 ->SetString(FX_WSTRC(L"xfa:dataNode"), FX_WSTRC(L"dataGroup")); |
584 } | 584 } |
585 } | 585 } |
586 } | 586 } |
OLD | NEW |