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