| 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/cpdfsdk_widgethandler.h" | 7 #include "fpdfsdk/cpdfsdk_widgethandler.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #ifdef PDF_ENABLE_XFA | 22 #ifdef PDF_ENABLE_XFA |
| 23 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h" | 23 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h" |
| 24 #endif // PDF_ENABLE_XFA | 24 #endif // PDF_ENABLE_XFA |
| 25 | 25 |
| 26 CPDFSDK_WidgetHandler::CPDFSDK_WidgetHandler( | 26 CPDFSDK_WidgetHandler::CPDFSDK_WidgetHandler( |
| 27 CPDFSDK_FormFillEnvironment* pFormFillEnv) | 27 CPDFSDK_FormFillEnvironment* pFormFillEnv) |
| 28 : m_pFormFillEnv(pFormFillEnv), m_pFormFiller(nullptr) {} | 28 : m_pFormFillEnv(pFormFillEnv), m_pFormFiller(nullptr) {} |
| 29 | 29 |
| 30 CPDFSDK_WidgetHandler::~CPDFSDK_WidgetHandler() {} | 30 CPDFSDK_WidgetHandler::~CPDFSDK_WidgetHandler() {} |
| 31 | 31 |
| 32 FX_BOOL CPDFSDK_WidgetHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { | 32 bool CPDFSDK_WidgetHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { |
| 33 ASSERT(pAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::WIDGET); | 33 ASSERT(pAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::WIDGET); |
| 34 if (pAnnot->IsSignatureWidget()) | 34 if (pAnnot->IsSignatureWidget()) |
| 35 return FALSE; | 35 return false; |
| 36 | 36 |
| 37 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot); | 37 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot); |
| 38 if (!pWidget->IsVisible()) | 38 if (!pWidget->IsVisible()) |
| 39 return FALSE; | 39 return false; |
| 40 | 40 |
| 41 int nFieldFlags = pWidget->GetFieldFlags(); | 41 int nFieldFlags = pWidget->GetFieldFlags(); |
| 42 if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) | 42 if ((nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY) |
| 43 return FALSE; | 43 return false; |
| 44 | 44 |
| 45 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) | 45 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) |
| 46 return TRUE; | 46 return true; |
| 47 | 47 |
| 48 CPDF_Page* pPage = pWidget->GetPDFPage(); | 48 CPDF_Page* pPage = pWidget->GetPDFPage(); |
| 49 CPDF_Document* pDocument = pPage->m_pDocument; | 49 CPDF_Document* pDocument = pPage->m_pDocument; |
| 50 uint32_t dwPermissions = pDocument->GetUserPermissions(); | 50 uint32_t dwPermissions = pDocument->GetUserPermissions(); |
| 51 return (dwPermissions & FPDFPERM_FILL_FORM) || | 51 return (dwPermissions & FPDFPERM_FILL_FORM) || |
| 52 (dwPermissions & FPDFPERM_ANNOT_FORM); | 52 (dwPermissions & FPDFPERM_ANNOT_FORM); |
| 53 } | 53 } |
| 54 | 54 |
| 55 CPDFSDK_Annot* CPDFSDK_WidgetHandler::NewAnnot(CPDF_Annot* pAnnot, | 55 CPDFSDK_Annot* CPDFSDK_WidgetHandler::NewAnnot(CPDF_Annot* pAnnot, |
| 56 CPDFSDK_PageView* pPage) { | 56 CPDFSDK_PageView* pPage) { |
| 57 CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm(); | 57 CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm(); |
| 58 CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl( | 58 CPDF_FormControl* pCtrl = CPDFSDK_Widget::GetFormControl( |
| 59 pInterForm->GetInterForm(), pAnnot->GetAnnotDict()); | 59 pInterForm->GetInterForm(), pAnnot->GetAnnotDict()); |
| 60 if (!pCtrl) | 60 if (!pCtrl) |
| 61 return nullptr; | 61 return nullptr; |
| 62 | 62 |
| 63 CPDFSDK_Widget* pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm); | 63 CPDFSDK_Widget* pWidget = new CPDFSDK_Widget(pAnnot, pPage, pInterForm); |
| 64 pInterForm->AddMap(pCtrl, pWidget); | 64 pInterForm->AddMap(pCtrl, pWidget); |
| 65 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); | 65 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); |
| 66 if (pPDFInterForm && pPDFInterForm->NeedConstructAP()) | 66 if (pPDFInterForm && pPDFInterForm->NeedConstructAP()) |
| 67 pWidget->ResetAppearance(nullptr, FALSE); | 67 pWidget->ResetAppearance(nullptr, false); |
| 68 | 68 |
| 69 return pWidget; | 69 return pWidget; |
| 70 } | 70 } |
| 71 | 71 |
| 72 #ifdef PDF_ENABLE_XFA | 72 #ifdef PDF_ENABLE_XFA |
| 73 CPDFSDK_Annot* CPDFSDK_WidgetHandler::NewAnnot(CXFA_FFWidget* hWidget, | 73 CPDFSDK_Annot* CPDFSDK_WidgetHandler::NewAnnot(CXFA_FFWidget* hWidget, |
| 74 CPDFSDK_PageView* pPage) { | 74 CPDFSDK_PageView* pPage) { |
| 75 return nullptr; | 75 return nullptr; |
| 76 } | 76 } |
| 77 #endif // PDF_ENABLE_XFA | 77 #endif // PDF_ENABLE_XFA |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 m_pFormFiller->OnMouseEnter(pPageView, pAnnot, nFlag); | 109 m_pFormFiller->OnMouseEnter(pPageView, pAnnot, nFlag); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void CPDFSDK_WidgetHandler::OnMouseExit(CPDFSDK_PageView* pPageView, | 112 void CPDFSDK_WidgetHandler::OnMouseExit(CPDFSDK_PageView* pPageView, |
| 113 CPDFSDK_Annot::ObservedPtr* pAnnot, | 113 CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 114 uint32_t nFlag) { | 114 uint32_t nFlag) { |
| 115 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) | 115 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) |
| 116 m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag); | 116 m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag); |
| 117 } | 117 } |
| 118 | 118 |
| 119 FX_BOOL CPDFSDK_WidgetHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, | 119 bool CPDFSDK_WidgetHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, |
| 120 CPDFSDK_Annot::ObservedPtr* pAnnot, | 120 CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 121 uint32_t nFlags, | 121 uint32_t nFlags, |
| 122 const CFX_FloatPoint& point) { | 122 const CFX_FloatPoint& point) { |
| 123 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) | 123 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) |
| 124 return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point); | 124 return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point); |
| 125 | 125 |
| 126 return FALSE; | 126 return false; |
| 127 } | 127 } |
| 128 | 128 |
| 129 FX_BOOL CPDFSDK_WidgetHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, | 129 bool CPDFSDK_WidgetHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, |
| 130 CPDFSDK_Annot::ObservedPtr* pAnnot, | 130 CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 131 uint32_t nFlags, | 131 uint32_t nFlags, |
| 132 const CFX_FloatPoint& point) { | 132 const CFX_FloatPoint& point) { |
| 133 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) | 133 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) |
| 134 return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); | 134 return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); |
| 135 | 135 |
| 136 return FALSE; | 136 return false; |
| 137 } | 137 } |
| 138 | 138 |
| 139 FX_BOOL CPDFSDK_WidgetHandler::OnLButtonDblClk( | 139 bool CPDFSDK_WidgetHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView, |
| 140 CPDFSDK_PageView* pPageView, | 140 CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 141 CPDFSDK_Annot::ObservedPtr* pAnnot, | 141 uint32_t nFlags, |
| 142 uint32_t nFlags, | 142 const CFX_FloatPoint& point) { |
| 143 const CFX_FloatPoint& point) { | |
| 144 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) | 143 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) |
| 145 return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); | 144 return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); |
| 146 | 145 |
| 147 return FALSE; | 146 return false; |
| 148 } | 147 } |
| 149 | 148 |
| 150 FX_BOOL CPDFSDK_WidgetHandler::OnMouseMove(CPDFSDK_PageView* pPageView, | 149 bool CPDFSDK_WidgetHandler::OnMouseMove(CPDFSDK_PageView* pPageView, |
| 151 CPDFSDK_Annot::ObservedPtr* pAnnot, | 150 CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 152 uint32_t nFlags, | 151 uint32_t nFlags, |
| 153 const CFX_FloatPoint& point) { | 152 const CFX_FloatPoint& point) { |
| 154 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) | 153 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) |
| 155 return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); | 154 return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); |
| 156 | 155 |
| 157 return FALSE; | 156 return false; |
| 158 } | 157 } |
| 159 | 158 |
| 160 FX_BOOL CPDFSDK_WidgetHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, | 159 bool CPDFSDK_WidgetHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, |
| 161 CPDFSDK_Annot::ObservedPtr* pAnnot, | 160 CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 162 uint32_t nFlags, | 161 uint32_t nFlags, |
| 163 short zDelta, | 162 short zDelta, |
| 164 const CFX_FloatPoint& point) { | 163 const CFX_FloatPoint& point) { |
| 165 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) | 164 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) |
| 166 return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, | 165 return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, |
| 167 point); | 166 point); |
| 168 | 167 |
| 169 return FALSE; | 168 return false; |
| 170 } | 169 } |
| 171 | 170 |
| 172 FX_BOOL CPDFSDK_WidgetHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, | 171 bool CPDFSDK_WidgetHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, |
| 173 CPDFSDK_Annot::ObservedPtr* pAnnot, | 172 CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 174 uint32_t nFlags, | 173 uint32_t nFlags, |
| 175 const CFX_FloatPoint& point) { | 174 const CFX_FloatPoint& point) { |
| 176 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) | 175 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) |
| 177 return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); | 176 return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); |
| 178 | 177 |
| 179 return FALSE; | 178 return false; |
| 180 } | 179 } |
| 181 | 180 |
| 182 FX_BOOL CPDFSDK_WidgetHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, | 181 bool CPDFSDK_WidgetHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, |
| 183 CPDFSDK_Annot::ObservedPtr* pAnnot, | 182 CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 184 uint32_t nFlags, | 183 uint32_t nFlags, |
| 185 const CFX_FloatPoint& point) { | 184 const CFX_FloatPoint& point) { |
| 186 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) | 185 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) |
| 187 return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); | 186 return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); |
| 188 | 187 |
| 189 return FALSE; | 188 return false; |
| 190 } | 189 } |
| 191 | 190 |
| 192 FX_BOOL CPDFSDK_WidgetHandler::OnRButtonDblClk( | 191 bool CPDFSDK_WidgetHandler::OnRButtonDblClk(CPDFSDK_PageView* pPageView, |
| 193 CPDFSDK_PageView* pPageView, | 192 CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 194 CPDFSDK_Annot::ObservedPtr* pAnnot, | 193 uint32_t nFlags, |
| 195 uint32_t nFlags, | 194 const CFX_FloatPoint& point) { |
| 196 const CFX_FloatPoint& point) { | 195 return false; |
| 197 return FALSE; | |
| 198 } | 196 } |
| 199 | 197 |
| 200 FX_BOOL CPDFSDK_WidgetHandler::OnChar(CPDFSDK_Annot* pAnnot, | 198 bool CPDFSDK_WidgetHandler::OnChar(CPDFSDK_Annot* pAnnot, |
| 201 uint32_t nChar, | 199 uint32_t nChar, |
| 202 uint32_t nFlags) { | 200 uint32_t nFlags) { |
| 203 if (!pAnnot->IsSignatureWidget() && m_pFormFiller) | 201 if (!pAnnot->IsSignatureWidget() && m_pFormFiller) |
| 204 return m_pFormFiller->OnChar(pAnnot, nChar, nFlags); | 202 return m_pFormFiller->OnChar(pAnnot, nChar, nFlags); |
| 205 | 203 |
| 206 return FALSE; | 204 return false; |
| 207 } | 205 } |
| 208 | 206 |
| 209 FX_BOOL CPDFSDK_WidgetHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, | 207 bool CPDFSDK_WidgetHandler::OnKeyDown(CPDFSDK_Annot* pAnnot, |
| 210 int nKeyCode, | 208 int nKeyCode, |
| 211 int nFlag) { | 209 int nFlag) { |
| 212 if (!pAnnot->IsSignatureWidget() && m_pFormFiller) | 210 if (!pAnnot->IsSignatureWidget() && m_pFormFiller) |
| 213 return m_pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlag); | 211 return m_pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlag); |
| 214 | 212 |
| 215 return FALSE; | 213 return false; |
| 216 } | 214 } |
| 217 | 215 |
| 218 FX_BOOL CPDFSDK_WidgetHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, | 216 bool CPDFSDK_WidgetHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, |
| 219 int nKeyCode, | 217 int nKeyCode, |
| 220 int nFlag) { | 218 int nFlag) { |
| 221 return FALSE; | 219 return false; |
| 222 } | 220 } |
| 223 | 221 |
| 224 void CPDFSDK_WidgetHandler::OnLoad(CPDFSDK_Annot* pAnnot) { | 222 void CPDFSDK_WidgetHandler::OnLoad(CPDFSDK_Annot* pAnnot) { |
| 225 if (pAnnot->IsSignatureWidget()) | 223 if (pAnnot->IsSignatureWidget()) |
| 226 return; | 224 return; |
| 227 | 225 |
| 228 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot); | 226 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot); |
| 229 if (!pWidget->IsAppearanceValid()) | 227 if (!pWidget->IsAppearanceValid()) |
| 230 pWidget->ResetAppearance(nullptr, FALSE); | 228 pWidget->ResetAppearance(nullptr, false); |
| 231 | 229 |
| 232 int nFieldType = pWidget->GetFieldType(); | 230 int nFieldType = pWidget->GetFieldType(); |
| 233 if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) { | 231 if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) { |
| 234 FX_BOOL bFormatted = FALSE; | 232 bool bFormatted = false; |
| 235 CFX_WideString sValue = pWidget->OnFormat(bFormatted); | 233 CFX_WideString sValue = pWidget->OnFormat(bFormatted); |
| 236 if (bFormatted && nFieldType == FIELDTYPE_COMBOBOX) | 234 if (bFormatted && nFieldType == FIELDTYPE_COMBOBOX) |
| 237 pWidget->ResetAppearance(&sValue, FALSE); | 235 pWidget->ResetAppearance(&sValue, false); |
| 238 } | 236 } |
| 239 | 237 |
| 240 #ifdef PDF_ENABLE_XFA | 238 #ifdef PDF_ENABLE_XFA |
| 241 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); | 239 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); |
| 242 CPDFXFA_Context* pContext = pPageView->GetFormFillEnv()->GetXFAContext(); | 240 CPDFXFA_Context* pContext = pPageView->GetFormFillEnv()->GetXFAContext(); |
| 243 if (pContext->GetDocType() == DOCTYPE_STATIC_XFA) { | 241 if (pContext->GetDocType() == DOCTYPE_STATIC_XFA) { |
| 244 if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty()) | 242 if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty()) |
| 245 pWidget->ResetAppearance(FALSE); | 243 pWidget->ResetAppearance(false); |
| 246 } | 244 } |
| 247 #endif // PDF_ENABLE_XFA | 245 #endif // PDF_ENABLE_XFA |
| 248 } | 246 } |
| 249 | 247 |
| 250 FX_BOOL CPDFSDK_WidgetHandler::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, | 248 bool CPDFSDK_WidgetHandler::OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 251 uint32_t nFlag) { | 249 uint32_t nFlag) { |
| 252 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) | 250 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) |
| 253 return m_pFormFiller->OnSetFocus(pAnnot, nFlag); | 251 return m_pFormFiller->OnSetFocus(pAnnot, nFlag); |
| 254 | 252 |
| 255 return TRUE; | 253 return true; |
| 256 } | 254 } |
| 257 | 255 |
| 258 FX_BOOL CPDFSDK_WidgetHandler::OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, | 256 bool CPDFSDK_WidgetHandler::OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, |
| 259 uint32_t nFlag) { | 257 uint32_t nFlag) { |
| 260 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) | 258 if (!(*pAnnot)->IsSignatureWidget() && m_pFormFiller) |
| 261 return m_pFormFiller->OnKillFocus(pAnnot, nFlag); | 259 return m_pFormFiller->OnKillFocus(pAnnot, nFlag); |
| 262 | 260 |
| 263 return TRUE; | 261 return true; |
| 264 } | 262 } |
| 265 | 263 |
| 266 #ifdef PDF_ENABLE_XFA | 264 #ifdef PDF_ENABLE_XFA |
| 267 FX_BOOL CPDFSDK_WidgetHandler::OnXFAChangedFocus( | 265 bool CPDFSDK_WidgetHandler::OnXFAChangedFocus( |
| 268 CPDFSDK_Annot::ObservedPtr* pOldAnnot, | 266 CPDFSDK_Annot::ObservedPtr* pOldAnnot, |
| 269 CPDFSDK_Annot::ObservedPtr* pNewAnnot) { | 267 CPDFSDK_Annot::ObservedPtr* pNewAnnot) { |
| 270 return TRUE; | 268 return true; |
| 271 } | 269 } |
| 272 #endif // PDF_ENABLE_XFA | 270 #endif // PDF_ENABLE_XFA |
| 273 | 271 |
| 274 CFX_FloatRect CPDFSDK_WidgetHandler::GetViewBBox(CPDFSDK_PageView* pPageView, | 272 CFX_FloatRect CPDFSDK_WidgetHandler::GetViewBBox(CPDFSDK_PageView* pPageView, |
| 275 CPDFSDK_Annot* pAnnot) { | 273 CPDFSDK_Annot* pAnnot) { |
| 276 if (!pAnnot->IsSignatureWidget() && m_pFormFiller) | 274 if (!pAnnot->IsSignatureWidget() && m_pFormFiller) |
| 277 return CFX_FloatRect(m_pFormFiller->GetViewBBox(pPageView, pAnnot)); | 275 return CFX_FloatRect(m_pFormFiller->GetViewBBox(pPageView, pAnnot)); |
| 278 | 276 |
| 279 return CFX_FloatRect(0, 0, 0, 0); | 277 return CFX_FloatRect(0, 0, 0, 0); |
| 280 } | 278 } |
| 281 | 279 |
| 282 FX_BOOL CPDFSDK_WidgetHandler::HitTest(CPDFSDK_PageView* pPageView, | 280 bool CPDFSDK_WidgetHandler::HitTest(CPDFSDK_PageView* pPageView, |
| 283 CPDFSDK_Annot* pAnnot, | 281 CPDFSDK_Annot* pAnnot, |
| 284 const CFX_FloatPoint& point) { | 282 const CFX_FloatPoint& point) { |
| 285 ASSERT(pPageView); | 283 ASSERT(pPageView); |
| 286 ASSERT(pAnnot); | 284 ASSERT(pAnnot); |
| 287 | 285 |
| 288 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot); | 286 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot); |
| 289 return rect.Contains(point.x, point.y); | 287 return rect.Contains(point.x, point.y); |
| 290 } | 288 } |
| OLD | NEW |