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 "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" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 } | 226 } |
227 | 227 |
228 FX_BOOL CPDFXFA_Document::GetChangeMark(IXFA_Doc* hDoc) { | 228 FX_BOOL CPDFXFA_Document::GetChangeMark(IXFA_Doc* hDoc) { |
229 if (hDoc == m_pXFADoc && m_pSDKDoc) | 229 if (hDoc == m_pXFADoc && m_pSDKDoc) |
230 return m_pSDKDoc->GetChangeMark(); | 230 return m_pSDKDoc->GetChangeMark(); |
231 return FALSE; | 231 return FALSE; |
232 } | 232 } |
233 | 233 |
234 void CPDFXFA_Document::InvalidateRect(IXFA_PageView* pPageView, | 234 void CPDFXFA_Document::InvalidateRect(IXFA_PageView* pPageView, |
235 const CFX_RectF& rt, | 235 const CFX_RectF& rt, |
236 FX_DWORD dwFlags /* = 0 */) { | 236 uint32_t dwFlags /* = 0 */) { |
237 if (!m_pXFADoc || !m_pSDKDoc) | 237 if (!m_pXFADoc || !m_pSDKDoc) |
238 return; | 238 return; |
239 | 239 |
240 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) | 240 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) |
241 return; | 241 return; |
242 | 242 |
243 CFX_FloatRect rcPage; | 243 CFX_FloatRect rcPage; |
244 FXRect2PDFRect(rt, rcPage); | 244 FXRect2PDFRect(rt, rcPage); |
245 | 245 |
246 CPDFXFA_Page* pPage = GetPage(pPageView); | 246 CPDFXFA_Page* pPage = GetPage(pPageView); |
247 | 247 |
248 if (pPage == NULL) | 248 if (pPage == NULL) |
249 return; | 249 return; |
250 | 250 |
251 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 251 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
252 if (!pEnv) | 252 if (!pEnv) |
253 return; | 253 return; |
254 | 254 |
255 pEnv->FFI_Invalidate((FPDF_PAGE)pPage, rcPage.left, rcPage.bottom, | 255 pEnv->FFI_Invalidate((FPDF_PAGE)pPage, rcPage.left, rcPage.bottom, |
256 rcPage.right, rcPage.top); | 256 rcPage.right, rcPage.top); |
257 } | 257 } |
258 | 258 |
259 void CPDFXFA_Document::InvalidateRect(IXFA_Widget* hWidget, | 259 void CPDFXFA_Document::InvalidateRect(IXFA_Widget* hWidget, |
260 FX_DWORD dwFlags /* = 0 */) { | 260 uint32_t dwFlags /* = 0 */) { |
261 if (!hWidget) | 261 if (!hWidget) |
262 return; | 262 return; |
263 | 263 |
264 if (!m_pXFADoc || !m_pSDKDoc || !m_pXFADocView) | 264 if (!m_pXFADoc || !m_pSDKDoc || !m_pXFADocView) |
265 return; | 265 return; |
266 | 266 |
267 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) | 267 if (m_iDocType != DOCTYPE_DYNAMIC_XFA) |
268 return; | 268 return; |
269 | 269 |
270 IXFA_WidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler(); | 270 IXFA_WidgetHandler* pWidgetHandler = m_pXFADocView->GetWidgetHandler(); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 pEnv->FFI_GetPageViewRect(pPage, pageViewRect); | 348 pEnv->FFI_GetPageViewRect(pPage, pageViewRect); |
349 | 349 |
350 CFX_FloatRect rcAnchor; | 350 CFX_FloatRect rcAnchor; |
351 | 351 |
352 rcAnchor.left = rtAnchor.left; | 352 rcAnchor.left = rtAnchor.left; |
353 rcAnchor.top = rtAnchor.bottom(); | 353 rcAnchor.top = rtAnchor.bottom(); |
354 rcAnchor.right = rtAnchor.right(); | 354 rcAnchor.right = rtAnchor.right(); |
355 rcAnchor.bottom = rtAnchor.top; | 355 rcAnchor.bottom = rtAnchor.top; |
356 | 356 |
357 int t1, t2, t; | 357 int t1, t2, t; |
358 FX_DWORD dwPos; | 358 uint32_t dwPos; |
359 FX_FLOAT fPoupHeight; | 359 FX_FLOAT fPoupHeight; |
360 switch (nRotate) { | 360 switch (nRotate) { |
361 case 90: { | 361 case 90: { |
362 t1 = (int)(pageViewRect.right - rcAnchor.right); | 362 t1 = (int)(pageViewRect.right - rcAnchor.right); |
363 t2 = (int)(rcAnchor.left - pageViewRect.left); | 363 t2 = (int)(rcAnchor.left - pageViewRect.left); |
364 if (rcAnchor.bottom < pageViewRect.bottom) { | 364 if (rcAnchor.bottom < pageViewRect.bottom) { |
365 rtPopup.left += rcAnchor.bottom - pageViewRect.bottom; | 365 rtPopup.left += rcAnchor.bottom - pageViewRect.bottom; |
366 } | 366 } |
367 | 367 |
368 break; | 368 break; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 menuFlag |= FXFA_MEMU_SELECTALL; | 482 menuFlag |= FXFA_MEMU_SELECTALL; |
483 | 483 |
484 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 484 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
485 if (pEnv == NULL) | 485 if (pEnv == NULL) |
486 return FALSE; | 486 return FALSE; |
487 | 487 |
488 return pEnv->FFI_PopupMenu(pPage, hWidget, menuFlag, ptPopup, NULL); | 488 return pEnv->FFI_PopupMenu(pPage, hWidget, menuFlag, ptPopup, NULL); |
489 } | 489 } |
490 | 490 |
491 void CPDFXFA_Document::PageViewEvent(IXFA_PageView* pPageView, | 491 void CPDFXFA_Document::PageViewEvent(IXFA_PageView* pPageView, |
492 FX_DWORD dwFlags) { | 492 uint32_t dwFlags) { |
493 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 493 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
494 if (!pEnv) | 494 if (!pEnv) |
495 return; | 495 return; |
496 | 496 |
497 if (m_nLoadStatus != FXFA_LOADSTATUS_LOADING && | 497 if (m_nLoadStatus != FXFA_LOADSTATUS_LOADING && |
498 m_nLoadStatus != FXFA_LOADSTATUS_CLOSING && | 498 m_nLoadStatus != FXFA_LOADSTATUS_CLOSING && |
499 XFA_PAGEVIEWEVENT_StopLayout == dwFlags) { | 499 XFA_PAGEVIEWEVENT_StopLayout == dwFlags) { |
500 int nNewCount = GetPageCount(); | 500 int nNewCount = GetPageCount(); |
501 if (nNewCount == m_nPageCount) | 501 if (nNewCount == m_nPageCount) |
502 return; | 502 return; |
(...skipping 16 matching lines...) Expand all Loading... |
519 : FXFA_PAGEVIEWEVENT_POSTADDED; | 519 : FXFA_PAGEVIEWEVENT_POSTADDED; |
520 int count = FXSYS_abs(nNewCount - m_nPageCount); | 520 int count = FXSYS_abs(nNewCount - m_nPageCount); |
521 m_nPageCount = nNewCount; | 521 m_nPageCount = nNewCount; |
522 m_XFAPageList.SetSize(nNewCount); | 522 m_XFAPageList.SetSize(nNewCount); |
523 pEnv->FFI_PageEvent(count, flag); | 523 pEnv->FFI_PageEvent(count, flag); |
524 } | 524 } |
525 } | 525 } |
526 | 526 |
527 void CPDFXFA_Document::WidgetEvent(IXFA_Widget* hWidget, | 527 void CPDFXFA_Document::WidgetEvent(IXFA_Widget* hWidget, |
528 CXFA_WidgetAcc* pWidgetData, | 528 CXFA_WidgetAcc* pWidgetData, |
529 FX_DWORD dwEvent, | 529 uint32_t dwEvent, |
530 void* pParam, | 530 void* pParam, |
531 void* pAdditional) { | 531 void* pAdditional) { |
532 if (m_iDocType != DOCTYPE_DYNAMIC_XFA || !hWidget) | 532 if (m_iDocType != DOCTYPE_DYNAMIC_XFA || !hWidget) |
533 return; | 533 return; |
534 | 534 |
535 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 535 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
536 if (!pEnv) | 536 if (!pEnv) |
537 return; | 537 return; |
538 | 538 |
539 IXFA_PageView* pPageView = | 539 IXFA_PageView* pPageView = |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 CPDFSDK_Annot* pAnnot = pPageView->GetAnnotByXFAWidget(hWidget); | 781 CPDFSDK_Annot* pAnnot = pPageView->GetAnnotByXFAWidget(hWidget); |
782 if (pAnnot) { | 782 if (pAnnot) { |
783 m_pSDKDoc->SetFocusAnnot(pAnnot); | 783 m_pSDKDoc->SetFocusAnnot(pAnnot); |
784 break; | 784 break; |
785 } | 785 } |
786 } | 786 } |
787 } | 787 } |
788 void CPDFXFA_Document::Print(IXFA_Doc* hDoc, | 788 void CPDFXFA_Document::Print(IXFA_Doc* hDoc, |
789 int32_t nStartPage, | 789 int32_t nStartPage, |
790 int32_t nEndPage, | 790 int32_t nEndPage, |
791 FX_DWORD dwOptions) { | 791 uint32_t dwOptions) { |
792 if (hDoc != m_pXFADoc) | 792 if (hDoc != m_pXFADoc) |
793 return; | 793 return; |
794 | 794 |
795 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); | 795 CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); |
796 if (pEnv == NULL) | 796 if (pEnv == NULL) |
797 return; | 797 return; |
798 | 798 |
799 if (!pEnv->GetFormFillInfo() || | 799 if (!pEnv->GetFormFillInfo() || |
800 pEnv->GetFormFillInfo()->m_pJsPlatform == NULL) | 800 pEnv->GetFormFillInfo()->m_pJsPlatform == NULL) |
801 return; | 801 return; |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1278 } | 1278 } |
1279 | 1279 |
1280 return _GetHValueByName(szPropName, hValue, | 1280 return _GetHValueByName(szPropName, hValue, |
1281 m_pSDKDoc->GetEnv()->GetJSRuntime()); | 1281 m_pSDKDoc->GetEnv()->GetJSRuntime()); |
1282 } | 1282 } |
1283 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, | 1283 FX_BOOL CPDFXFA_Document::_GetHValueByName(const CFX_ByteStringC& utf8Name, |
1284 FXJSE_HVALUE hValue, | 1284 FXJSE_HVALUE hValue, |
1285 IJS_Runtime* runTime) { | 1285 IJS_Runtime* runTime) { |
1286 return runTime->GetHValueByName(utf8Name, hValue); | 1286 return runTime->GetHValueByName(utf8Name, hValue); |
1287 } | 1287 } |
OLD | NEW |