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 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
772 pEnv->JS_docmailForm(NULL, 0, bUI, cTo.c_str(), cSubject.c_str(), cCc.c_str(), | 772 pEnv->JS_docmailForm(NULL, 0, bUI, cTo.c_str(), cSubject.c_str(), cCc.c_str(), |
773 cBcc.c_str(), cMsg.c_str()); | 773 cBcc.c_str(), cMsg.c_str()); |
774 pRuntime->EndBlock(); | 774 pRuntime->EndBlock(); |
775 | 775 |
776 return TRUE; | 776 return TRUE; |
777 } | 777 } |
778 | 778 |
779 FX_BOOL Document::author(IJS_Context* cc, | 779 FX_BOOL Document::author(IJS_Context* cc, |
780 CJS_PropValue& vp, | 780 CJS_PropValue& vp, |
781 CFX_WideString& sError) { | 781 CFX_WideString& sError) { |
782 ASSERT(m_pDocument != NULL); | |
783 | |
784 CPDF_Dictionary* pDictionary = | 782 CPDF_Dictionary* pDictionary = |
785 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); | 783 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); |
786 if (!pDictionary) | 784 if (!pDictionary) |
787 return FALSE; | 785 return FALSE; |
788 | 786 |
789 if (vp.IsGetting()) { | 787 if (vp.IsGetting()) { |
790 vp << pDictionary->GetUnicodeText("Author"); | 788 vp << pDictionary->GetUnicodeText("Author"); |
791 return TRUE; | 789 return TRUE; |
792 } else { | 790 } else { |
793 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) | 791 if (!m_pDocument->GetPermissions(FPDFPERM_MODIFY)) |
794 return FALSE; | 792 return FALSE; |
795 | 793 |
796 CFX_WideString csAuthor; | 794 CFX_WideString csAuthor; |
797 vp >> csAuthor; | 795 vp >> csAuthor; |
798 pDictionary->SetAtString("Author", PDF_EncodeText(csAuthor)); | 796 pDictionary->SetAtString("Author", PDF_EncodeText(csAuthor)); |
799 m_pDocument->SetChangeMark(); | 797 m_pDocument->SetChangeMark(); |
800 return TRUE; | 798 return TRUE; |
801 } | 799 } |
802 } | 800 } |
803 | 801 |
804 FX_BOOL Document::info(IJS_Context* cc, | 802 FX_BOOL Document::info(IJS_Context* cc, |
805 CJS_PropValue& vp, | 803 CJS_PropValue& vp, |
806 CFX_WideString& sError) { | 804 CFX_WideString& sError) { |
807 ASSERT(m_pDocument != NULL); | |
808 | |
809 CPDF_Dictionary* pDictionary = | 805 CPDF_Dictionary* pDictionary = |
810 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); | 806 m_pDocument->GetDocument()->GetPDFDoc()->GetInfo(); |
811 if (!pDictionary) | 807 if (!pDictionary) |
812 return FALSE; | 808 return FALSE; |
813 | 809 |
814 CFX_WideString cwAuthor = pDictionary->GetUnicodeText("Author"); | 810 CFX_WideString cwAuthor = pDictionary->GetUnicodeText("Author"); |
815 CFX_WideString cwTitle = pDictionary->GetUnicodeText("Title"); | 811 CFX_WideString cwTitle = pDictionary->GetUnicodeText("Title"); |
816 CFX_WideString cwSubject = pDictionary->GetUnicodeText("Subject"); | 812 CFX_WideString cwSubject = pDictionary->GetUnicodeText("Subject"); |
817 CFX_WideString cwKeywords = pDictionary->GetUnicodeText("Keywords"); | 813 CFX_WideString cwKeywords = pDictionary->GetUnicodeText("Keywords"); |
818 CFX_WideString cwCreator = pDictionary->GetUnicodeText("Creator"); | 814 CFX_WideString cwCreator = pDictionary->GetUnicodeText("Creator"); |
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1825 CFX_DWordArray DelArray; | 1821 CFX_DWordArray DelArray; |
1826 | 1822 |
1827 for (int j = DelArray.GetSize() - 1; j >= 0; j--) { | 1823 for (int j = DelArray.GetSize() - 1; j >= 0; j--) { |
1828 m_DelayData.RemoveAt(DelArray[j]); | 1824 m_DelayData.RemoveAt(DelArray[j]); |
1829 } | 1825 } |
1830 } | 1826 } |
1831 | 1827 |
1832 CJS_Document* Document::GetCJSDoc() const { | 1828 CJS_Document* Document::GetCJSDoc() const { |
1833 return static_cast<CJS_Document*>(m_pJSObject); | 1829 return static_cast<CJS_Document*>(m_pJSObject); |
1834 } | 1830 } |
OLD | NEW |