| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/cpdfsdk_widgethandler.h" | 7 #include "fpdfsdk/include/cpdfsdk_widgethandler.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" | 12 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" |
| 13 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 13 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
| 14 #include "core/fpdfdoc/include/cpdf_interform.h" | 14 #include "core/fpdfdoc/include/cpdf_interform.h" |
| 15 #include "fpdfsdk/formfiller/cffl_formfiller.h" | 15 #include "fpdfsdk/formfiller/cffl_formfiller.h" |
| 16 #include "fpdfsdk/include/cpdfsdk_annot.h" | 16 #include "fpdfsdk/include/cpdfsdk_annot.h" |
| 17 #include "fpdfsdk/include/cpdfsdk_interform.h" | 17 #include "fpdfsdk/include/cpdfsdk_interform.h" |
| 18 #include "fpdfsdk/include/cpdfsdk_widget.h" | 18 #include "fpdfsdk/include/cpdfsdk_widget.h" |
| 19 #include "fpdfsdk/include/fsdk_mgr.h" | 19 #include "fpdfsdk/include/fsdk_mgr.h" |
| 20 | 20 |
| 21 #ifdef PDF_ENABLE_XFA | 21 #ifdef PDF_ENABLE_XFA |
| 22 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" | 22 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" |
| 23 #endif // PDF_ENABLE_XFA | 23 #endif // PDF_ENABLE_XFA |
| 24 | 24 |
| 25 CPDFSDK_WidgetHandler::CPDFSDK_WidgetHandler(CPDFDoc_Environment* pApp) | 25 CPDFSDK_WidgetHandler::CPDFSDK_WidgetHandler(CPDFDoc_Environment* pApp) |
| 26 : m_pApp(pApp), m_pFormFiller(nullptr) {} | 26 : m_pApp(pApp), m_pFormFiller(nullptr) {} |
| 27 | 27 |
| 28 CPDFSDK_WidgetHandler::~CPDFSDK_WidgetHandler() {} | 28 CPDFSDK_WidgetHandler::~CPDFSDK_WidgetHandler() {} |
| 29 | 29 |
| 30 CFX_ByteString CPDFSDK_WidgetHandler::GetType() { | |
| 31 return CFX_ByteString("Widget"); | |
| 32 } | |
| 33 | |
| 34 FX_BOOL CPDFSDK_WidgetHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { | 30 FX_BOOL CPDFSDK_WidgetHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { |
| 35 ASSERT(pAnnot->GetAnnotSubtype() == "Widget"); | 31 ASSERT(pAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::WIDGET); |
| 36 if (pAnnot->IsSignatureWidget()) | 32 if (pAnnot->IsSignatureWidget()) |
| 37 return FALSE; | 33 return FALSE; |
| 38 | 34 |
| 39 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot); | 35 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot); |
| 40 if (!pWidget->IsVisible()) | 36 if (!pWidget->IsVisible()) |
| 41 return FALSE; | 37 return FALSE; |
| 42 | 38 |
| 43 int nFieldFlags = pWidget->GetFieldFlags(); | 39 int nFieldFlags = pWidget->GetFieldFlags(); |
| 44 if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) | 40 if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) |
| 45 return FALSE; | 41 return FALSE; |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 | 298 |
| 303 FX_BOOL CPDFSDK_WidgetHandler::HitTest(CPDFSDK_PageView* pPageView, | 299 FX_BOOL CPDFSDK_WidgetHandler::HitTest(CPDFSDK_PageView* pPageView, |
| 304 CPDFSDK_Annot* pAnnot, | 300 CPDFSDK_Annot* pAnnot, |
| 305 const CFX_FloatPoint& point) { | 301 const CFX_FloatPoint& point) { |
| 306 ASSERT(pPageView); | 302 ASSERT(pPageView); |
| 307 ASSERT(pAnnot); | 303 ASSERT(pAnnot); |
| 308 | 304 |
| 309 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot); | 305 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot); |
| 310 return rect.Contains(point.x, point.y); | 306 return rect.Contains(point.x, point.y); |
| 311 } | 307 } |
| OLD | NEW |