Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(129)

Side by Side Diff: xfa/fxfa/parser/xfa_script_signaturepseudomodel.cpp

Issue 1846993002: Remove IXFA_* interfaces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/parser/xfa_script_resolveprocessor.cpp ('k') | xfa/include/fxfa/fxfa.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_script_signaturepseudomodel.h" 7 #include "xfa/fxfa/parser/xfa_script_signaturepseudomodel.h"
8 8
9 #include "xfa/fxfa/app/xfa_ffnotify.h"
9 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
10 #include "xfa/fxfa/parser/xfa_docdata.h" 11 #include "xfa/fxfa/parser/xfa_docdata.h"
11 #include "xfa/fxfa/parser/xfa_doclayout.h" 12 #include "xfa/fxfa/parser/xfa_doclayout.h"
12 #include "xfa/fxfa/parser/xfa_document.h" 13 #include "xfa/fxfa/parser/xfa_document.h"
13 #include "xfa/fxfa/parser/xfa_localemgr.h" 14 #include "xfa/fxfa/parser/xfa_localemgr.h"
14 #include "xfa/fxfa/parser/xfa_object.h" 15 #include "xfa/fxfa/parser/xfa_object.h"
15 #include "xfa/fxfa/parser/xfa_parser.h" 16 #include "xfa/fxfa/parser/xfa_parser.h"
17 #include "xfa/fxfa/parser/xfa_parser_imp.h"
16 #include "xfa/fxfa/parser/xfa_script.h" 18 #include "xfa/fxfa/parser/xfa_script.h"
19 #include "xfa/fxfa/parser/xfa_script_imp.h"
17 #include "xfa/fxfa/parser/xfa_utils.h" 20 #include "xfa/fxfa/parser/xfa_utils.h"
18 #include "xfa/fxjse/cfxjse_arguments.h" 21 #include "xfa/fxjse/cfxjse_arguments.h"
19 22
20 CScript_SignaturePseudoModel::CScript_SignaturePseudoModel( 23 CScript_SignaturePseudoModel::CScript_SignaturePseudoModel(
21 CXFA_Document* pDocument) 24 CXFA_Document* pDocument)
22 : CXFA_OrdinaryObject(pDocument, XFA_ELEMENT_SignaturePseudoModel) { 25 : CXFA_OrdinaryObject(pDocument, XFA_ELEMENT_SignaturePseudoModel) {
23 m_uScriptHash = XFA_HASHCODE_Signature; 26 m_uScriptHash = XFA_HASHCODE_Signature;
24 } 27 }
25 CScript_SignaturePseudoModel::~CScript_SignaturePseudoModel() {} 28 CScript_SignaturePseudoModel::~CScript_SignaturePseudoModel() {}
26 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Verify( 29 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Verify(
27 CFXJSE_Arguments* pArguments) { 30 CFXJSE_Arguments* pArguments) {
28 int32_t iLength = pArguments->GetLength(); 31 int32_t iLength = pArguments->GetLength();
29 if (iLength < 1 || iLength > 4) { 32 if (iLength < 1 || iLength > 4) {
30 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"verify"); 33 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"verify");
31 return; 34 return;
32 } 35 }
33 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 36 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
34 if (!pNotify) { 37 if (!pNotify) {
35 return; 38 return;
36 } 39 }
37 IXFA_Doc* hDoc = pNotify->GetHDOC(); 40 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
38 CXFA_Node* pNode = NULL; 41 CXFA_Node* pNode = NULL;
39 if (iLength >= 1) { 42 if (iLength >= 1) {
40 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); 43 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
41 } 44 }
42 int32_t bVerify = pNotify->GetDocProvider()->Verify(hDoc, pNode); 45 int32_t bVerify = pNotify->GetDocProvider()->Verify(hDoc, pNode);
43 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); 46 FXJSE_HVALUE hValue = pArguments->GetReturnValue();
44 if (hValue) { 47 if (hValue) {
45 FXJSE_Value_SetInteger(hValue, bVerify); 48 FXJSE_Value_SetInteger(hValue, bVerify);
46 } 49 }
47 } 50 }
48 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Sign( 51 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Sign(
49 CFXJSE_Arguments* pArguments) { 52 CFXJSE_Arguments* pArguments) {
50 int32_t iLength = pArguments->GetLength(); 53 int32_t iLength = pArguments->GetLength();
51 if (iLength < 3 || iLength > 7) { 54 if (iLength < 3 || iLength > 7) {
52 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sign"); 55 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sign");
53 return; 56 return;
54 } 57 }
55 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 58 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
56 if (!pNotify) { 59 if (!pNotify) {
57 return; 60 return;
58 } 61 }
59 IXFA_Doc* hDoc = pNotify->GetHDOC(); 62 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
60 CXFA_NodeList* pNodeList = NULL; 63 CXFA_NodeList* pNodeList = NULL;
61 CFX_WideString wsExpression; 64 CFX_WideString wsExpression;
62 CFX_WideString wsXMLIdent; 65 CFX_WideString wsXMLIdent;
63 if (iLength >= 1) { 66 if (iLength >= 1) {
64 pNodeList = (CXFA_NodeList*)pArguments->GetObject(0); 67 pNodeList = (CXFA_NodeList*)pArguments->GetObject(0);
65 } 68 }
66 if (iLength >= 2) { 69 if (iLength >= 2) {
67 CFX_ByteString bsExpression = pArguments->GetUTF8String(1); 70 CFX_ByteString bsExpression = pArguments->GetUTF8String(1);
68 wsExpression = 71 wsExpression =
69 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength()); 72 CFX_WideString::FromUTF8(bsExpression, bsExpression.GetLength());
70 } 73 }
71 if (iLength >= 3) { 74 if (iLength >= 3) {
72 CFX_ByteString bsXMLIdent = pArguments->GetUTF8String(2); 75 CFX_ByteString bsXMLIdent = pArguments->GetUTF8String(2);
73 wsXMLIdent = CFX_WideString::FromUTF8(bsXMLIdent, bsXMLIdent.GetLength()); 76 wsXMLIdent = CFX_WideString::FromUTF8(bsXMLIdent, bsXMLIdent.GetLength());
74 } 77 }
75 FX_BOOL bSign = pNotify->GetDocProvider()->Sign(hDoc, pNodeList, wsExpression, 78 FX_BOOL bSign = pNotify->GetDocProvider()->Sign(hDoc, pNodeList, wsExpression,
76 wsXMLIdent); 79 wsXMLIdent);
77 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); 80 FXJSE_HVALUE hValue = pArguments->GetReturnValue();
78 if (hValue) { 81 if (hValue) {
79 FXJSE_Value_SetBoolean(hValue, bSign); 82 FXJSE_Value_SetBoolean(hValue, bSign);
80 } 83 }
81 } 84 }
82 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Enumerate( 85 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Enumerate(
83 CFXJSE_Arguments* pArguments) { 86 CFXJSE_Arguments* pArguments) {
84 int32_t iLength = pArguments->GetLength(); 87 int32_t iLength = pArguments->GetLength();
85 if (iLength != 0) { 88 if (iLength != 0) {
86 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"enumerate"); 89 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"enumerate");
87 return; 90 return;
88 } 91 }
89 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 92 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
90 if (!pNotify) { 93 if (!pNotify) {
91 return; 94 return;
92 } 95 }
93 IXFA_Doc* hDoc = pNotify->GetHDOC(); 96 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
94 CXFA_NodeList* pList = pNotify->GetDocProvider()->Enumerate(hDoc); 97 CXFA_NodeList* pList = pNotify->GetDocProvider()->Enumerate(hDoc);
95 if (!pList) 98 if (!pList)
96 return; 99 return;
97 FXJSE_Value_Set(pArguments->GetReturnValue(), 100 FXJSE_Value_Set(pArguments->GetReturnValue(),
98 m_pDocument->GetScriptContext()->GetJSValueFromMap(pList)); 101 m_pDocument->GetScriptContext()->GetJSValueFromMap(pList));
99 } 102 }
100 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Clear( 103 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Clear(
101 CFXJSE_Arguments* pArguments) { 104 CFXJSE_Arguments* pArguments) {
102 int32_t iLength = pArguments->GetLength(); 105 int32_t iLength = pArguments->GetLength();
103 if (iLength < 1 || iLength > 2) { 106 if (iLength < 1 || iLength > 2) {
104 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clear"); 107 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clear");
105 return; 108 return;
106 } 109 }
107 IXFA_Notify* pNotify = m_pDocument->GetParser()->GetNotify(); 110 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
108 if (!pNotify) { 111 if (!pNotify) {
109 return; 112 return;
110 } 113 }
111 IXFA_Doc* hDoc = pNotify->GetHDOC(); 114 CXFA_FFDoc* hDoc = pNotify->GetHDOC();
112 CXFA_Node* pNode = NULL; 115 CXFA_Node* pNode = NULL;
113 FX_BOOL bClear = TRUE; 116 FX_BOOL bClear = TRUE;
114 if (iLength >= 1) { 117 if (iLength >= 1) {
115 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); 118 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
116 } 119 }
117 if (iLength >= 2) { 120 if (iLength >= 2) {
118 bClear = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; 121 bClear = pArguments->GetInt32(1) == 0 ? FALSE : TRUE;
119 } 122 }
120 FX_BOOL bFlag = pNotify->GetDocProvider()->Clear(hDoc, pNode, bClear); 123 FX_BOOL bFlag = pNotify->GetDocProvider()->Clear(hDoc, pNode, bClear);
121 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); 124 FXJSE_HVALUE hValue = pArguments->GetReturnValue();
122 if (hValue) { 125 if (hValue) {
123 FXJSE_Value_SetBoolean(hValue, bFlag); 126 FXJSE_Value_SetBoolean(hValue, bFlag);
124 } 127 }
125 } 128 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_script_resolveprocessor.cpp ('k') | xfa/include/fxfa/fxfa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698