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 "fpdfsdk/javascript/Document.h" | 7 #include "fpdfsdk/javascript/Document.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 JS_STATIC_PROP_ENTRY(mouseX) | 84 JS_STATIC_PROP_ENTRY(mouseX) |
85 JS_STATIC_PROP_ENTRY(mouseY) | 85 JS_STATIC_PROP_ENTRY(mouseY) |
86 JS_STATIC_PROP_ENTRY(numFields) | 86 JS_STATIC_PROP_ENTRY(numFields) |
87 JS_STATIC_PROP_ENTRY(numPages) | 87 JS_STATIC_PROP_ENTRY(numPages) |
88 JS_STATIC_PROP_ENTRY(pageNum) | 88 JS_STATIC_PROP_ENTRY(pageNum) |
89 JS_STATIC_PROP_ENTRY(pageWindowRect) | 89 JS_STATIC_PROP_ENTRY(pageWindowRect) |
90 JS_STATIC_PROP_ENTRY(path) | 90 JS_STATIC_PROP_ENTRY(path) |
91 JS_STATIC_PROP_ENTRY(producer) | 91 JS_STATIC_PROP_ENTRY(producer) |
92 JS_STATIC_PROP_ENTRY(subject) | 92 JS_STATIC_PROP_ENTRY(subject) |
93 JS_STATIC_PROP_ENTRY(title) | 93 JS_STATIC_PROP_ENTRY(title) |
| 94 JS_STATIC_PROP_ENTRY(URL) |
94 JS_STATIC_PROP_ENTRY(zoom) | 95 JS_STATIC_PROP_ENTRY(zoom) |
95 JS_STATIC_PROP_ENTRY(zoomType) | 96 JS_STATIC_PROP_ENTRY(zoomType) |
96 END_JS_STATIC_PROP() | 97 END_JS_STATIC_PROP() |
97 | 98 |
98 BEGIN_JS_STATIC_METHOD(CJS_Document) | 99 BEGIN_JS_STATIC_METHOD(CJS_Document) |
99 JS_STATIC_METHOD_ENTRY(addAnnot) | 100 JS_STATIC_METHOD_ENTRY(addAnnot) |
100 JS_STATIC_METHOD_ENTRY(addField) | 101 JS_STATIC_METHOD_ENTRY(addField) |
101 JS_STATIC_METHOD_ENTRY(addLink) | 102 JS_STATIC_METHOD_ENTRY(addLink) |
102 JS_STATIC_METHOD_ENTRY(addIcon) | 103 JS_STATIC_METHOD_ENTRY(addIcon) |
103 JS_STATIC_METHOD_ENTRY(calculateNow) | 104 JS_STATIC_METHOD_ENTRY(calculateNow) |
(...skipping 793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 CFX_WideString& sError) { | 898 CFX_WideString& sError) { |
898 return TRUE; | 899 return TRUE; |
899 } | 900 } |
900 | 901 |
901 FX_BOOL Document::mouseY(IJS_Context* cc, | 902 FX_BOOL Document::mouseY(IJS_Context* cc, |
902 CJS_PropValue& vp, | 903 CJS_PropValue& vp, |
903 CFX_WideString& sError) { | 904 CFX_WideString& sError) { |
904 return TRUE; | 905 return TRUE; |
905 } | 906 } |
906 | 907 |
| 908 FX_BOOL Document::URL(IJS_Context* cc, |
| 909 CJS_PropValue& vp, |
| 910 CFX_WideString& sError) { |
| 911 if (vp.IsSetting()) { |
| 912 CJS_Context* pContext = static_cast<CJS_Context*>(cc); |
| 913 sError = JSGetStringFromID(pContext, IDS_STRING_JSREADONLY); |
| 914 return FALSE; |
| 915 } |
| 916 vp << m_pDocument->GetPath(); |
| 917 return TRUE; |
| 918 } |
| 919 |
907 FX_BOOL Document::baseURL(IJS_Context* cc, | 920 FX_BOOL Document::baseURL(IJS_Context* cc, |
908 CJS_PropValue& vp, | 921 CJS_PropValue& vp, |
909 CFX_WideString& sError) { | 922 CFX_WideString& sError) { |
910 if (vp.IsGetting()) { | 923 if (vp.IsGetting()) { |
911 vp << m_cwBaseURL; | 924 vp << m_cwBaseURL; |
912 } else { | 925 } else { |
913 vp >> m_cwBaseURL; | 926 vp >> m_cwBaseURL; |
914 } | 927 } |
915 return TRUE; | 928 return TRUE; |
916 } | 929 } |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1470 } | 1483 } |
1471 } | 1484 } |
1472 | 1485 |
1473 for (const auto& pData : DelayDataForFieldAndControlIndex) | 1486 for (const auto& pData : DelayDataForFieldAndControlIndex) |
1474 Field::DoDelay(m_pDocument, pData.get()); | 1487 Field::DoDelay(m_pDocument, pData.get()); |
1475 } | 1488 } |
1476 | 1489 |
1477 CJS_Document* Document::GetCJSDoc() const { | 1490 CJS_Document* Document::GetCJSDoc() const { |
1478 return static_cast<CJS_Document*>(m_pJSObject); | 1491 return static_cast<CJS_Document*>(m_pJSObject); |
1479 } | 1492 } |
OLD | NEW |