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 "../../include/formfiller/FFL_FormFiller.h" | 7 #include "../../include/formfiller/FFL_FormFiller.h" |
8 #include "../../include/formfiller/FFL_Notify.h" | 8 #include "../../include/formfiller/FFL_Notify.h" |
9 #include "../../include/formfiller/FFL_CBA_Fontmap.h" | 9 #include "../../include/formfiller/FFL_CBA_Fontmap.h" |
10 | 10 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 ASSERT(pPageView != NULL); | 235 ASSERT(pPageView != NULL); |
236 | 236 |
237 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { | 237 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) { |
238 return pWnd->OnChar(nChar, nFlags); | 238 return pWnd->OnChar(nChar, nFlags); |
239 } | 239 } |
240 } | 240 } |
241 | 241 |
242 return FALSE; | 242 return FALSE; |
243 } | 243 } |
244 | 244 |
245 FX_BOOL CFFL_FormFiller::SetFocusForAnnot(CPDFSDK_Annot* pAnnot, | 245 void CFFL_FormFiller::SetFocusForAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { |
246 FX_UINT nFlag) { | |
247 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 246 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
248 CPDFXFA_Page* pPage = pWidget->GetPDFXFAPage(); | 247 CPDFXFA_Page* pPage = pWidget->GetPDFXFAPage(); |
249 CPDFSDK_Document* pDoc = m_pApp->GetSDKDocument(); | 248 CPDFSDK_Document* pDoc = m_pApp->GetSDKDocument(); |
250 CPDFSDK_PageView* pPageView = pDoc->GetPageView(pPage); | 249 CPDFSDK_PageView* pPageView = pDoc->GetPageView(pPage); |
251 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) | 250 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) |
252 pWnd->SetFocus(); | 251 pWnd->SetFocus(); |
253 | 252 |
254 m_bValid = TRUE; | 253 m_bValid = TRUE; |
255 FX_RECT rcRect = GetViewBBox(pPageView, pAnnot); | 254 FX_RECT rcRect = GetViewBBox(pPageView, pAnnot); |
256 InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); | 255 InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); |
257 return TRUE; | |
258 } | 256 } |
259 | 257 |
260 FX_BOOL CFFL_FormFiller::KillFocusForAnnot(CPDFSDK_Annot* pAnnot, | 258 void CFFL_FormFiller::KillFocusForAnnot(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) { |
261 FX_UINT nFlag) { | |
262 if (!IsValid()) | 259 if (!IsValid()) |
263 return TRUE; | 260 return; |
264 | 261 |
265 CPDFSDK_PageView* pPageView = GetCurPageView(); | 262 CPDFSDK_PageView* pPageView = GetCurPageView(); |
| 263 if (!pPageView) |
| 264 return; |
| 265 |
266 CommitData(pPageView, nFlag); | 266 CommitData(pPageView, nFlag); |
267 | 267 |
268 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) | 268 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) |
269 pWnd->KillFocus(); | 269 pWnd->KillFocus(); |
270 | 270 |
| 271 FX_BOOL bDestroyPDFWindow; |
271 switch (m_pWidget->GetFieldType()) { | 272 switch (m_pWidget->GetFieldType()) { |
272 case FIELDTYPE_PUSHBUTTON: | 273 case FIELDTYPE_PUSHBUTTON: |
273 case FIELDTYPE_CHECKBOX: | 274 case FIELDTYPE_CHECKBOX: |
274 case FIELDTYPE_RADIOBUTTON: | 275 case FIELDTYPE_RADIOBUTTON: |
275 EscapeFiller(pPageView, TRUE); | 276 bDestroyPDFWindow = TRUE; |
276 break; | |
277 default: | 277 default: |
278 EscapeFiller(pPageView, FALSE); | 278 bDestroyPDFWindow = FALSE; |
279 break; | |
280 } | 279 } |
281 return TRUE; | 280 EscapeFiller(pPageView, bDestroyPDFWindow); |
282 } | 281 } |
283 | 282 |
284 FX_BOOL CFFL_FormFiller::IsValid() const { | 283 FX_BOOL CFFL_FormFiller::IsValid() const { |
285 return m_bValid; | 284 return m_bValid; |
286 } | 285 } |
287 | 286 |
288 PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() { | 287 PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() { |
289 ASSERT(m_pApp != NULL); | 288 ASSERT(m_pApp != NULL); |
290 | 289 |
291 PWL_CREATEPARAM cp; | 290 PWL_CREATEPARAM cp; |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); | 720 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); |
722 } | 721 } |
723 | 722 |
724 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, | 723 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView* pPageView, |
725 CPDFSDK_Annot* pAnnot, | 724 CPDFSDK_Annot* pAnnot, |
726 CFX_RenderDevice* pDevice, | 725 CFX_RenderDevice* pDevice, |
727 CPDF_Matrix* pUser2Device, | 726 CPDF_Matrix* pUser2Device, |
728 FX_DWORD dwFlags) { | 727 FX_DWORD dwFlags) { |
729 OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); | 728 OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); |
730 } | 729 } |
OLD | NEW |