| 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/formfiller/cffl_interactiveformfiller.h" | 7 #include "fpdfsdk/formfiller/cffl_interactiveformfiller.h" |
| 8 | 8 |
| 9 #include "core/fpdfapi/page/cpdf_page.h" | 9 #include "core/fpdfapi/page/cpdf_page.h" |
| 10 #include "core/fpdfapi/parser/cpdf_document.h" | 10 #include "core/fpdfapi/parser/cpdf_document.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 60 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 61 | 61 |
| 62 if (!IsVisible(pWidget)) | 62 if (!IsVisible(pWidget)) |
| 63 return; | 63 return; |
| 64 | 64 |
| 65 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 65 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
| 66 if (pFormFiller->IsValid()) { | 66 if (pFormFiller->IsValid()) { |
| 67 pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device); | 67 pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device); |
| 68 pAnnot->GetPDFPage(); | 68 pAnnot->GetPDFPage(); |
| 69 | 69 |
| 70 CPDFSDK_Document* pDocument = m_pEnv->GetSDKDocument(); | 70 if (m_pEnv->GetSDKDocument()->GetFocusAnnot() == pAnnot) { |
| 71 if (pDocument->GetFocusAnnot() == pAnnot) { | |
| 72 CFX_FloatRect rcFocus = pFormFiller->GetFocusBox(pPageView); | 71 CFX_FloatRect rcFocus = pFormFiller->GetFocusBox(pPageView); |
| 73 if (!rcFocus.IsEmpty()) { | 72 if (!rcFocus.IsEmpty()) { |
| 74 CFX_PathData path; | 73 CFX_PathData path; |
| 75 path.SetPointCount(5); | 74 path.SetPointCount(5); |
| 76 path.SetPoint(0, rcFocus.left, rcFocus.top, FXPT_MOVETO); | 75 path.SetPoint(0, rcFocus.left, rcFocus.top, FXPT_MOVETO); |
| 77 path.SetPoint(1, rcFocus.left, rcFocus.bottom, FXPT_LINETO); | 76 path.SetPoint(1, rcFocus.left, rcFocus.bottom, FXPT_LINETO); |
| 78 path.SetPoint(2, rcFocus.right, rcFocus.bottom, FXPT_LINETO); | 77 path.SetPoint(2, rcFocus.right, rcFocus.bottom, FXPT_LINETO); |
| 79 path.SetPoint(3, rcFocus.right, rcFocus.top, FXPT_LINETO); | 78 path.SetPoint(3, rcFocus.right, rcFocus.top, FXPT_LINETO); |
| 80 path.SetPoint(4, rcFocus.left, rcFocus.top, FXPT_LINETO); | 79 path.SetPoint(4, rcFocus.left, rcFocus.top, FXPT_LINETO); |
| 81 | 80 |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 return FALSE; | 231 return FALSE; |
| 233 } | 232 } |
| 234 | 233 |
| 235 FX_BOOL CFFL_InteractiveFormFiller::OnLButtonUp( | 234 FX_BOOL CFFL_InteractiveFormFiller::OnLButtonUp( |
| 236 CPDFSDK_PageView* pPageView, | 235 CPDFSDK_PageView* pPageView, |
| 237 CPDFSDK_Annot::ObservedPtr* pAnnot, | 236 CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 238 uint32_t nFlags, | 237 uint32_t nFlags, |
| 239 const CFX_FloatPoint& point) { | 238 const CFX_FloatPoint& point) { |
| 240 ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); | 239 ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); |
| 241 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); | 240 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); |
| 242 CPDFSDK_Document* pDocument = m_pEnv->GetSDKDocument(); | |
| 243 | 241 |
| 244 switch (pWidget->GetFieldType()) { | 242 switch (pWidget->GetFieldType()) { |
| 245 case FIELDTYPE_PUSHBUTTON: | 243 case FIELDTYPE_PUSHBUTTON: |
| 246 case FIELDTYPE_CHECKBOX: | 244 case FIELDTYPE_CHECKBOX: |
| 247 case FIELDTYPE_RADIOBUTTON: | 245 case FIELDTYPE_RADIOBUTTON: |
| 248 if (GetViewBBox(pPageView, pAnnot->Get()) | 246 if (GetViewBBox(pPageView, pAnnot->Get()) |
| 249 .Contains((int)point.x, (int)point.y)) | 247 .Contains((int)point.x, (int)point.y)) |
| 250 pDocument->SetFocusAnnot(pAnnot); | 248 m_pEnv->GetSDKDocument()->SetFocusAnnot(pAnnot); |
| 251 break; | 249 break; |
| 252 default: | 250 default: |
| 253 pDocument->SetFocusAnnot(pAnnot); | 251 m_pEnv->GetSDKDocument()->SetFocusAnnot(pAnnot); |
| 254 break; | 252 break; |
| 255 } | 253 } |
| 256 | 254 |
| 257 FX_BOOL bRet = FALSE; | 255 FX_BOOL bRet = FALSE; |
| 258 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), FALSE)) | 256 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), FALSE)) |
| 259 bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot->Get(), nFlags, point); | 257 bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot->Get(), nFlags, point); |
| 260 | 258 |
| 261 if (pDocument->GetFocusAnnot() == pAnnot->Get()) { | 259 if (m_pEnv->GetSDKDocument()->GetFocusAnnot() == pAnnot->Get()) { |
| 262 FX_BOOL bExit = FALSE; | 260 FX_BOOL bExit = FALSE; |
| 263 FX_BOOL bReset = FALSE; | 261 FX_BOOL bReset = FALSE; |
| 264 OnButtonUp(pAnnot, pPageView, bReset, bExit, nFlags); | 262 OnButtonUp(pAnnot, pPageView, bReset, bExit, nFlags); |
| 265 if (!pAnnot || bExit) | 263 if (!pAnnot || bExit) |
| 266 return TRUE; | 264 return TRUE; |
| 267 #ifdef PDF_ENABLE_XFA | 265 #ifdef PDF_ENABLE_XFA |
| 268 OnClick(pWidget, pPageView, bReset, bExit, nFlags); | 266 OnClick(pWidget, pPageView, bReset, bExit, nFlags); |
| 269 if (!pAnnot || bExit) | 267 if (!pAnnot || bExit) |
| 270 return TRUE; | 268 return TRUE; |
| 271 #endif // PDF_ENABLE_XFA | 269 #endif // PDF_ENABLE_XFA |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 983 bExit = TRUE; | 981 bExit = TRUE; |
| 984 m_bNotifying = FALSE; | 982 m_bNotifying = FALSE; |
| 985 return; | 983 return; |
| 986 } | 984 } |
| 987 } | 985 } |
| 988 | 986 |
| 989 m_bNotifying = FALSE; | 987 m_bNotifying = FALSE; |
| 990 } | 988 } |
| 991 } | 989 } |
| 992 } | 990 } |
| OLD | NEW |