Chromium Code Reviews| 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/include/formfiller/FFL_CheckBox.h" | 7 #include "fpdfsdk/include/formfiller/FFL_CheckBox.h" |
| 8 #include "fpdfsdk/include/formfiller/FFL_ComboBox.h" | 8 #include "fpdfsdk/include/formfiller/FFL_ComboBox.h" |
| 9 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" | 9 #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" |
| 10 #include "fpdfsdk/include/formfiller/FFL_IFormFiller.h" | 10 #include "fpdfsdk/include/formfiller/FFL_IFormFiller.h" |
| 11 #include "fpdfsdk/include/formfiller/FFL_ListBox.h" | 11 #include "fpdfsdk/include/formfiller/FFL_ListBox.h" |
| 12 #include "fpdfsdk/include/formfiller/FFL_PushButton.h" | 12 #include "fpdfsdk/include/formfiller/FFL_PushButton.h" |
| 13 #include "fpdfsdk/include/formfiller/FFL_RadioButton.h" | 13 #include "fpdfsdk/include/formfiller/FFL_RadioButton.h" |
| 14 #include "fpdfsdk/include/formfiller/FFL_TextField.h" | 14 #include "fpdfsdk/include/formfiller/FFL_TextField.h" |
| 15 | 15 |
| 16 #define FFL_MAXLISTBOXHEIGHT 140.0f | 16 #define FFL_MAXLISTBOXHEIGHT 140.0f |
| 17 | 17 |
| 18 // HHOOK CFFL_IFormFiller::m_hookSheet = NULL; | |
| 19 // MSG CFFL_IFormFiller::g_Msg; | |
| 20 | |
| 21 /* ----------------------------- CFFL_IFormFiller ----------------------------- | |
| 22 */ | |
| 23 | |
| 24 CFFL_IFormFiller::CFFL_IFormFiller(CPDFDoc_Environment* pApp) | 18 CFFL_IFormFiller::CFFL_IFormFiller(CPDFDoc_Environment* pApp) |
| 25 : m_pApp(pApp), m_bNotifying(FALSE) {} | 19 : m_pApp(pApp), m_bNotifying(FALSE) {} |
| 26 | 20 |
| 27 CFFL_IFormFiller::~CFFL_IFormFiller() { | 21 CFFL_IFormFiller::~CFFL_IFormFiller() { |
| 28 for (auto& it : m_Maps) | 22 for (auto& it : m_Maps) |
| 29 delete it.second; | 23 delete it.second; |
| 30 m_Maps.clear(); | 24 m_Maps.clear(); |
| 31 } | 25 } |
| 32 | 26 |
| 33 FX_BOOL CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView, | 27 FX_BOOL CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView, |
| 34 CPDFSDK_Annot* pAnnot, | 28 CPDFSDK_Annot* pAnnot, |
| 35 CPDF_Point point) { | 29 CPDF_Point point) { |
| 36 CPDF_Rect rc = pAnnot->GetRect(); | 30 CPDF_Rect rc = pAnnot->GetRect(); |
| 37 if (rc.Contains(point.x, point.y)) | 31 if (rc.Contains(point.x, point.y)) |
| 38 return TRUE; | 32 return TRUE; |
| 39 return FALSE; | 33 return FALSE; |
| 40 } | 34 } |
| 41 | 35 |
| 42 FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, | 36 FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, |
| 43 CPDFSDK_Annot* pAnnot) { | 37 CPDFSDK_Annot* pAnnot) { |
| 44 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 38 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 45 return pFormFiller->GetViewBBox(pPageView, pAnnot); | 39 return pFormFiller->GetViewBBox(pPageView, pAnnot); |
| 46 | 40 |
| 47 ASSERT(pPageView != NULL); | 41 ASSERT(pPageView); |
| 48 | 42 |
| 49 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); | 43 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); |
| 50 CPDF_Rect rcAnnot; | 44 CPDF_Rect rcAnnot; |
| 51 pPDFAnnot->GetRect(rcAnnot); | 45 pPDFAnnot->GetRect(rcAnnot); |
| 52 | 46 |
| 53 CPDF_Rect rcWin = CPWL_Utils::InflateRect(rcAnnot, 1); | 47 CPDF_Rect rcWin = CPWL_Utils::InflateRect(rcAnnot, 1); |
| 54 return rcWin.GetOutterRect(); | 48 return rcWin.GetOutterRect(); |
| 55 } | 49 } |
| 56 | 50 |
| 57 void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, | 51 void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, |
| 58 /*HDC hDC,*/ CPDFSDK_Annot* pAnnot, | 52 CPDFSDK_Annot* pAnnot, |
| 59 CFX_RenderDevice* pDevice, | 53 CFX_RenderDevice* pDevice, |
| 60 CPDF_Matrix* pUser2Device, | 54 CPDF_Matrix* pUser2Device, |
| 61 /*const CRect& rcWindow,*/ FX_DWORD dwFlags) { | 55 FX_DWORD dwFlags) { |
| 62 ASSERT(pPageView != NULL); | 56 ASSERT(pPageView); |
| 63 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 57 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 64 | 58 |
| 65 if (IsVisible(pWidget)) { | 59 if (IsVisible(pWidget)) { |
| 66 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 60 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
| 67 if (pFormFiller->IsValid()) { | 61 if (pFormFiller->IsValid()) { |
| 68 pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); | 62 pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); |
| 69 pAnnot->GetPDFPage(); | 63 pAnnot->GetPDFPage(); |
| 70 | 64 |
| 71 CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); | 65 CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); |
| 72 if (pDocument->GetFocusAnnot() == pAnnot) { | 66 if (pDocument->GetFocusAnnot() == pAnnot) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 114 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
| 121 pFormFiller->OnDelete(pAnnot); | 115 pFormFiller->OnDelete(pAnnot); |
| 122 } | 116 } |
| 123 | 117 |
| 124 UnRegisterFormFiller(pAnnot); | 118 UnRegisterFormFiller(pAnnot); |
| 125 } | 119 } |
| 126 | 120 |
| 127 void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, | 121 void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, |
| 128 CPDFSDK_Annot* pAnnot, | 122 CPDFSDK_Annot* pAnnot, |
| 129 FX_UINT nFlag) { | 123 FX_UINT nFlag) { |
| 130 ASSERT(pAnnot != NULL); | 124 ASSERT(pAnnot); |
| 131 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 125 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 132 | 126 |
| 133 if (!m_bNotifying) { | 127 if (!m_bNotifying) { |
| 134 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 128 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 135 if (pWidget->GetAAction(CPDF_AAction::CursorEnter)) { | 129 if (pWidget->GetAAction(CPDF_AAction::CursorEnter)) { |
| 136 m_bNotifying = TRUE; | 130 m_bNotifying = TRUE; |
| 137 | 131 |
| 138 int nValueAge = pWidget->GetValueAge(); | 132 int nValueAge = pWidget->GetValueAge(); |
| 139 | 133 |
| 140 pWidget->ClearAppModified(); | 134 pWidget->ClearAppModified(); |
| 141 | 135 |
| 142 ASSERT(pPageView != NULL); | 136 ASSERT(pPageView); |
| 143 | 137 |
| 144 PDFSDK_FieldAction fa; | 138 PDFSDK_FieldAction fa; |
| 145 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 139 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 146 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 140 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 147 pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView); | 141 pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView); |
| 148 m_bNotifying = FALSE; | 142 m_bNotifying = FALSE; |
| 149 | 143 |
| 150 // if ( !IsValidAnnot(pPageView, pAnnot) ) return; | |
| 151 | |
| 152 if (pWidget->IsAppModified()) { | 144 if (pWidget->IsAppModified()) { |
| 153 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { | 145 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
| 154 pFormFiller->ResetPDFWindow(pPageView, | 146 pFormFiller->ResetPDFWindow(pPageView, |
| 155 pWidget->GetValueAge() == nValueAge); | 147 pWidget->GetValueAge() == nValueAge); |
| 156 } | 148 } |
| 157 } | 149 } |
| 158 } | 150 } |
| 159 } | 151 } |
| 160 | 152 |
| 161 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) { | 153 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) { |
| 162 pFormFiller->OnMouseEnter(pPageView, pAnnot); | 154 pFormFiller->OnMouseEnter(pPageView, pAnnot); |
| 163 } | 155 } |
| 164 } | 156 } |
| 165 | 157 |
| 166 void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, | 158 void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, |
| 167 CPDFSDK_Annot* pAnnot, | 159 CPDFSDK_Annot* pAnnot, |
| 168 FX_UINT nFlag) { | 160 FX_UINT nFlag) { |
| 169 ASSERT(pAnnot != NULL); | 161 ASSERT(pAnnot); |
|
Tom Sepez
2015/12/14 19:14:11
nit: Assert below segvs otherwise.
Lei Zhang
2015/12/15 01:38:33
Done.
| |
| 170 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 162 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 171 | 163 |
| 172 if (!m_bNotifying) { | 164 if (!m_bNotifying) { |
| 173 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 165 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 174 if (pWidget->GetAAction(CPDF_AAction::CursorExit)) { | 166 if (pWidget->GetAAction(CPDF_AAction::CursorExit)) { |
| 175 m_bNotifying = TRUE; | 167 m_bNotifying = TRUE; |
| 176 pWidget->GetAppearanceAge(); | 168 pWidget->GetAppearanceAge(); |
| 177 int nValueAge = pWidget->GetValueAge(); | 169 int nValueAge = pWidget->GetValueAge(); |
| 178 pWidget->ClearAppModified(); | 170 pWidget->ClearAppModified(); |
| 179 | 171 |
| 180 ASSERT(pPageView != NULL); | 172 ASSERT(pPageView); |
| 181 | 173 |
| 182 PDFSDK_FieldAction fa; | 174 PDFSDK_FieldAction fa; |
| 183 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 175 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 184 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 176 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 185 | 177 |
| 186 pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView); | 178 pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView); |
| 187 m_bNotifying = FALSE; | 179 m_bNotifying = FALSE; |
| 188 | 180 |
| 189 // if (!IsValidAnnot(pPageView, pAnnot)) return; | |
| 190 | |
| 191 if (pWidget->IsAppModified()) { | 181 if (pWidget->IsAppModified()) { |
| 192 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { | 182 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
| 193 pFormFiller->ResetPDFWindow(pPageView, | 183 pFormFiller->ResetPDFWindow(pPageView, |
| 194 nValueAge == pWidget->GetValueAge()); | 184 nValueAge == pWidget->GetValueAge()); |
| 195 } | 185 } |
| 196 } | 186 } |
| 197 } | 187 } |
| 198 } | 188 } |
| 199 | 189 |
| 200 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 190 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
| 201 pFormFiller->OnMouseExit(pPageView, pAnnot); | 191 pFormFiller->OnMouseExit(pPageView, pAnnot); |
| 202 } | 192 } |
| 203 } | 193 } |
| 204 | 194 |
| 205 FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, | 195 FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, |
| 206 CPDFSDK_Annot* pAnnot, | 196 CPDFSDK_Annot* pAnnot, |
| 207 FX_UINT nFlags, | 197 FX_UINT nFlags, |
| 208 const CPDF_Point& point) { | 198 const CPDF_Point& point) { |
| 209 ASSERT(pAnnot != NULL); | 199 ASSERT(pAnnot); |
| 210 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 200 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
|
Tom Sepez
2015/12/14 19:14:11
nitto
Lei Zhang
2015/12/15 01:38:33
Done.
| |
| 211 | 201 |
| 212 if (!m_bNotifying) { | 202 if (!m_bNotifying) { |
| 213 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 203 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 214 if (Annot_HitTest(pPageView, pAnnot, point) && | 204 if (Annot_HitTest(pPageView, pAnnot, point) && |
| 215 pWidget->GetAAction(CPDF_AAction::ButtonDown)) { | 205 pWidget->GetAAction(CPDF_AAction::ButtonDown)) { |
| 216 m_bNotifying = TRUE; | 206 m_bNotifying = TRUE; |
| 217 pWidget->GetAppearanceAge(); | 207 pWidget->GetAppearanceAge(); |
| 218 int nValueAge = pWidget->GetValueAge(); | 208 int nValueAge = pWidget->GetValueAge(); |
| 219 pWidget->ClearAppModified(); | 209 pWidget->ClearAppModified(); |
| 220 | 210 |
| 221 ASSERT(pPageView != NULL); | 211 ASSERT(pPageView); |
| 222 | 212 |
| 223 PDFSDK_FieldAction fa; | 213 PDFSDK_FieldAction fa; |
| 224 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlags); | 214 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlags); |
| 225 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlags); | 215 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlags); |
| 226 pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageView); | 216 pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageView); |
| 227 m_bNotifying = FALSE; | 217 m_bNotifying = FALSE; |
| 228 | 218 |
| 229 if (!IsValidAnnot(pPageView, pAnnot)) | 219 if (!IsValidAnnot(pPageView, pAnnot)) |
| 230 return TRUE; | 220 return TRUE; |
| 231 | 221 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 279 return TRUE; | 269 return TRUE; |
| 280 } | 270 } |
| 281 return bRet; | 271 return bRet; |
| 282 } | 272 } |
| 283 | 273 |
| 284 void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, | 274 void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, |
| 285 CPDFSDK_PageView* pPageView, | 275 CPDFSDK_PageView* pPageView, |
| 286 FX_BOOL& bReset, | 276 FX_BOOL& bReset, |
| 287 FX_BOOL& bExit, | 277 FX_BOOL& bExit, |
| 288 FX_UINT nFlag) { | 278 FX_UINT nFlag) { |
| 289 ASSERT(pWidget != NULL); | 279 ASSERT(pWidget); |
| 290 | 280 |
| 291 if (!m_bNotifying) { | 281 if (!m_bNotifying) { |
| 292 if (pWidget->GetAAction(CPDF_AAction::ButtonUp)) { | 282 if (pWidget->GetAAction(CPDF_AAction::ButtonUp)) { |
| 293 m_bNotifying = TRUE; | 283 m_bNotifying = TRUE; |
| 294 int nAge = pWidget->GetAppearanceAge(); | 284 int nAge = pWidget->GetAppearanceAge(); |
| 295 int nValueAge = pWidget->GetValueAge(); | 285 int nValueAge = pWidget->GetValueAge(); |
| 296 | 286 |
| 297 ASSERT(pPageView != NULL); | 287 ASSERT(pPageView); |
| 298 // CReader_DocView* pDocView = pPageView->GetDocView(); | |
| 299 // ASSERT(pDocView != NULL); | |
| 300 | 288 |
| 301 PDFSDK_FieldAction fa; | 289 PDFSDK_FieldAction fa; |
| 302 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 290 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 303 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 291 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 304 | 292 |
| 305 pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView); | 293 pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView); |
| 306 m_bNotifying = FALSE; | 294 m_bNotifying = FALSE; |
| 307 | 295 |
| 308 if (!IsValidAnnot(pPageView, pWidget)) { | 296 if (!IsValidAnnot(pPageView, pWidget)) { |
| 309 bExit = TRUE; | 297 bExit = TRUE; |
| 310 return; | 298 return; |
| 311 } | 299 } |
| 312 | 300 |
| 313 if (nAge != pWidget->GetAppearanceAge()) { | 301 if (nAge != pWidget->GetAppearanceAge()) { |
| 314 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { | 302 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
| 315 pFormFiller->ResetPDFWindow(pPageView, | 303 pFormFiller->ResetPDFWindow(pPageView, |
| 316 nValueAge == pWidget->GetValueAge()); | 304 nValueAge == pWidget->GetValueAge()); |
| 317 } | 305 } |
| 318 | 306 |
| 319 bReset = TRUE; | 307 bReset = TRUE; |
| 320 } | 308 } |
| 321 } | 309 } |
| 322 } | 310 } |
| 323 } | 311 } |
| 324 | 312 |
| 325 FX_BOOL CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, | 313 FX_BOOL CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, |
| 326 CPDFSDK_Annot* pAnnot, | 314 CPDFSDK_Annot* pAnnot, |
| 327 FX_UINT nFlags, | 315 FX_UINT nFlags, |
| 328 const CPDF_Point& point) { | 316 const CPDF_Point& point) { |
| 329 ASSERT(pAnnot != NULL); | 317 ASSERT(pAnnot); |
| 330 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 318 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
|
Tom Sepez
2015/12/14 19:14:11
nitto, several other places.
Lei Zhang
2015/12/15 01:38:33
Done.
| |
| 331 | 319 |
| 332 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 320 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
| 333 return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); | 321 return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); |
| 334 } | 322 } |
| 335 | 323 |
| 336 return FALSE; | 324 return FALSE; |
| 337 } | 325 } |
| 338 | 326 |
| 339 FX_BOOL CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, | 327 FX_BOOL CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, |
| 340 CPDFSDK_Annot* pAnnot, | 328 CPDFSDK_Annot* pAnnot, |
| 341 FX_UINT nFlags, | 329 FX_UINT nFlags, |
| 342 const CPDF_Point& point) { | 330 const CPDF_Point& point) { |
| 343 ASSERT(pAnnot != NULL); | 331 ASSERT(pAnnot); |
| 344 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 332 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 345 | 333 |
| 346 // change cursor | 334 // change cursor |
| 347 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) { | 335 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) { |
| 348 return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); | 336 return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); |
| 349 } | 337 } |
| 350 | 338 |
| 351 return FALSE; | 339 return FALSE; |
| 352 } | 340 } |
| 353 | 341 |
| 354 FX_BOOL CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, | 342 FX_BOOL CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, |
| 355 CPDFSDK_Annot* pAnnot, | 343 CPDFSDK_Annot* pAnnot, |
| 356 FX_UINT nFlags, | 344 FX_UINT nFlags, |
| 357 short zDelta, | 345 short zDelta, |
| 358 const CPDF_Point& point) { | 346 const CPDF_Point& point) { |
| 359 ASSERT(pAnnot != NULL); | 347 ASSERT(pAnnot); |
| 360 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 348 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 361 | 349 |
| 362 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 350 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
| 363 return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point); | 351 return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point); |
| 364 } | 352 } |
| 365 | 353 |
| 366 return FALSE; | 354 return FALSE; |
| 367 } | 355 } |
| 368 | 356 |
| 369 FX_BOOL CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, | 357 FX_BOOL CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, |
| 370 CPDFSDK_Annot* pAnnot, | 358 CPDFSDK_Annot* pAnnot, |
| 371 FX_UINT nFlags, | 359 FX_UINT nFlags, |
| 372 const CPDF_Point& point) { | 360 const CPDF_Point& point) { |
| 373 ASSERT(pAnnot != NULL); | 361 ASSERT(pAnnot); |
| 374 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 362 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 375 | 363 |
| 376 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 364 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
| 377 return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); | 365 return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); |
| 378 } | 366 } |
| 379 | 367 |
| 380 return FALSE; | 368 return FALSE; |
| 381 } | 369 } |
| 382 | 370 |
| 383 FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, | 371 FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, |
| 384 CPDFSDK_Annot* pAnnot, | 372 CPDFSDK_Annot* pAnnot, |
| 385 FX_UINT nFlags, | 373 FX_UINT nFlags, |
| 386 const CPDF_Point& point) { | 374 const CPDF_Point& point) { |
| 387 ASSERT(pAnnot != NULL); | 375 ASSERT(pAnnot); |
| 388 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 376 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 389 | 377 |
| 390 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 378 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
| 391 return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); | 379 return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); |
| 392 } | 380 } |
| 393 | 381 |
| 394 return FALSE; | 382 return FALSE; |
| 395 } | 383 } |
| 396 | 384 |
| 397 FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, | 385 FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, |
| 398 FX_UINT nKeyCode, | 386 FX_UINT nKeyCode, |
| 399 FX_UINT nFlags) { | 387 FX_UINT nFlags) { |
| 400 ASSERT(pAnnot != NULL); | 388 ASSERT(pAnnot); |
| 401 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 389 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 402 | 390 |
| 403 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 391 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
| 404 return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); | 392 return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); |
| 405 } | 393 } |
| 406 | 394 |
| 407 return FALSE; | 395 return FALSE; |
| 408 } | 396 } |
| 409 | 397 |
| 410 FX_BOOL CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot, | 398 FX_BOOL CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot, |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 429 if (!m_bNotifying) { | 417 if (!m_bNotifying) { |
| 430 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 418 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 431 if (pWidget->GetAAction(CPDF_AAction::GetFocus)) { | 419 if (pWidget->GetAAction(CPDF_AAction::GetFocus)) { |
| 432 m_bNotifying = TRUE; | 420 m_bNotifying = TRUE; |
| 433 pWidget->GetAppearanceAge(); | 421 pWidget->GetAppearanceAge(); |
| 434 | 422 |
| 435 int nValueAge = pWidget->GetValueAge(); | 423 int nValueAge = pWidget->GetValueAge(); |
| 436 pWidget->ClearAppModified(); | 424 pWidget->ClearAppModified(); |
| 437 | 425 |
| 438 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); | 426 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); |
| 439 ASSERT(pPageView != NULL); | 427 ASSERT(pPageView); |
| 440 | 428 |
| 441 PDFSDK_FieldAction fa; | 429 PDFSDK_FieldAction fa; |
| 442 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 430 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 443 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 431 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 444 | 432 |
| 445 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TRUE); | 433 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TRUE); |
| 446 if (!pFormFiller) | 434 if (!pFormFiller) |
| 447 return FALSE; | 435 return FALSE; |
| 448 pFormFiller->GetActionData(pPageView, CPDF_AAction::GetFocus, fa); | 436 pFormFiller->GetActionData(pPageView, CPDF_AAction::GetFocus, fa); |
| 449 pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView); | 437 pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 472 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 460 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
| 473 pFormFiller->KillFocusForAnnot(pAnnot, nFlag); | 461 pFormFiller->KillFocusForAnnot(pAnnot, nFlag); |
| 474 | 462 |
| 475 if (!m_bNotifying) { | 463 if (!m_bNotifying) { |
| 476 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 464 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 477 if (pWidget->GetAAction(CPDF_AAction::LoseFocus)) { | 465 if (pWidget->GetAAction(CPDF_AAction::LoseFocus)) { |
| 478 m_bNotifying = TRUE; | 466 m_bNotifying = TRUE; |
| 479 pWidget->ClearAppModified(); | 467 pWidget->ClearAppModified(); |
| 480 | 468 |
| 481 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); | 469 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); |
| 482 ASSERT(pPageView != NULL); | 470 ASSERT(pPageView); |
| 483 | 471 |
| 484 PDFSDK_FieldAction fa; | 472 PDFSDK_FieldAction fa; |
| 485 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 473 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 486 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 474 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 487 | 475 |
| 488 pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocus, fa); | 476 pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocus, fa); |
| 489 | 477 |
| 490 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); | 478 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); |
| 491 m_bNotifying = FALSE; | 479 m_bNotifying = FALSE; |
| 492 } | 480 } |
| 493 } | 481 } |
| 494 } | 482 } |
| 495 | 483 |
| 496 return TRUE; | 484 return TRUE; |
| 497 } | 485 } |
| 498 | 486 |
| 499 FX_BOOL CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) { | 487 FX_BOOL CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) { |
| 500 return pWidget->IsVisible(); | 488 return pWidget->IsVisible(); |
| 501 } | 489 } |
| 502 | 490 |
| 503 FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) { | 491 FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) { |
| 504 ASSERT(pWidget != NULL); | |
| 505 | |
| 506 int nFieldFlags = pWidget->GetFieldFlags(); | 492 int nFieldFlags = pWidget->GetFieldFlags(); |
| 507 | |
| 508 return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY; | 493 return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY; |
| 509 } | 494 } |
| 510 | 495 |
| 511 FX_BOOL CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) { | 496 FX_BOOL CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) { |
| 512 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) | 497 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) |
| 513 return TRUE; | 498 return TRUE; |
| 514 | 499 |
| 515 CPDF_Page* pPage = pWidget->GetPDFPage(); | 500 CPDF_Page* pPage = pWidget->GetPDFPage(); |
| 516 CPDF_Document* pDocument = pPage->m_pDocument; | 501 CPDF_Document* pDocument = pPage->m_pDocument; |
| 517 FX_DWORD dwPermissions = pDocument->GetUserPermissions(); | 502 FX_DWORD dwPermissions = pDocument->GetUserPermissions(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 577 | 562 |
| 578 delete it->second; | 563 delete it->second; |
| 579 m_Maps.erase(it); | 564 m_Maps.erase(it); |
| 580 } | 565 } |
| 581 | 566 |
| 582 void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, | 567 void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, |
| 583 FX_FLOAT fPopupMin, | 568 FX_FLOAT fPopupMin, |
| 584 FX_FLOAT fPopupMax, | 569 FX_FLOAT fPopupMax, |
| 585 int32_t& nRet, | 570 int32_t& nRet, |
| 586 FX_FLOAT& fPopupRet) { | 571 FX_FLOAT& fPopupRet) { |
| 587 ASSERT(pPrivateData != NULL); | |
| 588 | |
| 589 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 572 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
| 590 | 573 |
| 591 CPDF_Rect rcPageView(0, 0, 0, 0); | 574 CPDF_Rect rcPageView(0, 0, 0, 0); |
| 592 rcPageView.right = pData->pWidget->GetPDFPage()->GetPageWidth(); | 575 rcPageView.right = pData->pWidget->GetPDFPage()->GetPageWidth(); |
| 593 rcPageView.bottom = pData->pWidget->GetPDFPage()->GetPageHeight(); | 576 rcPageView.bottom = pData->pWidget->GetPDFPage()->GetPageHeight(); |
| 594 rcPageView.Normalize(); | 577 rcPageView.Normalize(); |
| 595 | 578 |
| 596 ASSERT(pData->pWidget != NULL); | |
| 597 CPDF_Rect rcAnnot = pData->pWidget->GetRect(); | 579 CPDF_Rect rcAnnot = pData->pWidget->GetRect(); |
| 598 | 580 |
| 599 FX_FLOAT fTop = 0.0f; | 581 FX_FLOAT fTop = 0.0f; |
| 600 FX_FLOAT fBottom = 0.0f; | 582 FX_FLOAT fBottom = 0.0f; |
| 601 | 583 |
| 602 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pData->pWidget; | 584 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pData->pWidget; |
| 603 switch (pWidget->GetRotate() / 90) { | 585 switch (pWidget->GetRotate() / 90) { |
| 604 default: | 586 default: |
| 605 case 0: | 587 case 0: |
| 606 fTop = rcPageView.top - rcAnnot.top; | 588 fTop = rcPageView.top - rcAnnot.top; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 653 nRet = bBottom ? 0 : 1; | 635 nRet = bBottom ? 0 : 1; |
| 654 fPopupRet = fFactHeight; | 636 fPopupRet = fFactHeight; |
| 655 } | 637 } |
| 656 | 638 |
| 657 void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, | 639 void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, |
| 658 CPDFSDK_PageView* pPageView, | 640 CPDFSDK_PageView* pPageView, |
| 659 FX_BOOL& bRC, | 641 FX_BOOL& bRC, |
| 660 FX_BOOL& bExit, | 642 FX_BOOL& bExit, |
| 661 FX_DWORD nFlag) { | 643 FX_DWORD nFlag) { |
| 662 if (!m_bNotifying) { | 644 if (!m_bNotifying) { |
| 663 ASSERT(pWidget != NULL); | |
| 664 if (pWidget->GetAAction(CPDF_AAction::KeyStroke)) { | 645 if (pWidget->GetAAction(CPDF_AAction::KeyStroke)) { |
| 665 m_bNotifying = TRUE; | 646 m_bNotifying = TRUE; |
| 666 pWidget->ClearAppModified(); | 647 pWidget->ClearAppModified(); |
| 667 | 648 |
| 668 ASSERT(pPageView != NULL); | 649 ASSERT(pPageView); |
| 669 | 650 |
| 670 PDFSDK_FieldAction fa; | 651 PDFSDK_FieldAction fa; |
| 671 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 652 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 672 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 653 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 673 fa.bWillCommit = TRUE; | 654 fa.bWillCommit = TRUE; |
| 674 fa.bKeyDown = TRUE; | 655 fa.bKeyDown = TRUE; |
| 675 fa.bRC = TRUE; | 656 fa.bRC = TRUE; |
| 676 | 657 |
| 677 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); | 658 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); |
| 678 ASSERT(pFormFiller != NULL); | |
| 679 | |
| 680 pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa); | 659 pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa); |
| 681 pFormFiller->SaveState(pPageView); | 660 pFormFiller->SaveState(pPageView); |
| 682 | 661 |
| 683 PDFSDK_FieldAction faOld = fa; | 662 PDFSDK_FieldAction faOld = fa; |
| 684 pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView); | 663 pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView); |
| 685 | 664 |
| 686 bRC = fa.bRC; | 665 bRC = fa.bRC; |
| 687 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, | |
| 688 // pWidget); | |
| 689 | |
| 690 m_bNotifying = FALSE; | 666 m_bNotifying = FALSE; |
| 691 } | 667 } |
| 692 } | 668 } |
| 693 } | 669 } |
| 694 | 670 |
| 695 void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, | 671 void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, |
| 696 CPDFSDK_PageView* pPageView, | 672 CPDFSDK_PageView* pPageView, |
| 697 FX_BOOL& bRC, | 673 FX_BOOL& bRC, |
| 698 FX_BOOL& bExit, | 674 FX_BOOL& bExit, |
| 699 FX_DWORD nFlag) { | 675 FX_DWORD nFlag) { |
| 700 if (!m_bNotifying) { | 676 if (!m_bNotifying) { |
| 701 ASSERT(pWidget != NULL); | |
| 702 if (pWidget->GetAAction(CPDF_AAction::Validate)) { | 677 if (pWidget->GetAAction(CPDF_AAction::Validate)) { |
| 703 m_bNotifying = TRUE; | 678 m_bNotifying = TRUE; |
| 704 pWidget->ClearAppModified(); | 679 pWidget->ClearAppModified(); |
| 705 | 680 |
| 706 ASSERT(pPageView != NULL); | 681 ASSERT(pPageView); |
| 707 // CReader_DocView* pDocView = pPageView->GetDocView(); | |
| 708 // ASSERT(pDocView != NULL); | |
| 709 | 682 |
| 710 PDFSDK_FieldAction fa; | 683 PDFSDK_FieldAction fa; |
| 711 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 684 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 712 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 685 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 713 fa.bKeyDown = TRUE; | 686 fa.bKeyDown = TRUE; |
| 714 fa.bRC = TRUE; | 687 fa.bRC = TRUE; |
| 715 | 688 |
| 716 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); | 689 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); |
| 717 ASSERT(pFormFiller != NULL); | |
| 718 | |
| 719 pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa); | 690 pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa); |
| 720 pFormFiller->SaveState(pPageView); | 691 pFormFiller->SaveState(pPageView); |
| 721 | 692 |
| 722 PDFSDK_FieldAction faOld = fa; | 693 PDFSDK_FieldAction faOld = fa; |
| 723 pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView); | 694 pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView); |
| 724 | 695 |
| 725 bRC = fa.bRC; | 696 bRC = fa.bRC; |
| 726 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, | |
| 727 // pWidget); | |
| 728 | |
| 729 m_bNotifying = FALSE; | 697 m_bNotifying = FALSE; |
| 730 } | 698 } |
| 731 } | 699 } |
| 732 } | 700 } |
| 733 | 701 |
| 734 void CFFL_IFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, | 702 void CFFL_IFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, |
| 735 CPDFSDK_PageView* pPageView, | 703 CPDFSDK_PageView* pPageView, |
| 736 FX_BOOL& bExit, | 704 FX_BOOL& bExit, |
| 737 FX_DWORD nFlag) { | 705 FX_DWORD nFlag) { |
| 738 if (!m_bNotifying) { | 706 if (!m_bNotifying) { |
| 739 ASSERT(pWidget != NULL); | 707 ASSERT(pWidget); |
| 740 ASSERT(pPageView != NULL); | |
| 741 // CReader_DocView* pDocView = pPageView->GetDocView(); | |
| 742 // ASSERT(pDocView != NULL); | |
| 743 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); | 708 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); |
| 744 ASSERT(pDocument != NULL); | |
| 745 | |
| 746 CPDFSDK_InterForm* pInterForm = | 709 CPDFSDK_InterForm* pInterForm = |
| 747 (CPDFSDK_InterForm*)pDocument->GetInterForm(); | 710 (CPDFSDK_InterForm*)pDocument->GetInterForm(); |
| 748 ASSERT(pInterForm != NULL); | |
| 749 | |
| 750 pInterForm->OnCalculate(pWidget->GetFormField()); | 711 pInterForm->OnCalculate(pWidget->GetFormField()); |
| 751 | 712 |
| 752 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, | |
| 753 // pWidget); | |
| 754 | |
| 755 m_bNotifying = FALSE; | 713 m_bNotifying = FALSE; |
| 756 } | 714 } |
| 757 } | 715 } |
| 758 | 716 |
| 759 void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, | 717 void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, |
| 760 CPDFSDK_PageView* pPageView, | 718 CPDFSDK_PageView* pPageView, |
| 761 FX_BOOL& bExit, | 719 FX_BOOL& bExit, |
| 762 FX_DWORD nFlag) { | 720 FX_DWORD nFlag) { |
| 763 if (!m_bNotifying) { | 721 if (!m_bNotifying) { |
| 764 ASSERT(pWidget != NULL); | 722 ASSERT(pWidget); |
| 765 ASSERT(pPageView != NULL); | |
| 766 // CReader_DocView* pDocView = pPageView->GetDocView(); | |
| 767 // ASSERT(pDocView != NULL); | |
| 768 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); | 723 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); |
| 769 ASSERT(pDocument != NULL); | |
| 770 | |
| 771 CPDFSDK_InterForm* pInterForm = | 724 CPDFSDK_InterForm* pInterForm = |
| 772 (CPDFSDK_InterForm*)pDocument->GetInterForm(); | 725 (CPDFSDK_InterForm*)pDocument->GetInterForm(); |
| 773 ASSERT(pInterForm != NULL); | |
| 774 | 726 |
| 775 FX_BOOL bFormated = FALSE; | 727 FX_BOOL bFormated = FALSE; |
| 776 CFX_WideString sValue = | 728 CFX_WideString sValue = |
| 777 pInterForm->OnFormat(pWidget->GetFormField(), bFormated); | 729 pInterForm->OnFormat(pWidget->GetFormField(), bFormated); |
| 778 | 730 |
| 779 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, | |
| 780 // pWidget); | |
| 781 | |
| 782 if (bExit) | 731 if (bExit) |
| 783 return; | 732 return; |
| 784 | 733 |
| 785 if (bFormated) { | 734 if (bFormated) { |
| 786 pInterForm->ResetFieldAppearance(pWidget->GetFormField(), sValue.c_str(), | 735 pInterForm->ResetFieldAppearance(pWidget->GetFormField(), sValue.c_str(), |
| 787 TRUE); | 736 TRUE); |
| 788 pInterForm->UpdateField(pWidget->GetFormField()); | 737 pInterForm->UpdateField(pWidget->GetFormField()); |
| 789 } | 738 } |
| 790 | 739 |
| 791 m_bNotifying = FALSE; | 740 m_bNotifying = FALSE; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 802 | 751 |
| 803 void CFFL_IFormFiller::OnBeforeKeyStroke(void* pPrivateData, | 752 void CFFL_IFormFiller::OnBeforeKeyStroke(void* pPrivateData, |
| 804 CFX_WideString& strChange, | 753 CFX_WideString& strChange, |
| 805 const CFX_WideString& strChangeEx, | 754 const CFX_WideString& strChangeEx, |
| 806 int nSelStart, | 755 int nSelStart, |
| 807 int nSelEnd, | 756 int nSelEnd, |
| 808 FX_BOOL bKeyDown, | 757 FX_BOOL bKeyDown, |
| 809 FX_BOOL& bRC, | 758 FX_BOOL& bRC, |
| 810 FX_BOOL& bExit, | 759 FX_BOOL& bExit, |
| 811 FX_DWORD nFlag) { | 760 FX_DWORD nFlag) { |
| 812 ASSERT(pPrivateData != NULL); | |
| 813 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 761 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
|
Tom Sepez
2015/12/14 19:14:11
nit: segv if !pData in second part of assert.
Lei Zhang
2015/12/15 01:38:33
Done.
| |
| 814 ASSERT(pData->pWidget != NULL); | 762 ASSERT(pData && pData->pWidget); |
| 815 | 763 |
| 816 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); | 764 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); |
| 817 ASSERT(pFormFiller != NULL); | |
| 818 | |
| 819 if (!m_bNotifying) { | 765 if (!m_bNotifying) { |
| 820 if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) { | 766 if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) { |
| 821 m_bNotifying = TRUE; | 767 m_bNotifying = TRUE; |
| 822 int nAge = pData->pWidget->GetAppearanceAge(); | 768 int nAge = pData->pWidget->GetAppearanceAge(); |
| 823 int nValueAge = pData->pWidget->GetValueAge(); | 769 int nValueAge = pData->pWidget->GetValueAge(); |
| 824 | 770 |
| 825 ASSERT(pData->pPageView != NULL); | |
| 826 CPDFSDK_Document* pDocument = pData->pPageView->GetSDKDocument(); | 771 CPDFSDK_Document* pDocument = pData->pPageView->GetSDKDocument(); |
| 827 | 772 |
| 828 PDFSDK_FieldAction fa; | 773 PDFSDK_FieldAction fa; |
| 829 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 774 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 830 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 775 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 831 fa.sChange = strChange; | 776 fa.sChange = strChange; |
| 832 fa.sChangeEx = strChangeEx; | 777 fa.sChangeEx = strChangeEx; |
| 833 fa.bKeyDown = bKeyDown; | 778 fa.bKeyDown = bKeyDown; |
| 834 fa.bWillCommit = FALSE; | 779 fa.bWillCommit = FALSE; |
| 835 fa.bRC = TRUE; | 780 fa.bRC = TRUE; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 872 bExit = TRUE; | 817 bExit = TRUE; |
| 873 m_bNotifying = FALSE; | 818 m_bNotifying = FALSE; |
| 874 return; | 819 return; |
| 875 } | 820 } |
| 876 } | 821 } |
| 877 | 822 |
| 878 m_bNotifying = FALSE; | 823 m_bNotifying = FALSE; |
| 879 } | 824 } |
| 880 } | 825 } |
| 881 } | 826 } |
| OLD | NEW |