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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 FXJS_PutObjectString(isolate, pObj, L"Subject", cwSubject.c_str()); | 793 FXJS_PutObjectString(isolate, pObj, L"Subject", cwSubject.c_str()); |
794 FXJS_PutObjectString(isolate, pObj, L"Keywords", cwKeywords.c_str()); | 794 FXJS_PutObjectString(isolate, pObj, L"Keywords", cwKeywords.c_str()); |
795 FXJS_PutObjectString(isolate, pObj, L"Creator", cwCreator.c_str()); | 795 FXJS_PutObjectString(isolate, pObj, L"Creator", cwCreator.c_str()); |
796 FXJS_PutObjectString(isolate, pObj, L"Producer", cwProducer.c_str()); | 796 FXJS_PutObjectString(isolate, pObj, L"Producer", cwProducer.c_str()); |
797 FXJS_PutObjectString(isolate, pObj, L"CreationDate", | 797 FXJS_PutObjectString(isolate, pObj, L"CreationDate", |
798 cwCreationDate.c_str()); | 798 cwCreationDate.c_str()); |
799 FXJS_PutObjectString(isolate, pObj, L"ModDate", cwModDate.c_str()); | 799 FXJS_PutObjectString(isolate, pObj, L"ModDate", cwModDate.c_str()); |
800 FXJS_PutObjectString(isolate, pObj, L"Trapped", cwTrapped.c_str()); | 800 FXJS_PutObjectString(isolate, pObj, L"Trapped", cwTrapped.c_str()); |
801 | 801 |
802 // It's to be compatible to non-standard info dictionary. | 802 // It's to be compatible to non-standard info dictionary. |
803 FX_POSITION pos = pDictionary->GetStartPos(); | 803 for (const auto& it : *pDictionary) { |
804 while (pos) { | 804 const CFX_ByteString& bsKey = it.first; |
805 CFX_ByteString bsKey; | 805 CPDF_Object* pValueObj = it.second; |
806 CPDF_Object* pValueObj = pDictionary->GetNextElement(pos, bsKey); | |
807 CFX_WideString wsKey = CFX_WideString::FromUTF8(bsKey, bsKey.GetLength()); | 806 CFX_WideString wsKey = CFX_WideString::FromUTF8(bsKey, bsKey.GetLength()); |
808 | 807 |
809 if (pValueObj->IsString() || pValueObj->IsName()) { | 808 if (pValueObj->IsString() || pValueObj->IsName()) { |
810 FXJS_PutObjectString(isolate, pObj, wsKey.c_str(), | 809 FXJS_PutObjectString(isolate, pObj, wsKey.c_str(), |
811 pValueObj->GetUnicodeText().c_str()); | 810 pValueObj->GetUnicodeText().c_str()); |
812 } else if (pValueObj->IsNumber()) { | 811 } else if (pValueObj->IsNumber()) { |
813 FXJS_PutObjectNumber(isolate, pObj, wsKey.c_str(), | 812 FXJS_PutObjectNumber(isolate, pObj, wsKey.c_str(), |
814 (float)pValueObj->GetNumber()); | 813 (float)pValueObj->GetNumber()); |
815 } else if (pValueObj->IsBoolean()) { | 814 } else if (pValueObj->IsBoolean()) { |
816 FXJS_PutObjectBoolean(isolate, pObj, wsKey.c_str(), | 815 FXJS_PutObjectBoolean(isolate, pObj, wsKey.c_str(), |
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1695 CJS_DelayData* pData = DelayDataForFieldAndControlIndex.GetAt(i); | 1694 CJS_DelayData* pData = DelayDataForFieldAndControlIndex.GetAt(i); |
1696 Field::DoDelay(m_pDocument, pData); | 1695 Field::DoDelay(m_pDocument, pData); |
1697 DelayDataForFieldAndControlIndex.SetAt(i, NULL); | 1696 DelayDataForFieldAndControlIndex.SetAt(i, NULL); |
1698 delete pData; | 1697 delete pData; |
1699 } | 1698 } |
1700 } | 1699 } |
1701 | 1700 |
1702 CJS_Document* Document::GetCJSDoc() const { | 1701 CJS_Document* Document::GetCJSDoc() const { |
1703 return static_cast<CJS_Document*>(m_pJSObject); | 1702 return static_cast<CJS_Document*>(m_pJSObject); |
1704 } | 1703 } |
OLD | NEW |