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

Side by Side Diff: fpdfsdk/fpdfxfa/fpdfxfa_doc.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 | « fpdfsdk/fpdfxfa/fpdfxfa_app.cpp ('k') | fpdfsdk/fpdfxfa/fpdfxfa_page.cpp » ('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 "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
8 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" 8 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
9 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" 9 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h"
11 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h" 11 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h"
12 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" 12 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h"
13 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h" 13 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h"
14 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h" 14 #include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h"
15 #include "fpdfsdk/include/fsdk_define.h" 15 #include "fpdfsdk/include/fsdk_define.h"
16 #include "fpdfsdk/include/fsdk_mgr.h" 16 #include "fpdfsdk/include/fsdk_mgr.h"
17 #include "fpdfsdk/javascript/ijs_runtime.h" 17 #include "fpdfsdk/javascript/ijs_runtime.h"
18 #include "public/fpdf_formfill.h" 18 #include "public/fpdf_formfill.h"
19 #include "xfa/include/fxfa/xfa_ffapp.h"
20 #include "xfa/include/fxfa/xfa_ffdoc.h"
21 #include "xfa/include/fxfa/xfa_ffdocview.h"
22 #include "xfa/include/fxfa/xfa_ffpageview.h"
19 23
20 #define IDS_XFA_Validate_Input \ 24 #define IDS_XFA_Validate_Input \
21 "At least one required field was empty. Please fill in the required " \ 25 "At least one required field was empty. Please fill in the required " \
22 "fields\r\n(highlighted) before continuing." 26 "fields\r\n(highlighted) before continuing."
23 27
24 // submit 28 // submit
25 #define FXFA_CONFIG 0x00000001 29 #define FXFA_CONFIG 0x00000001
26 #define FXFA_TEMPLATE 0x00000010 30 #define FXFA_TEMPLATE 0x00000010
27 #define FXFA_LOCALESET 0x00000100 31 #define FXFA_LOCALESET 0x00000100
28 #define FXFA_DATASETS 0x00001000 32 #define FXFA_DATASETS 0x00001000
(...skipping 17 matching lines...) Expand all
46 m_pXFADocView(nullptr), 50 m_pXFADocView(nullptr),
47 m_pApp(pProvider), 51 m_pApp(pProvider),
48 m_pJSContext(nullptr), 52 m_pJSContext(nullptr),
49 m_nLoadStatus(FXFA_LOADSTATUS_PRELOAD), 53 m_nLoadStatus(FXFA_LOADSTATUS_PRELOAD),
50 m_nPageCount(0) {} 54 m_nPageCount(0) {}
51 55
52 CPDFXFA_Document::~CPDFXFA_Document() { 56 CPDFXFA_Document::~CPDFXFA_Document() {
53 m_nLoadStatus = FXFA_LOADSTATUS_CLOSING; 57 m_nLoadStatus = FXFA_LOADSTATUS_CLOSING;
54 58
55 if (m_pXFADoc) { 59 if (m_pXFADoc) {
56 IXFA_App* pApp = m_pApp->GetXFAApp(); 60 CXFA_FFApp* pApp = m_pApp->GetXFAApp();
57 if (pApp) { 61 if (pApp) {
58 IXFA_DocHandler* pDocHandler = pApp->GetDocHandler(); 62 CXFA_FFDocHandler* pDocHandler = pApp->GetDocHandler();
59 if (pDocHandler) { 63 if (pDocHandler) {
60 CloseXFADoc(pDocHandler); 64 CloseXFADoc(pDocHandler);
61 } 65 }
62 } 66 }
63 delete m_pXFADoc; 67 delete m_pXFADoc;
64 } 68 }
65 if (m_pJSContext && m_pSDKDoc && m_pSDKDoc->GetEnv()) 69 if (m_pJSContext && m_pSDKDoc && m_pSDKDoc->GetEnv())
66 m_pSDKDoc->GetEnv()->GetJSRuntime()->ReleaseContext(m_pJSContext); 70 m_pSDKDoc->GetEnv()->GetJSRuntime()->ReleaseContext(m_pJSContext);
67 delete m_pSDKDoc; 71 delete m_pSDKDoc;
68 if (m_pPDFDoc) { 72 if (m_pPDFDoc) {
69 CPDF_Parser* pParser = m_pPDFDoc->GetParser(); 73 CPDF_Parser* pParser = m_pPDFDoc->GetParser();
70 if (pParser) 74 if (pParser)
71 delete pParser; 75 delete pParser;
72 else 76 else
73 delete m_pPDFDoc; 77 delete m_pPDFDoc;
74 } 78 }
75 79
76 m_nLoadStatus = FXFA_LOADSTATUS_CLOSED; 80 m_nLoadStatus = FXFA_LOADSTATUS_CLOSED;
77 } 81 }
78 82
79 FX_BOOL CPDFXFA_Document::LoadXFADoc() { 83 FX_BOOL CPDFXFA_Document::LoadXFADoc() {
80 m_nLoadStatus = FXFA_LOADSTATUS_LOADING; 84 m_nLoadStatus = FXFA_LOADSTATUS_LOADING;
81 85
82 if (!m_pPDFDoc) 86 if (!m_pPDFDoc)
83 return FALSE; 87 return FALSE;
84 88
85 m_XFAPageList.RemoveAll(); 89 m_XFAPageList.RemoveAll();
86 90
87 IXFA_App* pApp = m_pApp->GetXFAApp(); 91 CXFA_FFApp* pApp = m_pApp->GetXFAApp();
88 if (!pApp) 92 if (!pApp)
89 return FALSE; 93 return FALSE;
90 94
91 m_pXFADoc = pApp->CreateDoc(this, m_pPDFDoc); 95 m_pXFADoc = pApp->CreateDoc(this, m_pPDFDoc);
92 if (!m_pXFADoc) { 96 if (!m_pXFADoc) {
93 SetLastError(FPDF_ERR_XFALOAD); 97 SetLastError(FPDF_ERR_XFALOAD);
94 return FALSE; 98 return FALSE;
95 } 99 }
96 100
97 IXFA_DocHandler* pDocHandler = pApp->GetDocHandler(); 101 CXFA_FFDocHandler* pDocHandler = pApp->GetDocHandler();
98 if (!pDocHandler) { 102 if (!pDocHandler) {
99 SetLastError(FPDF_ERR_XFALOAD); 103 SetLastError(FPDF_ERR_XFALOAD);
100 return FALSE; 104 return FALSE;
101 } 105 }
102 106
103 pDocHandler->StartLoad(m_pXFADoc); 107 pDocHandler->StartLoad(m_pXFADoc);
104 int iStatus = pDocHandler->DoLoad(m_pXFADoc, NULL); 108 int iStatus = pDocHandler->DoLoad(m_pXFADoc, NULL);
105 if (iStatus != XFA_PARSESTATUS_Done) { 109 if (iStatus != XFA_PARSESTATUS_Done) {
106 CloseXFADoc(pDocHandler); 110 CloseXFADoc(pDocHandler);
107 SetLastError(FPDF_ERR_XFALOAD); 111 SetLastError(FPDF_ERR_XFALOAD);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 return pPage; 167 return pPage;
164 pPage = new CPDFXFA_Page(this, page_index); 168 pPage = new CPDFXFA_Page(this, page_index);
165 if (!pPage->LoadPage()) { 169 if (!pPage->LoadPage()) {
166 delete pPage; 170 delete pPage;
167 return nullptr; 171 return nullptr;
168 } 172 }
169 m_XFAPageList.SetAt(page_index, pPage); 173 m_XFAPageList.SetAt(page_index, pPage);
170 return pPage; 174 return pPage;
171 } 175 }
172 176
173 CPDFXFA_Page* CPDFXFA_Document::GetPage(IXFA_PageView* pPage) { 177 CPDFXFA_Page* CPDFXFA_Document::GetPage(CXFA_FFPageView* pPage) {
174 if (!pPage) 178 if (!pPage)
175 return NULL; 179 return NULL;
176 180
177 if (!m_pXFADoc) 181 if (!m_pXFADoc)
178 return NULL; 182 return NULL;
179 183
180 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) 184 if (m_iDocType != DOCTYPE_DYNAMIC_XFA)
181 return NULL; 185 return NULL;
182 186
183 int nSize = m_XFAPageList.GetSize(); 187 int nSize = m_XFAPageList.GetSize();
(...skipping 28 matching lines...) Expand all
212 } 216 }
213 217
214 void CPDFXFA_Document::FXRect2PDFRect(const CFX_RectF& fxRectF, 218 void CPDFXFA_Document::FXRect2PDFRect(const CFX_RectF& fxRectF,
215 CFX_FloatRect& pdfRect) { 219 CFX_FloatRect& pdfRect) {
216 pdfRect.left = fxRectF.left; 220 pdfRect.left = fxRectF.left;
217 pdfRect.top = fxRectF.bottom(); 221 pdfRect.top = fxRectF.bottom();
218 pdfRect.right = fxRectF.right(); 222 pdfRect.right = fxRectF.right();
219 pdfRect.bottom = fxRectF.top; 223 pdfRect.bottom = fxRectF.top;
220 } 224 }
221 225
222 void CPDFXFA_Document::SetChangeMark(IXFA_Doc* hDoc) { 226 void CPDFXFA_Document::SetChangeMark(CXFA_FFDoc* hDoc) {
223 if (hDoc == m_pXFADoc && m_pSDKDoc) { 227 if (hDoc == m_pXFADoc && m_pSDKDoc) {
224 m_pSDKDoc->SetChangeMark(); 228 m_pSDKDoc->SetChangeMark();
225 } 229 }
226 } 230 }
227 231
228 FX_BOOL CPDFXFA_Document::GetChangeMark(IXFA_Doc* hDoc) { 232 FX_BOOL CPDFXFA_Document::GetChangeMark(CXFA_FFDoc* hDoc) {
229 if (hDoc == m_pXFADoc && m_pSDKDoc) 233 if (hDoc == m_pXFADoc && m_pSDKDoc)
230 return m_pSDKDoc->GetChangeMark(); 234 return m_pSDKDoc->GetChangeMark();
231 return FALSE; 235 return FALSE;
232 } 236 }
233 237
234 void CPDFXFA_Document::InvalidateRect(IXFA_PageView* pPageView, 238 void CPDFXFA_Document::InvalidateRect(CXFA_FFPageView* pPageView,
235 const CFX_RectF& rt, 239 const CFX_RectF& rt,
236 uint32_t dwFlags /* = 0 */) { 240 uint32_t dwFlags /* = 0 */) {
237 if (!m_pXFADoc || !m_pSDKDoc) 241 if (!m_pXFADoc || !m_pSDKDoc)
238 return; 242 return;
239 243
240 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) 244 if (m_iDocType != DOCTYPE_DYNAMIC_XFA)
241 return; 245 return;
242 246
243 CFX_FloatRect rcPage; 247 CFX_FloatRect rcPage;
244 FXRect2PDFRect(rt, rcPage); 248 FXRect2PDFRect(rt, rcPage);
245 249
246 CPDFXFA_Page* pPage = GetPage(pPageView); 250 CPDFXFA_Page* pPage = GetPage(pPageView);
247 251
248 if (pPage == NULL) 252 if (pPage == NULL)
249 return; 253 return;
250 254
251 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 255 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
252 if (!pEnv) 256 if (!pEnv)
253 return; 257 return;
254 258
255 pEnv->FFI_Invalidate((FPDF_PAGE)pPage, rcPage.left, rcPage.bottom, 259 pEnv->FFI_Invalidate((FPDF_PAGE)pPage, rcPage.left, rcPage.bottom,
256 rcPage.right, rcPage.top); 260 rcPage.right, rcPage.top);
257 } 261 }
258 262
259 void CPDFXFA_Document::InvalidateRect(IXFA_Widget* hWidget, 263 void CPDFXFA_Document::InvalidateRect(CXFA_FFWidget* hWidget,
260 uint32_t dwFlags /* = 0 */) { 264 uint32_t dwFlags /* = 0 */) {
261 if (!hWidget) 265 if (!hWidget)
262 return; 266 return;
263 267
264 if (!m_pXFADoc || !m_pSDKDoc || !m_pXFADocView) 268 if (!m_pXFADoc || !m_pSDKDoc || !m_pXFADocView)
265 return; 269 return;
266 270
267 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) 271 if (m_iDocType != DOCTYPE_DYNAMIC_XFA)
268 return; 272 return;
269 273
270 IXFA_WidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler(); 274 CXFA_FFWidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler();
271 if (!pWidgetHandler) 275 if (!pWidgetHandler)
272 return; 276 return;
273 277
274 IXFA_PageView* pPageView = pWidgetHandler->GetPageView(hWidget); 278 CXFA_FFPageView* pPageView = pWidgetHandler->GetPageView(hWidget);
275 if (!pPageView) 279 if (!pPageView)
276 return; 280 return;
277 281
278 CFX_RectF rect; 282 CFX_RectF rect;
279 pWidgetHandler->GetRect(hWidget, rect); 283 pWidgetHandler->GetRect(hWidget, rect);
280 InvalidateRect(pPageView, rect, dwFlags); 284 InvalidateRect(pPageView, rect, dwFlags);
281 } 285 }
282 286
283 void CPDFXFA_Document::DisplayCaret(IXFA_Widget* hWidget, 287 void CPDFXFA_Document::DisplayCaret(CXFA_FFWidget* hWidget,
284 FX_BOOL bVisible, 288 FX_BOOL bVisible,
285 const CFX_RectF* pRtAnchor) { 289 const CFX_RectF* pRtAnchor) {
286 if (!hWidget || pRtAnchor == NULL) 290 if (!hWidget || pRtAnchor == NULL)
287 return; 291 return;
288 292
289 if (!m_pXFADoc || !m_pSDKDoc || !m_pXFADocView) 293 if (!m_pXFADoc || !m_pSDKDoc || !m_pXFADocView)
290 return; 294 return;
291 295
292 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) 296 if (m_iDocType != DOCTYPE_DYNAMIC_XFA)
293 return; 297 return;
294 298
295 IXFA_WidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler(); 299 CXFA_FFWidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler();
296 if (!pWidgetHandler) 300 if (!pWidgetHandler)
297 return; 301 return;
298 302
299 IXFA_PageView* pPageView = pWidgetHandler->GetPageView(hWidget); 303 CXFA_FFPageView* pPageView = pWidgetHandler->GetPageView(hWidget);
300 if (!pPageView) 304 if (!pPageView)
301 return; 305 return;
302 306
303 CPDFXFA_Page* pPage = GetPage(pPageView); 307 CPDFXFA_Page* pPage = GetPage(pPageView);
304 308
305 if (pPage == NULL) 309 if (pPage == NULL)
306 return; 310 return;
307 311
308 CFX_FloatRect rcCaret; 312 CFX_FloatRect rcCaret;
309 FXRect2PDFRect(*pRtAnchor, rcCaret); 313 FXRect2PDFRect(*pRtAnchor, rcCaret);
310 314
311 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 315 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
312 if (!pEnv) 316 if (!pEnv)
313 return; 317 return;
314 318
315 pEnv->FFI_DisplayCaret((FPDF_PAGE)pPage, bVisible, rcCaret.left, rcCaret.top, 319 pEnv->FFI_DisplayCaret((FPDF_PAGE)pPage, bVisible, rcCaret.left, rcCaret.top,
316 rcCaret.right, rcCaret.bottom); 320 rcCaret.right, rcCaret.bottom);
317 } 321 }
318 322
319 FX_BOOL CPDFXFA_Document::GetPopupPos(IXFA_Widget* hWidget, 323 FX_BOOL CPDFXFA_Document::GetPopupPos(CXFA_FFWidget* hWidget,
320 FX_FLOAT fMinPopup, 324 FX_FLOAT fMinPopup,
321 FX_FLOAT fMaxPopup, 325 FX_FLOAT fMaxPopup,
322 const CFX_RectF& rtAnchor, 326 const CFX_RectF& rtAnchor,
323 CFX_RectF& rtPopup) { 327 CFX_RectF& rtPopup) {
324 if (NULL == hWidget) { 328 if (NULL == hWidget) {
325 return FALSE; 329 return FALSE;
326 } 330 }
327 IXFA_PageView* pXFAPageView = 331 CXFA_FFPageView* pXFAPageView =
328 m_pXFADocView->GetWidgetHandler()->GetPageView(hWidget); 332 m_pXFADocView->GetWidgetHandler()->GetPageView(hWidget);
329 if (NULL == pXFAPageView) { 333 if (NULL == pXFAPageView) {
330 return FALSE; 334 return FALSE;
331 } 335 }
332 CPDFXFA_Page* pPage = GetPage(pXFAPageView); 336 CPDFXFA_Page* pPage = GetPage(pXFAPageView);
333 if (pPage == NULL) 337 if (pPage == NULL)
334 return FALSE; 338 return FALSE;
335 339
336 CXFA_WidgetAcc* pWidgetAcc = 340 CXFA_WidgetAcc* pWidgetAcc =
337 m_pXFADocView->GetWidgetHandler()->GetDataAcc(hWidget); 341 m_pXFADocView->GetWidgetHandler()->GetDataAcc(hWidget);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 } 447 }
444 break; 448 break;
445 } 449 }
446 default: 450 default:
447 break; 451 break;
448 } 452 }
449 453
450 return TRUE; 454 return TRUE;
451 } 455 }
452 456
453 FX_BOOL CPDFXFA_Document::PopupMenu(IXFA_Widget* hWidget, 457 FX_BOOL CPDFXFA_Document::PopupMenu(CXFA_FFWidget* hWidget,
454 CFX_PointF ptPopup, 458 CFX_PointF ptPopup,
455 const CFX_RectF* pRectExclude) { 459 const CFX_RectF* pRectExclude) {
456 if (NULL == hWidget) { 460 if (NULL == hWidget) {
457 return FALSE; 461 return FALSE;
458 } 462 }
459 IXFA_PageView* pXFAPageView = 463 CXFA_FFPageView* pXFAPageView =
460 m_pXFADocView->GetWidgetHandler()->GetPageView(hWidget); 464 m_pXFADocView->GetWidgetHandler()->GetPageView(hWidget);
461 if (pXFAPageView == NULL) 465 if (pXFAPageView == NULL)
462 return FALSE; 466 return FALSE;
463 CPDFXFA_Page* pPage = GetPage(pXFAPageView); 467 CPDFXFA_Page* pPage = GetPage(pXFAPageView);
464 468
465 if (pPage == NULL) 469 if (pPage == NULL)
466 return FALSE; 470 return FALSE;
467 471
468 int menuFlag = 0; 472 int menuFlag = 0;
469 473
470 IXFA_MenuHandler* pXFAMenuHander = m_pApp->GetXFAApp()->GetMenuHandler(); 474 CXFA_FFMenuHandler* pXFAMenuHander = m_pApp->GetXFAApp()->GetMenuHandler();
471 if (pXFAMenuHander->CanUndo(hWidget)) 475 if (pXFAMenuHander->CanUndo(hWidget))
472 menuFlag |= FXFA_MEMU_UNDO; 476 menuFlag |= FXFA_MEMU_UNDO;
473 if (pXFAMenuHander->CanRedo(hWidget)) 477 if (pXFAMenuHander->CanRedo(hWidget))
474 menuFlag |= FXFA_MEMU_REDO; 478 menuFlag |= FXFA_MEMU_REDO;
475 if (pXFAMenuHander->CanPaste(hWidget)) 479 if (pXFAMenuHander->CanPaste(hWidget))
476 menuFlag |= FXFA_MEMU_PASTE; 480 menuFlag |= FXFA_MEMU_PASTE;
477 if (pXFAMenuHander->CanCopy(hWidget)) 481 if (pXFAMenuHander->CanCopy(hWidget))
478 menuFlag |= FXFA_MEMU_COPY; 482 menuFlag |= FXFA_MEMU_COPY;
479 if (pXFAMenuHander->CanCut(hWidget)) 483 if (pXFAMenuHander->CanCut(hWidget))
480 menuFlag |= FXFA_MEMU_CUT; 484 menuFlag |= FXFA_MEMU_CUT;
481 if (pXFAMenuHander->CanSelectAll(hWidget)) 485 if (pXFAMenuHander->CanSelectAll(hWidget))
482 menuFlag |= FXFA_MEMU_SELECTALL; 486 menuFlag |= FXFA_MEMU_SELECTALL;
483 487
484 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 488 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
485 if (pEnv == NULL) 489 if (pEnv == NULL)
486 return FALSE; 490 return FALSE;
487 491
488 return pEnv->FFI_PopupMenu(pPage, hWidget, menuFlag, ptPopup, NULL); 492 return pEnv->FFI_PopupMenu(pPage, hWidget, menuFlag, ptPopup, NULL);
489 } 493 }
490 494
491 void CPDFXFA_Document::PageViewEvent(IXFA_PageView* pPageView, 495 void CPDFXFA_Document::PageViewEvent(CXFA_FFPageView* pPageView,
492 uint32_t dwFlags) { 496 uint32_t dwFlags) {
493 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 497 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
494 if (!pEnv) 498 if (!pEnv)
495 return; 499 return;
496 500
497 if (m_nLoadStatus != FXFA_LOADSTATUS_LOADING && 501 if (m_nLoadStatus != FXFA_LOADSTATUS_LOADING &&
498 m_nLoadStatus != FXFA_LOADSTATUS_CLOSING && 502 m_nLoadStatus != FXFA_LOADSTATUS_CLOSING &&
499 XFA_PAGEVIEWEVENT_StopLayout == dwFlags) { 503 XFA_PAGEVIEWEVENT_StopLayout == dwFlags) {
500 int nNewCount = GetPageCount(); 504 int nNewCount = GetPageCount();
501 if (nNewCount == m_nPageCount) 505 if (nNewCount == m_nPageCount)
502 return; 506 return;
503 507
504 IXFA_DocView* pXFADocView = GetXFADocView(); 508 CXFA_FFDocView* pXFADocView = GetXFADocView();
505 if (!pXFADocView) 509 if (!pXFADocView)
506 return; 510 return;
507 for (int iPageIter = 0; iPageIter < m_nPageCount; iPageIter++) { 511 for (int iPageIter = 0; iPageIter < m_nPageCount; iPageIter++) {
508 CPDFXFA_Page* pPage = m_XFAPageList.GetAt(iPageIter); 512 CPDFXFA_Page* pPage = m_XFAPageList.GetAt(iPageIter);
509 if (!pPage) 513 if (!pPage)
510 continue; 514 continue;
511 m_pSDKDoc->RemovePageView(pPage); 515 m_pSDKDoc->RemovePageView(pPage);
512 IXFA_PageView* pXFAPageView = pXFADocView->GetPageView(iPageIter); 516 CXFA_FFPageView* pXFAPageView = pXFADocView->GetPageView(iPageIter);
513 pPage->SetXFAPageView(pXFAPageView); 517 pPage->SetXFAPageView(pXFAPageView);
514 if (pXFAPageView) 518 if (pXFAPageView)
515 pXFAPageView->LoadPageView(nullptr); 519 pXFAPageView->LoadPageView(nullptr);
516 } 520 }
517 521
518 int flag = (nNewCount < m_nPageCount) ? FXFA_PAGEVIEWEVENT_POSTREMOVED 522 int flag = (nNewCount < m_nPageCount) ? FXFA_PAGEVIEWEVENT_POSTREMOVED
519 : FXFA_PAGEVIEWEVENT_POSTADDED; 523 : FXFA_PAGEVIEWEVENT_POSTADDED;
520 int count = FXSYS_abs(nNewCount - m_nPageCount); 524 int count = FXSYS_abs(nNewCount - m_nPageCount);
521 m_nPageCount = nNewCount; 525 m_nPageCount = nNewCount;
522 m_XFAPageList.SetSize(nNewCount); 526 m_XFAPageList.SetSize(nNewCount);
523 pEnv->FFI_PageEvent(count, flag); 527 pEnv->FFI_PageEvent(count, flag);
524 } 528 }
525 } 529 }
526 530
527 void CPDFXFA_Document::WidgetEvent(IXFA_Widget* hWidget, 531 void CPDFXFA_Document::WidgetEvent(CXFA_FFWidget* hWidget,
528 CXFA_WidgetAcc* pWidgetData, 532 CXFA_WidgetAcc* pWidgetData,
529 uint32_t dwEvent, 533 uint32_t dwEvent,
530 void* pParam, 534 void* pParam,
531 void* pAdditional) { 535 void* pAdditional) {
532 if (m_iDocType != DOCTYPE_DYNAMIC_XFA || !hWidget) 536 if (m_iDocType != DOCTYPE_DYNAMIC_XFA || !hWidget)
533 return; 537 return;
534 538
535 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 539 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
536 if (!pEnv) 540 if (!pEnv)
537 return; 541 return;
538 542
539 IXFA_PageView* pPageView = 543 CXFA_FFPageView* pPageView =
540 m_pXFADocView->GetWidgetHandler()->GetPageView(hWidget); 544 m_pXFADocView->GetWidgetHandler()->GetPageView(hWidget);
541 if (pPageView == NULL) 545 if (pPageView == NULL)
542 return; 546 return;
543 547
544 CPDFXFA_Page* pXFAPage = GetPage(pPageView); 548 CPDFXFA_Page* pXFAPage = GetPage(pPageView);
545 if (pXFAPage == NULL) 549 if (pXFAPage == NULL)
546 return; 550 return;
547 551
548 CPDFSDK_PageView* pSdkPageView = m_pSDKDoc->GetPageView(pXFAPage); 552 CPDFSDK_PageView* pSdkPageView = m_pSDKDoc->GetPageView(pXFAPage);
549 if (dwEvent == XFA_WIDGETEVENT_PostAdded) { 553 if (dwEvent == XFA_WIDGETEVENT_PostAdded) {
550 pSdkPageView->AddAnnot(hWidget); 554 pSdkPageView->AddAnnot(hWidget);
551 555
552 } else if (dwEvent == XFA_WIDGETEVENT_PreRemoved) { 556 } else if (dwEvent == XFA_WIDGETEVENT_PreRemoved) {
553 CPDFSDK_Annot* pAnnot = pSdkPageView->GetAnnotByXFAWidget(hWidget); 557 CPDFSDK_Annot* pAnnot = pSdkPageView->GetAnnotByXFAWidget(hWidget);
554 if (pAnnot) { 558 if (pAnnot) {
555 pSdkPageView->DeleteAnnot(pAnnot); 559 pSdkPageView->DeleteAnnot(pAnnot);
556 } 560 }
557 } 561 }
558 } 562 }
559 563
560 int32_t CPDFXFA_Document::CountPages(IXFA_Doc* hDoc) { 564 int32_t CPDFXFA_Document::CountPages(CXFA_FFDoc* hDoc) {
561 if (hDoc == m_pXFADoc && m_pSDKDoc) { 565 if (hDoc == m_pXFADoc && m_pSDKDoc) {
562 return GetPageCount(); 566 return GetPageCount();
563 } 567 }
564 return 0; 568 return 0;
565 } 569 }
566 int32_t CPDFXFA_Document::GetCurrentPage(IXFA_Doc* hDoc) { 570 int32_t CPDFXFA_Document::GetCurrentPage(CXFA_FFDoc* hDoc) {
567 if (hDoc != m_pXFADoc || !m_pSDKDoc) 571 if (hDoc != m_pXFADoc || !m_pSDKDoc)
568 return -1; 572 return -1;
569 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) 573 if (m_iDocType != DOCTYPE_DYNAMIC_XFA)
570 return -1; 574 return -1;
571 575
572 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 576 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
573 if (pEnv == NULL) 577 if (pEnv == NULL)
574 return -1; 578 return -1;
575 579
576 return pEnv->FFI_GetCurrentPageIndex(this); 580 return pEnv->FFI_GetCurrentPageIndex(this);
577 } 581 }
578 void CPDFXFA_Document::SetCurrentPage(IXFA_Doc* hDoc, int32_t iCurPage) { 582 void CPDFXFA_Document::SetCurrentPage(CXFA_FFDoc* hDoc, int32_t iCurPage) {
579 if (hDoc != m_pXFADoc || !m_pSDKDoc || m_iDocType != DOCTYPE_DYNAMIC_XFA || 583 if (hDoc != m_pXFADoc || !m_pSDKDoc || m_iDocType != DOCTYPE_DYNAMIC_XFA ||
580 iCurPage < 0 || iCurPage >= m_pSDKDoc->GetPageCount()) { 584 iCurPage < 0 || iCurPage >= m_pSDKDoc->GetPageCount()) {
581 return; 585 return;
582 } 586 }
583 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 587 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
584 if (!pEnv) 588 if (!pEnv)
585 return; 589 return;
586 pEnv->FFI_SetCurrentPage(this, iCurPage); 590 pEnv->FFI_SetCurrentPage(this, iCurPage);
587 } 591 }
588 FX_BOOL CPDFXFA_Document::IsCalculationsEnabled(IXFA_Doc* hDoc) { 592 FX_BOOL CPDFXFA_Document::IsCalculationsEnabled(CXFA_FFDoc* hDoc) {
589 if (hDoc != m_pXFADoc || !m_pSDKDoc) 593 if (hDoc != m_pXFADoc || !m_pSDKDoc)
590 return FALSE; 594 return FALSE;
591 if (m_pSDKDoc->GetInterForm()) 595 if (m_pSDKDoc->GetInterForm())
592 return m_pSDKDoc->GetInterForm()->IsXfaCalculateEnabled(); 596 return m_pSDKDoc->GetInterForm()->IsXfaCalculateEnabled();
593 597
594 return FALSE; 598 return FALSE;
595 } 599 }
596 void CPDFXFA_Document::SetCalculationsEnabled(IXFA_Doc* hDoc, 600 void CPDFXFA_Document::SetCalculationsEnabled(CXFA_FFDoc* hDoc,
597 FX_BOOL bEnabled) { 601 FX_BOOL bEnabled) {
598 if (hDoc != m_pXFADoc || !m_pSDKDoc) 602 if (hDoc != m_pXFADoc || !m_pSDKDoc)
599 return; 603 return;
600 if (m_pSDKDoc->GetInterForm()) 604 if (m_pSDKDoc->GetInterForm())
601 m_pSDKDoc->GetInterForm()->XfaEnableCalculate(bEnabled); 605 m_pSDKDoc->GetInterForm()->XfaEnableCalculate(bEnabled);
602 } 606 }
603 607
604 void CPDFXFA_Document::GetTitle(IXFA_Doc* hDoc, CFX_WideString& wsTitle) { 608 void CPDFXFA_Document::GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) {
605 if (hDoc != m_pXFADoc) 609 if (hDoc != m_pXFADoc)
606 return; 610 return;
607 if (m_pPDFDoc == NULL) 611 if (m_pPDFDoc == NULL)
608 return; 612 return;
609 CPDF_Dictionary* pInfoDict = m_pPDFDoc->GetInfo(); 613 CPDF_Dictionary* pInfoDict = m_pPDFDoc->GetInfo();
610 614
611 if (pInfoDict == NULL) 615 if (pInfoDict == NULL)
612 return; 616 return;
613 617
614 CFX_ByteString csTitle = pInfoDict->GetStringBy("Title"); 618 CFX_ByteString csTitle = pInfoDict->GetStringBy("Title");
615 wsTitle = wsTitle.FromLocal(csTitle.GetBuffer(csTitle.GetLength())); 619 wsTitle = wsTitle.FromLocal(csTitle.GetBuffer(csTitle.GetLength()));
616 csTitle.ReleaseBuffer(csTitle.GetLength()); 620 csTitle.ReleaseBuffer(csTitle.GetLength());
617 } 621 }
618 void CPDFXFA_Document::SetTitle(IXFA_Doc* hDoc, 622 void CPDFXFA_Document::SetTitle(CXFA_FFDoc* hDoc,
619 const CFX_WideStringC& wsTitle) { 623 const CFX_WideStringC& wsTitle) {
620 if (hDoc != m_pXFADoc) 624 if (hDoc != m_pXFADoc)
621 return; 625 return;
622 if (m_pPDFDoc == NULL) 626 if (m_pPDFDoc == NULL)
623 return; 627 return;
624 CPDF_Dictionary* pInfoDict = m_pPDFDoc->GetInfo(); 628 CPDF_Dictionary* pInfoDict = m_pPDFDoc->GetInfo();
625 629
626 if (pInfoDict == NULL) 630 if (pInfoDict == NULL)
627 return; 631 return;
628 pInfoDict->SetAt("Title", new CPDF_String(wsTitle)); 632 pInfoDict->SetAt("Title", new CPDF_String(wsTitle));
629 } 633 }
630 void CPDFXFA_Document::ExportData(IXFA_Doc* hDoc, 634 void CPDFXFA_Document::ExportData(CXFA_FFDoc* hDoc,
631 const CFX_WideStringC& wsFilePath, 635 const CFX_WideStringC& wsFilePath,
632 FX_BOOL bXDP) { 636 FX_BOOL bXDP) {
633 if (hDoc != m_pXFADoc) 637 if (hDoc != m_pXFADoc)
634 return; 638 return;
635 if (m_iDocType != DOCTYPE_DYNAMIC_XFA && m_iDocType != DOCTYPE_STATIC_XFA) 639 if (m_iDocType != DOCTYPE_DYNAMIC_XFA && m_iDocType != DOCTYPE_STATIC_XFA)
636 return; 640 return;
637 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 641 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
638 if (pEnv == NULL) 642 if (pEnv == NULL)
639 return; 643 return;
640 int fileType = bXDP ? FXFA_SAVEAS_XDP : FXFA_SAVEAS_XML; 644 int fileType = bXDP ? FXFA_SAVEAS_XDP : FXFA_SAVEAS_XML;
(...skipping 10 matching lines...) Expand all
651 FPDF_FILEHANDLER* pFileHandler = pEnv->FFI_OpenFile( 655 FPDF_FILEHANDLER* pFileHandler = pEnv->FFI_OpenFile(
652 bXDP ? FXFA_SAVEAS_XDP : FXFA_SAVEAS_XML, 656 bXDP ? FXFA_SAVEAS_XDP : FXFA_SAVEAS_XML,
653 (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short)), "wb"); 657 (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short)), "wb");
654 bs.ReleaseBuffer(len * sizeof(unsigned short)); 658 bs.ReleaseBuffer(len * sizeof(unsigned short));
655 659
656 if (pFileHandler == NULL) 660 if (pFileHandler == NULL)
657 return; 661 return;
658 662
659 CFPDF_FileStream fileWrite(pFileHandler); 663 CFPDF_FileStream fileWrite(pFileHandler);
660 664
661 IXFA_DocHandler* pXFADocHander = m_pApp->GetXFAApp()->GetDocHandler(); 665 CXFA_FFDocHandler* pXFADocHander = m_pApp->GetXFAApp()->GetDocHandler();
662 CFX_ByteString content; 666 CFX_ByteString content;
663 if (fileType == FXFA_SAVEAS_XML) { 667 if (fileType == FXFA_SAVEAS_XML) {
664 content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; 668 content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
665 fileWrite.WriteBlock((const FX_CHAR*)content, fileWrite.GetSize(), 669 fileWrite.WriteBlock((const FX_CHAR*)content, fileWrite.GetSize(),
666 content.GetLength()); 670 content.GetLength());
667 CFX_WideStringC data(L"data"); 671 CFX_WideStringC data(L"data");
668 if (pXFADocHander->SavePackage(m_pXFADocView->GetDoc(), data, &fileWrite)) { 672 if (pXFADocHander->SavePackage(m_pXFADocView->GetDoc(), data, &fileWrite)) {
669 // Ignoring error. 673 // Ignoring error.
670 } 674 }
671 } else if (fileType == FXFA_SAVEAS_XDP) { 675 } else if (fileType == FXFA_SAVEAS_XDP) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 fileWrite.WriteBlock(pAcc->GetData(), fileWrite.GetSize(), 726 fileWrite.WriteBlock(pAcc->GetData(), fileWrite.GetSize(),
723 pAcc->GetSize()); 727 pAcc->GetSize());
724 delete pAcc; 728 delete pAcc;
725 } 729 }
726 } 730 }
727 } 731 }
728 if (!fileWrite.Flush()) { 732 if (!fileWrite.Flush()) {
729 // Ignoring flush error. 733 // Ignoring flush error.
730 } 734 }
731 } 735 }
732 void CPDFXFA_Document::ImportData(IXFA_Doc* hDoc, 736 void CPDFXFA_Document::ImportData(CXFA_FFDoc* hDoc,
733 const CFX_WideStringC& wsFilePath) {} 737 const CFX_WideStringC& wsFilePath) {}
734 738
735 void CPDFXFA_Document::GotoURL(IXFA_Doc* hDoc, 739 void CPDFXFA_Document::GotoURL(CXFA_FFDoc* hDoc,
736 const CFX_WideStringC& bsURL, 740 const CFX_WideStringC& bsURL,
737 FX_BOOL bAppend) { 741 FX_BOOL bAppend) {
738 if (hDoc != m_pXFADoc) 742 if (hDoc != m_pXFADoc)
739 return; 743 return;
740 744
741 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) 745 if (m_iDocType != DOCTYPE_DYNAMIC_XFA)
742 return; 746 return;
743 747
744 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 748 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
745 if (pEnv == NULL) 749 if (pEnv == NULL)
746 return; 750 return;
747 751
748 CFX_WideStringC str(bsURL.GetPtr()); 752 CFX_WideStringC str(bsURL.GetPtr());
749 753
750 pEnv->FFI_GotoURL(this, str, bAppend); 754 pEnv->FFI_GotoURL(this, str, bAppend);
751 } 755 }
752 756
753 FX_BOOL CPDFXFA_Document::IsValidationsEnabled(IXFA_Doc* hDoc) { 757 FX_BOOL CPDFXFA_Document::IsValidationsEnabled(CXFA_FFDoc* hDoc) {
754 if (hDoc != m_pXFADoc || !m_pSDKDoc) 758 if (hDoc != m_pXFADoc || !m_pSDKDoc)
755 return FALSE; 759 return FALSE;
756 if (m_pSDKDoc->GetInterForm()) 760 if (m_pSDKDoc->GetInterForm())
757 return m_pSDKDoc->GetInterForm()->IsXfaValidationsEnabled(); 761 return m_pSDKDoc->GetInterForm()->IsXfaValidationsEnabled();
758 762
759 return TRUE; 763 return TRUE;
760 } 764 }
761 void CPDFXFA_Document::SetValidationsEnabled(IXFA_Doc* hDoc, FX_BOOL bEnabled) { 765 void CPDFXFA_Document::SetValidationsEnabled(CXFA_FFDoc* hDoc,
766 FX_BOOL bEnabled) {
762 if (hDoc != m_pXFADoc || !m_pSDKDoc) 767 if (hDoc != m_pXFADoc || !m_pSDKDoc)
763 return; 768 return;
764 if (m_pSDKDoc->GetInterForm()) 769 if (m_pSDKDoc->GetInterForm())
765 m_pSDKDoc->GetInterForm()->XfaSetValidationsEnabled(bEnabled); 770 m_pSDKDoc->GetInterForm()->XfaSetValidationsEnabled(bEnabled);
766 } 771 }
767 void CPDFXFA_Document::SetFocusWidget(IXFA_Doc* hDoc, IXFA_Widget* hWidget) { 772 void CPDFXFA_Document::SetFocusWidget(CXFA_FFDoc* hDoc,
773 CXFA_FFWidget* hWidget) {
768 if (hDoc != m_pXFADoc) 774 if (hDoc != m_pXFADoc)
769 return; 775 return;
770 776
771 if (NULL == hWidget) { 777 if (NULL == hWidget) {
772 m_pSDKDoc->SetFocusAnnot(NULL); 778 m_pSDKDoc->SetFocusAnnot(NULL);
773 return; 779 return;
774 } 780 }
775 781
776 int pageViewCount = m_pSDKDoc->GetPageViewCount(); 782 int pageViewCount = m_pSDKDoc->GetPageViewCount();
777 for (int i = 0; i < pageViewCount; i++) { 783 for (int i = 0; i < pageViewCount; i++) {
778 CPDFSDK_PageView* pPageView = m_pSDKDoc->GetPageView(i); 784 CPDFSDK_PageView* pPageView = m_pSDKDoc->GetPageView(i);
779 if (pPageView == NULL) 785 if (pPageView == NULL)
780 continue; 786 continue;
781 CPDFSDK_Annot* pAnnot = pPageView->GetAnnotByXFAWidget(hWidget); 787 CPDFSDK_Annot* pAnnot = pPageView->GetAnnotByXFAWidget(hWidget);
782 if (pAnnot) { 788 if (pAnnot) {
783 m_pSDKDoc->SetFocusAnnot(pAnnot); 789 m_pSDKDoc->SetFocusAnnot(pAnnot);
784 break; 790 break;
785 } 791 }
786 } 792 }
787 } 793 }
788 void CPDFXFA_Document::Print(IXFA_Doc* hDoc, 794 void CPDFXFA_Document::Print(CXFA_FFDoc* hDoc,
789 int32_t nStartPage, 795 int32_t nStartPage,
790 int32_t nEndPage, 796 int32_t nEndPage,
791 uint32_t dwOptions) { 797 uint32_t dwOptions) {
792 if (hDoc != m_pXFADoc) 798 if (hDoc != m_pXFADoc)
793 return; 799 return;
794 800
795 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 801 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
796 if (pEnv == NULL) 802 if (pEnv == NULL)
797 return; 803 return;
798 804
799 if (!pEnv->GetFormFillInfo() || 805 if (!pEnv->GetFormFillInfo() ||
800 pEnv->GetFormFillInfo()->m_pJsPlatform == NULL) 806 pEnv->GetFormFillInfo()->m_pJsPlatform == NULL)
801 return; 807 return;
802 if (pEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print == NULL) 808 if (pEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print == NULL)
803 return; 809 return;
804 pEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print( 810 pEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print(
805 pEnv->GetFormFillInfo()->m_pJsPlatform, 811 pEnv->GetFormFillInfo()->m_pJsPlatform,
806 dwOptions & XFA_PRINTOPT_ShowDialog, nStartPage, nEndPage, 812 dwOptions & XFA_PRINTOPT_ShowDialog, nStartPage, nEndPage,
807 dwOptions & XFA_PRINTOPT_CanCancel, dwOptions & XFA_PRINTOPT_ShrinkPage, 813 dwOptions & XFA_PRINTOPT_CanCancel, dwOptions & XFA_PRINTOPT_ShrinkPage,
808 dwOptions & XFA_PRINTOPT_AsImage, dwOptions & XFA_PRINTOPT_ReverseOrder, 814 dwOptions & XFA_PRINTOPT_AsImage, dwOptions & XFA_PRINTOPT_ReverseOrder,
809 dwOptions & XFA_PRINTOPT_PrintAnnot); 815 dwOptions & XFA_PRINTOPT_PrintAnnot);
810 } 816 }
811 817
812 void CPDFXFA_Document::GetURL(IXFA_Doc* hDoc, CFX_WideString& wsDocURL) { 818 void CPDFXFA_Document::GetURL(CXFA_FFDoc* hDoc, CFX_WideString& wsDocURL) {
813 if (hDoc != m_pXFADoc) 819 if (hDoc != m_pXFADoc)
814 return; 820 return;
815 821
816 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 822 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
817 if (pEnv == NULL) 823 if (pEnv == NULL)
818 return; 824 return;
819 825
820 pEnv->FFI_GetURL(this, wsDocURL); 826 pEnv->FFI_GetURL(this, wsDocURL);
821 } 827 }
822 828
823 FX_ARGB CPDFXFA_Document::GetHighlightColor(IXFA_Doc* hDoc) { 829 FX_ARGB CPDFXFA_Document::GetHighlightColor(CXFA_FFDoc* hDoc) {
824 if (hDoc != m_pXFADoc) 830 if (hDoc != m_pXFADoc)
825 return 0; 831 return 0;
826 if (m_pSDKDoc) { 832 if (m_pSDKDoc) {
827 if (CPDFSDK_InterForm* pInterForm = m_pSDKDoc->GetInterForm()) { 833 if (CPDFSDK_InterForm* pInterForm = m_pSDKDoc->GetInterForm()) {
828 FX_COLORREF color = pInterForm->GetHighlightColor(FPDF_FORMFIELD_XFA); 834 FX_COLORREF color = pInterForm->GetHighlightColor(FPDF_FORMFIELD_XFA);
829 uint8_t alpha = pInterForm->GetHighlightAlpha(); 835 uint8_t alpha = pInterForm->GetHighlightAlpha();
830 FX_ARGB argb = ArgbEncode((int)alpha, color); 836 FX_ARGB argb = ArgbEncode((int)alpha, color);
831 return argb; 837 return argb;
832 } 838 }
833 } 839 }
834 return 0; 840 return 0;
835 } 841 }
836 842
837 FX_BOOL CPDFXFA_Document::_NotifySubmit(FX_BOOL bPrevOrPost) { 843 FX_BOOL CPDFXFA_Document::_NotifySubmit(FX_BOOL bPrevOrPost) {
838 if (bPrevOrPost) 844 if (bPrevOrPost)
839 return _OnBeforeNotifySumbit(); 845 return _OnBeforeNotifySumbit();
840 846
841 _OnAfterNotifySumbit(); 847 _OnAfterNotifySumbit();
842 return TRUE; 848 return TRUE;
843 } 849 }
844 850
845 FX_BOOL CPDFXFA_Document::_OnBeforeNotifySumbit() { 851 FX_BOOL CPDFXFA_Document::_OnBeforeNotifySumbit() {
846 #ifdef PDF_ENABLE_XFA 852 #ifdef PDF_ENABLE_XFA
847 if (m_iDocType != DOCTYPE_DYNAMIC_XFA && m_iDocType != DOCTYPE_STATIC_XFA) 853 if (m_iDocType != DOCTYPE_DYNAMIC_XFA && m_iDocType != DOCTYPE_STATIC_XFA)
848 return TRUE; 854 return TRUE;
849 if (m_pXFADocView == NULL) 855 if (m_pXFADocView == NULL)
850 return TRUE; 856 return TRUE;
851 IXFA_WidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler(); 857 CXFA_FFWidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler();
852 if (pWidgetHandler == NULL) 858 if (pWidgetHandler == NULL)
853 return TRUE; 859 return TRUE;
854 IXFA_WidgetAccIterator* pWidgetAccIterator = 860 CXFA_WidgetAccIterator* pWidgetAccIterator =
855 m_pXFADocView->CreateWidgetAccIterator(); 861 m_pXFADocView->CreateWidgetAccIterator();
856 if (pWidgetAccIterator) { 862 if (pWidgetAccIterator) {
857 CXFA_EventParam Param; 863 CXFA_EventParam Param;
858 Param.m_eType = XFA_EVENT_PreSubmit; 864 Param.m_eType = XFA_EVENT_PreSubmit;
859 CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext(); 865 CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext();
860 while (pWidgetAcc) { 866 while (pWidgetAcc) {
861 pWidgetHandler->ProcessEvent(pWidgetAcc, &Param); 867 pWidgetHandler->ProcessEvent(pWidgetAcc, &Param);
862 pWidgetAcc = pWidgetAccIterator->MoveToNext(); 868 pWidgetAcc = pWidgetAccIterator->MoveToNext();
863 } 869 }
864 pWidgetAccIterator->Release(); 870 pWidgetAccIterator->Release();
(...skipping 25 matching lines...) Expand all
890 m_pXFADocView->UpdateDocView(); 896 m_pXFADocView->UpdateDocView();
891 } 897 }
892 #endif 898 #endif
893 return TRUE; 899 return TRUE;
894 } 900 }
895 void CPDFXFA_Document::_OnAfterNotifySumbit() { 901 void CPDFXFA_Document::_OnAfterNotifySumbit() {
896 if (m_iDocType != DOCTYPE_DYNAMIC_XFA && m_iDocType != DOCTYPE_STATIC_XFA) 902 if (m_iDocType != DOCTYPE_DYNAMIC_XFA && m_iDocType != DOCTYPE_STATIC_XFA)
897 return; 903 return;
898 if (m_pXFADocView == NULL) 904 if (m_pXFADocView == NULL)
899 return; 905 return;
900 IXFA_WidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler(); 906 CXFA_FFWidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler();
901 if (pWidgetHandler == NULL) 907 if (pWidgetHandler == NULL)
902 return; 908 return;
903 IXFA_WidgetAccIterator* pWidgetAccIterator = 909 CXFA_WidgetAccIterator* pWidgetAccIterator =
904 m_pXFADocView->CreateWidgetAccIterator(); 910 m_pXFADocView->CreateWidgetAccIterator();
905 if (pWidgetAccIterator == NULL) 911 if (pWidgetAccIterator == NULL)
906 return; 912 return;
907 CXFA_EventParam Param; 913 CXFA_EventParam Param;
908 Param.m_eType = XFA_EVENT_PostSubmit; 914 Param.m_eType = XFA_EVENT_PostSubmit;
909 915
910 CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext(); 916 CXFA_WidgetAcc* pWidgetAcc = pWidgetAccIterator->MoveToNext();
911 while (pWidgetAcc) { 917 while (pWidgetAcc) {
912 pWidgetHandler->ProcessEvent(pWidgetAcc, &Param); 918 pWidgetHandler->ProcessEvent(pWidgetAcc, &Param);
913 pWidgetAcc = pWidgetAccIterator->MoveToNext(); 919 pWidgetAcc = pWidgetAccIterator->MoveToNext();
914 } 920 }
915 pWidgetAccIterator->Release(); 921 pWidgetAccIterator->Release();
916 m_pXFADocView->UpdateDocView(); 922 m_pXFADocView->UpdateDocView();
917 } 923 }
918 924
919 FX_BOOL CPDFXFA_Document::SubmitData(IXFA_Doc* hDoc, CXFA_Submit submit) { 925 FX_BOOL CPDFXFA_Document::SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) {
920 if (!_NotifySubmit(TRUE)) 926 if (!_NotifySubmit(TRUE))
921 return FALSE; 927 return FALSE;
922 if (NULL == m_pXFADocView) 928 if (NULL == m_pXFADocView)
923 return FALSE; 929 return FALSE;
924 m_pXFADocView->UpdateDocView(); 930 m_pXFADocView->UpdateDocView();
925 931
926 FX_BOOL ret = _SubmitData(hDoc, submit); 932 FX_BOOL ret = _SubmitData(hDoc, submit);
927 _NotifySubmit(FALSE); 933 _NotifySubmit(FALSE);
928 return ret; 934 return ret;
929 } 935 }
930 936
931 IFX_FileRead* CPDFXFA_Document::OpenLinkedFile(IXFA_Doc* hDoc, 937 IFX_FileRead* CPDFXFA_Document::OpenLinkedFile(CXFA_FFDoc* hDoc,
932 const CFX_WideString& wsLink) { 938 const CFX_WideString& wsLink) {
933 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 939 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
934 if (pEnv == NULL) 940 if (pEnv == NULL)
935 return FALSE; 941 return FALSE;
936 CFX_ByteString bs = wsLink.UTF16LE_Encode(); 942 CFX_ByteString bs = wsLink.UTF16LE_Encode();
937 int len = bs.GetLength() / sizeof(unsigned short); 943 int len = bs.GetLength() / sizeof(unsigned short);
938 FPDF_FILEHANDLER* pFileHandler = pEnv->FFI_OpenFile( 944 FPDF_FILEHANDLER* pFileHandler = pEnv->FFI_OpenFile(
939 0, (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short)), "rb"); 945 0, (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short)), "rb");
940 bs.ReleaseBuffer(len * sizeof(unsigned short)); 946 bs.ReleaseBuffer(len * sizeof(unsigned short));
941 947
942 if (pFileHandler == NULL) 948 if (pFileHandler == NULL)
943 return NULL; 949 return NULL;
944 return new CFPDF_FileStream(pFileHandler); 950 return new CFPDF_FileStream(pFileHandler);
945 } 951 }
946 FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, 952 FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
947 int fileType, 953 int fileType,
948 FPDF_DWORD encodeType, 954 FPDF_DWORD encodeType,
949 FPDF_DWORD flag) { 955 FPDF_DWORD flag) {
950 if (NULL == m_pXFADocView) 956 if (NULL == m_pXFADocView)
951 return FALSE; 957 return FALSE;
952 IXFA_DocHandler* pDocHandler = m_pApp->GetXFAApp()->GetDocHandler(); 958 CXFA_FFDocHandler* pDocHandler = m_pApp->GetXFAApp()->GetDocHandler();
953 CFX_ByteString content; 959 CFX_ByteString content;
954 960
955 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 961 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
956 if (pEnv == NULL) 962 if (pEnv == NULL)
957 return FALSE; 963 return FALSE;
958 964
959 CFPDF_FileStream fileStream(pFileHandler); 965 CFPDF_FileStream fileStream(pFileHandler);
960 966
961 if (fileType == FXFA_SAVEAS_XML) { 967 if (fileType == FXFA_SAVEAS_XML) {
962 CFX_WideString ws; 968 CFX_WideString ws;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 srcURL = L""; 1134 srcURL = L"";
1129 else 1135 else
1130 srcURL = srcURL.Right(csURL.GetLength() - (pos + 1)); 1136 srcURL = srcURL.Right(csURL.GetLength() - (pos + 1));
1131 } 1137 }
1132 csToAddress.Replace(L",", L";"); 1138 csToAddress.Replace(L",", L";");
1133 csCCAddress.Replace(L",", L";"); 1139 csCCAddress.Replace(L",", L";");
1134 csBCCAddress.Replace(L",", L";"); 1140 csBCCAddress.Replace(L",", L";");
1135 return TRUE; 1141 return TRUE;
1136 } 1142 }
1137 1143
1138 FX_BOOL CPDFXFA_Document::_SubmitData(IXFA_Doc* hDoc, CXFA_Submit submit) { 1144 FX_BOOL CPDFXFA_Document::_SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) {
1139 #ifdef PDF_ENABLE_XFA 1145 #ifdef PDF_ENABLE_XFA
1140 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); 1146 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
1141 if (!pEnv) 1147 if (!pEnv)
1142 return FALSE; 1148 return FALSE;
1143 CFX_WideStringC csURLC; 1149 CFX_WideStringC csURLC;
1144 submit.GetSubmitTarget(csURLC); 1150 submit.GetSubmitTarget(csURLC);
1145 CFX_WideString csURL = csURLC; 1151 CFX_WideString csURL = csURLC;
1146 if (csURL.IsEmpty()) { 1152 if (csURL.IsEmpty()) {
1147 CFX_WideString ws; 1153 CFX_WideString ws;
1148 ws.FromLocal("Submit cancelled."); 1154 ws.FromLocal("Submit cancelled.");
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 pFileHandler, fileFlag, 1235 pFileHandler, fileFlag,
1230 (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short))); 1236 (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short)));
1231 bs.ReleaseBuffer(len * sizeof(unsigned short)); 1237 bs.ReleaseBuffer(len * sizeof(unsigned short));
1232 } 1238 }
1233 return bRet; 1239 return bRet;
1234 #else 1240 #else
1235 return TRUE; 1241 return TRUE;
1236 #endif 1242 #endif
1237 } 1243 }
1238 1244
1239 FX_BOOL CPDFXFA_Document::SetGlobalProperty(IXFA_Doc* hDoc, 1245 FX_BOOL CPDFXFA_Document::SetGlobalProperty(CXFA_FFDoc* hDoc,
1240 const CFX_ByteStringC& szPropName, 1246 const CFX_ByteStringC& szPropName,
1241 FXJSE_HVALUE hValue) { 1247 FXJSE_HVALUE hValue) {
1242 if (hDoc != m_pXFADoc) 1248 if (hDoc != m_pXFADoc)
1243 return FALSE; 1249 return FALSE;
1244 1250
1245 if (m_pSDKDoc && m_pSDKDoc->GetEnv()->GetJSRuntime()) 1251 if (m_pSDKDoc && m_pSDKDoc->GetEnv()->GetJSRuntime())
1246 return m_pSDKDoc->GetEnv()->GetJSRuntime()->SetHValueByName(szPropName, 1252 return m_pSDKDoc->GetEnv()->GetJSRuntime()->SetHValueByName(szPropName,
1247 hValue); 1253 hValue);
1248 return FALSE; 1254 return FALSE;
1249 } 1255 }
1250 FX_BOOL CPDFXFA_Document::GetPDFScriptObject(IXFA_Doc* hDoc, 1256 FX_BOOL CPDFXFA_Document::GetPDFScriptObject(CXFA_FFDoc* hDoc,
1251 const CFX_ByteStringC& utf8Name, 1257 const CFX_ByteStringC& utf8Name,
1252 FXJSE_HVALUE hValue) { 1258 FXJSE_HVALUE hValue) {
1253 if (hDoc != m_pXFADoc) 1259 if (hDoc != m_pXFADoc)
1254 return FALSE; 1260 return FALSE;
1255 1261
1256 if (!m_pSDKDoc || !m_pSDKDoc->GetEnv()->GetJSRuntime()) 1262 if (!m_pSDKDoc || !m_pSDKDoc->GetEnv()->GetJSRuntime())
1257 return FALSE; 1263 return FALSE;
1258 1264
1259 if (!m_pJSContext) { 1265 if (!m_pJSContext) {
1260 m_pSDKDoc->GetEnv()->GetJSRuntime()->SetReaderDocument(m_pSDKDoc); 1266 m_pSDKDoc->GetEnv()->GetJSRuntime()->SetReaderDocument(m_pSDKDoc);
1261 m_pJSContext = m_pSDKDoc->GetEnv()->GetJSRuntime()->NewContext(); 1267 m_pJSContext = m_pSDKDoc->GetEnv()->GetJSRuntime()->NewContext();
1262 } 1268 }
1263 1269
1264 return _GetHValueByName(utf8Name, hValue, 1270 return _GetHValueByName(utf8Name, hValue,
1265 m_pSDKDoc->GetEnv()->GetJSRuntime()); 1271 m_pSDKDoc->GetEnv()->GetJSRuntime());
1266 } 1272 }
1267 FX_BOOL CPDFXFA_Document::GetGlobalProperty(IXFA_Doc* hDoc, 1273 FX_BOOL CPDFXFA_Document::GetGlobalProperty(CXFA_FFDoc* hDoc,
1268 const CFX_ByteStringC& szPropName, 1274 const CFX_ByteStringC& szPropName,
1269 FXJSE_HVALUE hValue) { 1275 FXJSE_HVALUE hValue) {
1270 if (hDoc != m_pXFADoc) 1276 if (hDoc != m_pXFADoc)
1271 return FALSE; 1277 return FALSE;
1272 if (!m_pSDKDoc || !m_pSDKDoc->GetEnv()->GetJSRuntime()) 1278 if (!m_pSDKDoc || !m_pSDKDoc->GetEnv()->GetJSRuntime())
1273 return FALSE; 1279 return FALSE;
1274 1280
1275 if (!m_pJSContext) { 1281 if (!m_pJSContext) {
1276 m_pSDKDoc->GetEnv()->GetJSRuntime()->SetReaderDocument(m_pSDKDoc); 1282 m_pSDKDoc->GetEnv()->GetJSRuntime()->SetReaderDocument(m_pSDKDoc);
1277 m_pJSContext = m_pSDKDoc->GetEnv()->GetJSRuntime()->NewContext(); 1283 m_pJSContext = m_pSDKDoc->GetEnv()->GetJSRuntime()->NewContext();
1278 } 1284 }
1279 1285
1280 return _GetHValueByName(szPropName, hValue, 1286 return _GetHValueByName(szPropName, hValue,
1281 m_pSDKDoc->GetEnv()->GetJSRuntime()); 1287 m_pSDKDoc->GetEnv()->GetJSRuntime());
1282 } 1288 }
1283 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, 1289 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name,
1284 FXJSE_HVALUE hValue, 1290 FXJSE_HVALUE hValue,
1285 IJS_Runtime* runTime) { 1291 IJS_Runtime* runTime) {
1286 return runTime->GetHValueByName(utf8Name, hValue); 1292 return runTime->GetHValueByName(utf8Name, hValue);
1287 } 1293 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfxfa/fpdfxfa_app.cpp ('k') | fpdfsdk/fpdfxfa/fpdfxfa_page.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698