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

Side by Side Diff: fpdfsdk/src/formfiller/FFL_FormFiller.cpp

Issue 1477583002: Inflict PDF_ENABLE_XFA ifdefs on XFA fpdfsdk/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years 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
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 "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h" 7 #include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h"
8 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" 8 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h"
9 9
10 #define GetRed(rgb) ((uint8_t)(rgb)) 10 #define GetRed(rgb) ((uint8_t)(rgb))
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { 236 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) {
237 return pWnd->OnChar(nChar, nFlags); 237 return pWnd->OnChar(nChar, nFlags);
238 } 238 }
239 } 239 }
240 240
241 return FALSE; 241 return FALSE;
242 } 242 }
243 243
244 void CFFL_FormFiller::SetFocusForAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { 244 void CFFL_FormFiller::SetFocusForAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) {
245 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; 245 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
246 #ifndef PDF_ENABLE_XFA
247 CPDF_Page* pPage = pWidget->GetPDFPage();
Lei Zhang 2015/11/25 00:12:02 GetUnderlyingPage?
Tom Sepez 2015/11/25 21:45:29 I'm going to cobble up a pair of CLs to fix this n
248 #else
246 CPDFXFA_Page* pPage = pWidget->GetPDFXFAPage(); 249 CPDFXFA_Page* pPage = pWidget->GetPDFXFAPage();
250 #endif
247 CPDFSDK_Document* pDoc = m_pApp->GetSDKDocument(); 251 CPDFSDK_Document* pDoc = m_pApp->GetSDKDocument();
248 CPDFSDK_PageView* pPageView = pDoc->GetPageView(pPage); 252 CPDFSDK_PageView* pPageView = pDoc->GetPageView(pPage);
249 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) 253 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE))
250 pWnd->SetFocus(); 254 pWnd->SetFocus();
251 255
252 m_bValid = TRUE; 256 m_bValid = TRUE;
253 FX_RECT rcRect = GetViewBBox(pPageView, pAnnot); 257 FX_RECT rcRect = GetViewBBox(pPageView, pAnnot);
254 InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); 258 InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom);
255 } 259 }
256 260
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 458
455 FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left; 459 FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left;
456 FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom; 460 FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom;
457 if ((m_pWidget->GetRotate() / 90) & 0x01) 461 if ((m_pWidget->GetRotate() / 90) & 0x01)
458 return CPDF_Rect(0, 0, fHeight, fWidth); 462 return CPDF_Rect(0, 0, fHeight, fWidth);
459 463
460 return CPDF_Rect(0, 0, fWidth, fHeight); 464 return CPDF_Rect(0, 0, fWidth, fHeight);
461 } 465 }
462 466
463 CPDFSDK_PageView* CFFL_FormFiller::GetCurPageView() { 467 CPDFSDK_PageView* CFFL_FormFiller::GetCurPageView() {
468 #ifndef PDF_ENABLE_XFA
469 CPDF_Page* pPage = m_pAnnot->GetPDFPage();
Lei Zhang 2015/11/25 00:12:02 GetUnderlyingPage?
Tom Sepez 2015/11/25 21:45:29 Ditto
470 #else
464 CPDFXFA_Page* pPage = m_pAnnot->GetPDFXFAPage(); 471 CPDFXFA_Page* pPage = m_pAnnot->GetPDFXFAPage();
472 #endif
465 CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); 473 CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument();
466 return pSDKDoc ? pSDKDoc->GetPageView(pPage) : nullptr; 474 return pSDKDoc ? pSDKDoc->GetPageView(pPage) : nullptr;
467 } 475 }
468 476
469 CPDF_Rect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView) { 477 CPDF_Rect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView) {
470 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { 478 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) {
471 CPDF_Rect rcFocus = FFLtoWnd(pPageView, PWLtoFFL(pWnd->GetFocusRect())); 479 CPDF_Rect rcFocus = FFLtoWnd(pPageView, PWLtoFFL(pWnd->GetFocusRect()));
472 CPDF_Rect rcPage = pPageView->GetPDFPage()->GetPageBBox(); 480 CPDF_Rect rcPage = pPageView->GetPDFPage()->GetPageBBox();
473 if (rcPage.Contains(rcFocus)) 481 if (rcPage.Contains(rcFocus))
474 return rcFocus; 482 return rcFocus;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 } 563 }
556 return TRUE; 564 return TRUE;
557 } 565 }
558 566
559 FX_BOOL CFFL_FormFiller::IsDataChanged(CPDFSDK_PageView* pPageView) { 567 FX_BOOL CFFL_FormFiller::IsDataChanged(CPDFSDK_PageView* pPageView) {
560 return FALSE; 568 return FALSE;
561 } 569 }
562 570
563 void CFFL_FormFiller::SaveData(CPDFSDK_PageView* pPageView) {} 571 void CFFL_FormFiller::SaveData(CPDFSDK_PageView* pPageView) {}
564 572
573 #ifdef PDF_ENABLE_XFA
565 FX_BOOL CFFL_FormFiller::IsFieldFull(CPDFSDK_PageView* pPageView) { 574 FX_BOOL CFFL_FormFiller::IsFieldFull(CPDFSDK_PageView* pPageView) {
566 return FALSE; 575 return FALSE;
567 } 576 }
568 577
578 #endif
569 void CFFL_FormFiller::SetChangeMark() { 579 void CFFL_FormFiller::SetChangeMark() {
570 m_pApp->FFI_OnChange(); 580 m_pApp->FFI_OnChange();
571 } 581 }
572 582
573 void CFFL_FormFiller::GetActionData(CPDFSDK_PageView* pPageView, 583 void CFFL_FormFiller::GetActionData(CPDFSDK_PageView* pPageView,
574 CPDF_AAction::AActionType type, 584 CPDF_AAction::AActionType type,
575 PDFSDK_FieldAction& fa) { 585 PDFSDK_FieldAction& fa) {
576 fa.sValue = m_pWidget->GetValue(); 586 fa.sValue = m_pWidget->GetValue();
577 } 587 }
578 588
(...skipping 30 matching lines...) Expand all
609 InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); 619 InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom);
610 620
611 if (bDestroyPDFWindow) 621 if (bDestroyPDFWindow)
612 DestroyPDFWindow(pPageView); 622 DestroyPDFWindow(pPageView);
613 } 623 }
614 624
615 void CFFL_FormFiller::InvalidateRect(double left, 625 void CFFL_FormFiller::InvalidateRect(double left,
616 double top, 626 double top,
617 double right, 627 double right,
618 double bottom) { 628 double bottom) {
629 #ifndef PDF_ENABLE_XFA
630 CPDF_Page* pPage = m_pWidget->GetPDFPage();
Lei Zhang 2015/11/25 00:12:02 GetUnderlyingPage?
Tom Sepez 2015/11/25 21:45:29 Ditto
631 #else
619 CPDFXFA_Page* pPage = m_pWidget->GetPDFXFAPage(); 632 CPDFXFA_Page* pPage = m_pWidget->GetPDFXFAPage();
633 #endif
620 m_pApp->FFI_Invalidate(pPage, left, top, right, bottom); 634 m_pApp->FFI_Invalidate(pPage, left, top, right, bottom);
621 } 635 }
622 636
623 /* ------------------------- CFFL_Button ------------------------- */ 637 /* ------------------------- CFFL_Button ------------------------- */
624 638
625 CFFL_Button::CFFL_Button(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget) 639 CFFL_Button::CFFL_Button(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget)
626 : CFFL_FormFiller(pApp, pWidget), m_bMouseIn(FALSE), m_bMouseDown(FALSE) {} 640 : CFFL_FormFiller(pApp, pWidget), m_bMouseIn(FALSE), m_bMouseDown(FALSE) {}
627 641
628 CFFL_Button::~CFFL_Button() {} 642 CFFL_Button::~CFFL_Button() {}
629 643
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); 729 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
716 } 730 }
717 731
718 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, 732 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView,
719 CPDFSDK_Annot* pAnnot, 733 CPDFSDK_Annot* pAnnot,
720 CFX_RenderDevice* pDevice, 734 CFX_RenderDevice* pDevice,
721 CPDF_Matrix* pUser2Device, 735 CPDF_Matrix* pUser2Device,
722 FX_DWORD dwFlags) { 736 FX_DWORD dwFlags) {
723 OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); 737 OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags);
724 } 738 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698