| 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 "Document.h" | 7 #include "Document.h" |
| 8 | 8 |
| 9 #include "Field.h" | 9 #include "Field.h" |
| 10 #include "Icon.h" | 10 #include "Icon.h" |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 FXJS_PutObjectString(isolate, pObj, L"Subject", cwSubject.c_str()); | 783 FXJS_PutObjectString(isolate, pObj, L"Subject", cwSubject.c_str()); |
| 784 FXJS_PutObjectString(isolate, pObj, L"Keywords", cwKeywords.c_str()); | 784 FXJS_PutObjectString(isolate, pObj, L"Keywords", cwKeywords.c_str()); |
| 785 FXJS_PutObjectString(isolate, pObj, L"Creator", cwCreator.c_str()); | 785 FXJS_PutObjectString(isolate, pObj, L"Creator", cwCreator.c_str()); |
| 786 FXJS_PutObjectString(isolate, pObj, L"Producer", cwProducer.c_str()); | 786 FXJS_PutObjectString(isolate, pObj, L"Producer", cwProducer.c_str()); |
| 787 FXJS_PutObjectString(isolate, pObj, L"CreationDate", | 787 FXJS_PutObjectString(isolate, pObj, L"CreationDate", |
| 788 cwCreationDate.c_str()); | 788 cwCreationDate.c_str()); |
| 789 FXJS_PutObjectString(isolate, pObj, L"ModDate", cwModDate.c_str()); | 789 FXJS_PutObjectString(isolate, pObj, L"ModDate", cwModDate.c_str()); |
| 790 FXJS_PutObjectString(isolate, pObj, L"Trapped", cwTrapped.c_str()); | 790 FXJS_PutObjectString(isolate, pObj, L"Trapped", cwTrapped.c_str()); |
| 791 | 791 |
| 792 // It's to be compatible to non-standard info dictionary. | 792 // It's to be compatible to non-standard info dictionary. |
| 793 FX_POSITION pos = pDictionary->GetStartPos(); | 793 for (const auto& it : *pDictionary) { |
| 794 while (pos) { | 794 const CFX_ByteString& bsKey = it.first; |
| 795 CFX_ByteString bsKey; | 795 CPDF_Object* pValueObj = it.second; |
| 796 CPDF_Object* pValueObj = pDictionary->GetNextElement(pos, bsKey); | |
| 797 CFX_WideString wsKey = CFX_WideString::FromUTF8(bsKey, bsKey.GetLength()); | 796 CFX_WideString wsKey = CFX_WideString::FromUTF8(bsKey, bsKey.GetLength()); |
| 798 | 797 |
| 799 if (pValueObj->IsString() || pValueObj->IsName()) { | 798 if (pValueObj->IsString() || pValueObj->IsName()) { |
| 800 FXJS_PutObjectString(isolate, pObj, wsKey.c_str(), | 799 FXJS_PutObjectString(isolate, pObj, wsKey.c_str(), |
| 801 pValueObj->GetUnicodeText().c_str()); | 800 pValueObj->GetUnicodeText().c_str()); |
| 802 } else if (pValueObj->IsNumber()) { | 801 } else if (pValueObj->IsNumber()) { |
| 803 FXJS_PutObjectNumber(isolate, pObj, wsKey.c_str(), | 802 FXJS_PutObjectNumber(isolate, pObj, wsKey.c_str(), |
| 804 (float)pValueObj->GetNumber()); | 803 (float)pValueObj->GetNumber()); |
| 805 } else if (pValueObj->IsBoolean()) { | 804 } else if (pValueObj->IsBoolean()) { |
| 806 FXJS_PutObjectBoolean(isolate, pObj, wsKey.c_str(), | 805 FXJS_PutObjectBoolean(isolate, pObj, wsKey.c_str(), |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1643 CJS_DelayData* pData = DelayDataForFieldAndControlIndex.GetAt(i); | 1642 CJS_DelayData* pData = DelayDataForFieldAndControlIndex.GetAt(i); |
| 1644 Field::DoDelay(m_pDocument, pData); | 1643 Field::DoDelay(m_pDocument, pData); |
| 1645 DelayDataForFieldAndControlIndex.SetAt(i, NULL); | 1644 DelayDataForFieldAndControlIndex.SetAt(i, NULL); |
| 1646 delete pData; | 1645 delete pData; |
| 1647 } | 1646 } |
| 1648 } | 1647 } |
| 1649 | 1648 |
| 1650 CJS_Document* Document::GetCJSDoc() const { | 1649 CJS_Document* Document::GetCJSDoc() const { |
| 1651 return static_cast<CJS_Document*>(m_pJSObject); | 1650 return static_cast<CJS_Document*>(m_pJSObject); |
| 1652 } | 1651 } |
| OLD | NEW |