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 CFX_Matrix* pUser2Device, | 54 CFX_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); | |
| 131 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 124 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 132 | 125 |
| 133 if (!m_bNotifying) { | 126 if (!m_bNotifying) { |
| 134 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 127 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 135 if (pWidget->GetAAction(CPDF_AAction::CursorEnter)) { | 128 if (pWidget->GetAAction(CPDF_AAction::CursorEnter)) { |
| 136 m_bNotifying = TRUE; | 129 m_bNotifying = TRUE; |
| 137 | 130 |
| 138 int nValueAge = pWidget->GetValueAge(); | 131 int nValueAge = pWidget->GetValueAge(); |
| 139 | 132 |
| 140 pWidget->ClearAppModified(); | 133 pWidget->ClearAppModified(); |
| 141 | 134 |
| 142 ASSERT(pPageView != NULL); | 135 ASSERT(pPageView); |
| 143 | 136 |
| 144 PDFSDK_FieldAction fa; | 137 PDFSDK_FieldAction fa; |
| 145 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 138 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 146 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 139 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 147 pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView); | 140 pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView); |
| 148 m_bNotifying = FALSE; | 141 m_bNotifying = FALSE; |
| 149 | 142 |
| 150 // if ( !IsValidAnnot(pPageView, pAnnot) ) return; | |
| 151 | |
| 152 if (pWidget->IsAppModified()) { | 143 if (pWidget->IsAppModified()) { |
| 153 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { | 144 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
| 154 pFormFiller->ResetPDFWindow(pPageView, | 145 pFormFiller->ResetPDFWindow(pPageView, |
| 155 pWidget->GetValueAge() == nValueAge); | 146 pWidget->GetValueAge() == nValueAge); |
| 156 } | 147 } |
| 157 } | 148 } |
| 158 } | 149 } |
| 159 } | 150 } |
| 160 | 151 |
| 161 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) { | 152 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) { |
| 162 pFormFiller->OnMouseEnter(pPageView, pAnnot); | 153 pFormFiller->OnMouseEnter(pPageView, pAnnot); |
| 163 } | 154 } |
| 164 } | 155 } |
| 165 | 156 |
| 166 void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, | 157 void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, |
| 167 CPDFSDK_Annot* pAnnot, | 158 CPDFSDK_Annot* pAnnot, |
| 168 FX_UINT nFlag) { | 159 FX_UINT nFlag) { |
| 169 ASSERT(pAnnot != NULL); | |
| 170 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 160 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 171 | 161 |
| 172 if (!m_bNotifying) { | 162 if (!m_bNotifying) { |
| 173 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 163 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 174 if (pWidget->GetAAction(CPDF_AAction::CursorExit)) { | 164 if (pWidget->GetAAction(CPDF_AAction::CursorExit)) { |
| 175 m_bNotifying = TRUE; | 165 m_bNotifying = TRUE; |
| 176 pWidget->GetAppearanceAge(); | 166 pWidget->GetAppearanceAge(); |
| 177 int nValueAge = pWidget->GetValueAge(); | 167 int nValueAge = pWidget->GetValueAge(); |
| 178 pWidget->ClearAppModified(); | 168 pWidget->ClearAppModified(); |
| 179 | 169 |
| 180 ASSERT(pPageView != NULL); | 170 ASSERT(pPageView); |
| 181 | 171 |
| 182 PDFSDK_FieldAction fa; | 172 PDFSDK_FieldAction fa; |
| 183 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 173 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 184 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 174 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 185 | 175 |
| 186 pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView); | 176 pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView); |
| 187 m_bNotifying = FALSE; | 177 m_bNotifying = FALSE; |
| 188 | 178 |
| 189 // if (!IsValidAnnot(pPageView, pAnnot)) return; | |
| 190 | |
| 191 if (pWidget->IsAppModified()) { | 179 if (pWidget->IsAppModified()) { |
| 192 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { | 180 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
| 193 pFormFiller->ResetPDFWindow(pPageView, | 181 pFormFiller->ResetPDFWindow(pPageView, |
| 194 nValueAge == pWidget->GetValueAge()); | 182 nValueAge == pWidget->GetValueAge()); |
| 195 } | 183 } |
| 196 } | 184 } |
| 197 } | 185 } |
| 198 } | 186 } |
| 199 | 187 |
| 200 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 188 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
| 201 pFormFiller->OnMouseExit(pPageView, pAnnot); | 189 pFormFiller->OnMouseExit(pPageView, pAnnot); |
| 202 } | 190 } |
| 203 } | 191 } |
| 204 | 192 |
| 205 FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, | 193 FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, |
| 206 CPDFSDK_Annot* pAnnot, | 194 CPDFSDK_Annot* pAnnot, |
| 207 FX_UINT nFlags, | 195 FX_UINT nFlags, |
| 208 const CPDF_Point& point) { | 196 const CPDF_Point& point) { |
| 209 ASSERT(pAnnot != NULL); | |
| 210 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 197 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 211 | 198 |
| 212 if (!m_bNotifying) { | 199 if (!m_bNotifying) { |
| 213 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 200 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 214 if (Annot_HitTest(pPageView, pAnnot, point) && | 201 if (Annot_HitTest(pPageView, pAnnot, point) && |
| 215 pWidget->GetAAction(CPDF_AAction::ButtonDown)) { | 202 pWidget->GetAAction(CPDF_AAction::ButtonDown)) { |
| 216 m_bNotifying = TRUE; | 203 m_bNotifying = TRUE; |
| 217 pWidget->GetAppearanceAge(); | 204 pWidget->GetAppearanceAge(); |
| 218 int nValueAge = pWidget->GetValueAge(); | 205 int nValueAge = pWidget->GetValueAge(); |
| 219 pWidget->ClearAppModified(); | 206 pWidget->ClearAppModified(); |
| 220 | 207 |
| 221 ASSERT(pPageView != NULL); | 208 ASSERT(pPageView); |
| 222 | 209 |
| 223 PDFSDK_FieldAction fa; | 210 PDFSDK_FieldAction fa; |
| 224 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlags); | 211 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlags); |
| 225 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlags); | 212 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlags); |
| 226 pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageView); | 213 pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageView); |
| 227 m_bNotifying = FALSE; | 214 m_bNotifying = FALSE; |
| 228 | 215 |
| 229 if (!IsValidAnnot(pPageView, pAnnot)) | 216 if (!IsValidAnnot(pPageView, pAnnot)) |
| 230 return TRUE; | 217 return TRUE; |
| 231 | 218 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 #endif // PDF_ENABLE_XFA | 271 #endif // PDF_ENABLE_XFA |
| 285 } | 272 } |
| 286 return bRet; | 273 return bRet; |
| 287 } | 274 } |
| 288 | 275 |
| 289 void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, | 276 void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, |
| 290 CPDFSDK_PageView* pPageView, | 277 CPDFSDK_PageView* pPageView, |
| 291 FX_BOOL& bReset, | 278 FX_BOOL& bReset, |
| 292 FX_BOOL& bExit, | 279 FX_BOOL& bExit, |
| 293 FX_UINT nFlag) { | 280 FX_UINT nFlag) { |
| 294 ASSERT(pWidget != NULL); | 281 ASSERT(pWidget); |
| 295 | 282 |
| 296 if (!m_bNotifying) { | 283 if (!m_bNotifying) { |
| 297 if (pWidget->GetAAction(CPDF_AAction::ButtonUp)) { | 284 if (pWidget->GetAAction(CPDF_AAction::ButtonUp)) { |
| 298 m_bNotifying = TRUE; | 285 m_bNotifying = TRUE; |
| 299 int nAge = pWidget->GetAppearanceAge(); | 286 int nAge = pWidget->GetAppearanceAge(); |
| 300 int nValueAge = pWidget->GetValueAge(); | 287 int nValueAge = pWidget->GetValueAge(); |
| 301 | 288 |
| 302 ASSERT(pPageView != NULL); | 289 ASSERT(pPageView); |
| 303 // CReader_DocView* pDocView = pPageView->GetDocView(); | |
| 304 // ASSERT(pDocView != NULL); | |
| 305 | 290 |
| 306 PDFSDK_FieldAction fa; | 291 PDFSDK_FieldAction fa; |
| 307 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 292 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 308 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 293 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 309 | 294 |
| 310 pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView); | 295 pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView); |
| 311 m_bNotifying = FALSE; | 296 m_bNotifying = FALSE; |
| 312 | 297 |
| 313 if (!IsValidAnnot(pPageView, pWidget)) { | 298 if (!IsValidAnnot(pPageView, pWidget)) { |
| 314 bExit = TRUE; | 299 bExit = TRUE; |
| 315 return; | 300 return; |
| 316 } | 301 } |
| 317 | 302 |
| 318 if (nAge != pWidget->GetAppearanceAge()) { | 303 if (nAge != pWidget->GetAppearanceAge()) { |
| 319 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { | 304 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
| 320 pFormFiller->ResetPDFWindow(pPageView, | 305 pFormFiller->ResetPDFWindow(pPageView, |
| 321 nValueAge == pWidget->GetValueAge()); | 306 nValueAge == pWidget->GetValueAge()); |
| 322 } | 307 } |
| 323 | 308 |
| 324 bReset = TRUE; | 309 bReset = TRUE; |
| 325 } | 310 } |
| 326 } | 311 } |
| 327 } | 312 } |
| 328 } | 313 } |
| 329 | 314 |
| 330 FX_BOOL CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, | 315 FX_BOOL CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, |
| 331 CPDFSDK_Annot* pAnnot, | 316 CPDFSDK_Annot* pAnnot, |
| 332 FX_UINT nFlags, | 317 FX_UINT nFlags, |
| 333 const CPDF_Point& point) { | 318 const CPDF_Point& point) { |
| 334 ASSERT(pAnnot != NULL); | |
| 335 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 319 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 336 | 320 |
| 337 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 321 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
| 338 return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); | 322 return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); |
| 339 } | 323 } |
| 340 | 324 |
| 341 return FALSE; | 325 return FALSE; |
| 342 } | 326 } |
| 343 | 327 |
| 344 FX_BOOL CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, | 328 FX_BOOL CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, |
| 345 CPDFSDK_Annot* pAnnot, | 329 CPDFSDK_Annot* pAnnot, |
| 346 FX_UINT nFlags, | 330 FX_UINT nFlags, |
| 347 const CPDF_Point& point) { | 331 const CPDF_Point& point) { |
| 348 ASSERT(pAnnot != NULL); | |
| 349 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 332 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 350 | 333 |
| 351 // change cursor | 334 // change cursor |
| 352 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) { | 335 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) { |
| 353 return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); | 336 return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); |
| 354 } | 337 } |
| 355 | 338 |
| 356 return FALSE; | 339 return FALSE; |
| 357 } | 340 } |
| 358 | 341 |
| 359 FX_BOOL CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, | 342 FX_BOOL CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, |
| 360 CPDFSDK_Annot* pAnnot, | 343 CPDFSDK_Annot* pAnnot, |
| 361 FX_UINT nFlags, | 344 FX_UINT nFlags, |
| 362 short zDelta, | 345 short zDelta, |
| 363 const CPDF_Point& point) { | 346 const CPDF_Point& point) { |
| 364 ASSERT(pAnnot != NULL); | |
| 365 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 347 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 366 | 348 |
| 367 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 349 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
| 368 return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point); | 350 return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point); |
| 369 } | 351 } |
| 370 | 352 |
| 371 return FALSE; | 353 return FALSE; |
| 372 } | 354 } |
| 373 | 355 |
| 374 FX_BOOL CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, | 356 FX_BOOL CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, |
| 375 CPDFSDK_Annot* pAnnot, | 357 CPDFSDK_Annot* pAnnot, |
| 376 FX_UINT nFlags, | 358 FX_UINT nFlags, |
| 377 const CPDF_Point& point) { | 359 const CPDF_Point& point) { |
| 378 ASSERT(pAnnot != NULL); | |
| 379 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 360 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 380 | 361 |
| 381 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 362 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
| 382 return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); | 363 return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); |
| 383 } | 364 } |
| 384 | 365 |
| 385 return FALSE; | 366 return FALSE; |
| 386 } | 367 } |
| 387 | 368 |
| 388 FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, | 369 FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, |
| 389 CPDFSDK_Annot* pAnnot, | 370 CPDFSDK_Annot* pAnnot, |
| 390 FX_UINT nFlags, | 371 FX_UINT nFlags, |
| 391 const CPDF_Point& point) { | 372 const CPDF_Point& point) { |
| 392 ASSERT(pAnnot != NULL); | |
| 393 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 373 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 394 | 374 |
| 395 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 375 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
| 396 return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); | 376 return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); |
| 397 } | 377 } |
| 398 | 378 |
| 399 return FALSE; | 379 return FALSE; |
| 400 } | 380 } |
| 401 | 381 |
| 402 FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, | 382 FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, |
| 403 FX_UINT nKeyCode, | 383 FX_UINT nKeyCode, |
| 404 FX_UINT nFlags) { | 384 FX_UINT nFlags) { |
| 405 ASSERT(pAnnot != NULL); | |
| 406 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 385 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 407 | 386 |
| 408 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 387 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
| 409 return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); | 388 return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); |
| 410 } | 389 } |
| 411 | 390 |
| 412 return FALSE; | 391 return FALSE; |
| 413 } | 392 } |
| 414 | 393 |
| 415 FX_BOOL CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot, | 394 FX_BOOL CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot, |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 434 if (!m_bNotifying) { | 413 if (!m_bNotifying) { |
| 435 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 414 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 436 if (pWidget->GetAAction(CPDF_AAction::GetFocus)) { | 415 if (pWidget->GetAAction(CPDF_AAction::GetFocus)) { |
| 437 m_bNotifying = TRUE; | 416 m_bNotifying = TRUE; |
| 438 pWidget->GetAppearanceAge(); | 417 pWidget->GetAppearanceAge(); |
| 439 | 418 |
| 440 int nValueAge = pWidget->GetValueAge(); | 419 int nValueAge = pWidget->GetValueAge(); |
| 441 pWidget->ClearAppModified(); | 420 pWidget->ClearAppModified(); |
| 442 | 421 |
| 443 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); | 422 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); |
| 444 ASSERT(pPageView != NULL); | 423 ASSERT(pPageView); |
| 445 | 424 |
| 446 PDFSDK_FieldAction fa; | 425 PDFSDK_FieldAction fa; |
| 447 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 426 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 448 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 427 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 449 | 428 |
| 450 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TRUE); | 429 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TRUE); |
| 451 if (!pFormFiller) | 430 if (!pFormFiller) |
| 452 return FALSE; | 431 return FALSE; |
| 453 pFormFiller->GetActionData(pPageView, CPDF_AAction::GetFocus, fa); | 432 pFormFiller->GetActionData(pPageView, CPDF_AAction::GetFocus, fa); |
| 454 pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView); | 433 pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 477 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 456 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
| 478 pFormFiller->KillFocusForAnnot(pAnnot, nFlag); | 457 pFormFiller->KillFocusForAnnot(pAnnot, nFlag); |
| 479 | 458 |
| 480 if (!m_bNotifying) { | 459 if (!m_bNotifying) { |
| 481 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 460 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 482 if (pWidget->GetAAction(CPDF_AAction::LoseFocus)) { | 461 if (pWidget->GetAAction(CPDF_AAction::LoseFocus)) { |
| 483 m_bNotifying = TRUE; | 462 m_bNotifying = TRUE; |
| 484 pWidget->ClearAppModified(); | 463 pWidget->ClearAppModified(); |
| 485 | 464 |
| 486 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); | 465 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); |
| 487 ASSERT(pPageView != NULL); | 466 ASSERT(pPageView); |
| 488 | 467 |
| 489 PDFSDK_FieldAction fa; | 468 PDFSDK_FieldAction fa; |
| 490 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 469 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 491 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 470 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 492 | 471 |
| 493 pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocus, fa); | 472 pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocus, fa); |
| 494 | 473 |
| 495 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); | 474 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); |
| 496 m_bNotifying = FALSE; | 475 m_bNotifying = FALSE; |
| 497 } | 476 } |
| 498 } | 477 } |
| 499 } | 478 } |
| 500 | 479 |
| 501 return TRUE; | 480 return TRUE; |
| 502 } | 481 } |
| 503 | 482 |
| 504 FX_BOOL CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) { | 483 FX_BOOL CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) { |
| 505 return pWidget->IsVisible(); | 484 return pWidget->IsVisible(); |
| 506 } | 485 } |
| 507 | 486 |
| 508 FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) { | 487 FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) { |
| 509 ASSERT(pWidget != NULL); | |
| 510 | |
| 511 int nFieldFlags = pWidget->GetFieldFlags(); | 488 int nFieldFlags = pWidget->GetFieldFlags(); |
| 512 | |
| 513 return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY; | 489 return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY; |
| 514 } | 490 } |
| 515 | 491 |
| 516 FX_BOOL CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) { | 492 FX_BOOL CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) { |
| 517 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) | 493 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) |
| 518 return TRUE; | 494 return TRUE; |
| 519 | 495 |
| 520 CPDF_Page* pPage = pWidget->GetPDFPage(); | 496 CPDF_Page* pPage = pWidget->GetPDFPage(); |
| 521 CPDF_Document* pDocument = pPage->m_pDocument; | 497 CPDF_Document* pDocument = pPage->m_pDocument; |
| 522 FX_DWORD dwPermissions = pDocument->GetUserPermissions(); | 498 FX_DWORD dwPermissions = pDocument->GetUserPermissions(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 582 | 558 |
| 583 delete it->second; | 559 delete it->second; |
| 584 m_Maps.erase(it); | 560 m_Maps.erase(it); |
| 585 } | 561 } |
| 586 | 562 |
| 587 void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, | 563 void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, |
| 588 FX_FLOAT fPopupMin, | 564 FX_FLOAT fPopupMin, |
| 589 FX_FLOAT fPopupMax, | 565 FX_FLOAT fPopupMax, |
| 590 int32_t& nRet, | 566 int32_t& nRet, |
| 591 FX_FLOAT& fPopupRet) { | 567 FX_FLOAT& fPopupRet) { |
| 592 ASSERT(pPrivateData != NULL); | |
| 593 | |
| 594 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 568 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
| 595 | 569 |
| 596 CPDF_Rect rcPageView(0, 0, 0, 0); | 570 CPDF_Rect rcPageView(0, 0, 0, 0); |
| 597 rcPageView.right = pData->pWidget->GetPDFPage()->GetPageWidth(); | 571 rcPageView.right = pData->pWidget->GetPDFPage()->GetPageWidth(); |
| 598 rcPageView.bottom = pData->pWidget->GetPDFPage()->GetPageHeight(); | 572 rcPageView.bottom = pData->pWidget->GetPDFPage()->GetPageHeight(); |
| 599 rcPageView.Normalize(); | 573 rcPageView.Normalize(); |
| 600 | 574 |
| 601 ASSERT(pData->pWidget != NULL); | |
| 602 CPDF_Rect rcAnnot = pData->pWidget->GetRect(); | 575 CPDF_Rect rcAnnot = pData->pWidget->GetRect(); |
| 603 | 576 |
| 604 FX_FLOAT fTop = 0.0f; | 577 FX_FLOAT fTop = 0.0f; |
| 605 FX_FLOAT fBottom = 0.0f; | 578 FX_FLOAT fBottom = 0.0f; |
| 606 | 579 |
| 607 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pData->pWidget; | 580 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pData->pWidget; |
| 608 switch (pWidget->GetRotate() / 90) { | 581 switch (pWidget->GetRotate() / 90) { |
| 609 default: | 582 default: |
| 610 case 0: | 583 case 0: |
| 611 fTop = rcPageView.top - rcAnnot.top; | 584 fTop = rcPageView.top - rcAnnot.top; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 658 nRet = bBottom ? 0 : 1; | 631 nRet = bBottom ? 0 : 1; |
| 659 fPopupRet = fFactHeight; | 632 fPopupRet = fFactHeight; |
| 660 } | 633 } |
| 661 | 634 |
| 662 void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, | 635 void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, |
| 663 CPDFSDK_PageView* pPageView, | 636 CPDFSDK_PageView* pPageView, |
| 664 FX_BOOL& bRC, | 637 FX_BOOL& bRC, |
| 665 FX_BOOL& bExit, | 638 FX_BOOL& bExit, |
| 666 FX_DWORD nFlag) { | 639 FX_DWORD nFlag) { |
| 667 if (!m_bNotifying) { | 640 if (!m_bNotifying) { |
| 668 ASSERT(pWidget != NULL); | |
| 669 if (pWidget->GetAAction(CPDF_AAction::KeyStroke)) { | 641 if (pWidget->GetAAction(CPDF_AAction::KeyStroke)) { |
| 670 m_bNotifying = TRUE; | 642 m_bNotifying = TRUE; |
| 671 pWidget->ClearAppModified(); | 643 pWidget->ClearAppModified(); |
| 672 | 644 |
| 673 ASSERT(pPageView != NULL); | 645 ASSERT(pPageView); |
| 674 | 646 |
| 675 PDFSDK_FieldAction fa; | 647 PDFSDK_FieldAction fa; |
| 676 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 648 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 677 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 649 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 678 fa.bWillCommit = TRUE; | 650 fa.bWillCommit = TRUE; |
| 679 fa.bKeyDown = TRUE; | 651 fa.bKeyDown = TRUE; |
| 680 fa.bRC = TRUE; | 652 fa.bRC = TRUE; |
| 681 | 653 |
| 682 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); | 654 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); |
| 683 ASSERT(pFormFiller != NULL); | |
| 684 | |
| 685 pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa); | 655 pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa); |
| 686 pFormFiller->SaveState(pPageView); | 656 pFormFiller->SaveState(pPageView); |
| 687 | 657 |
| 688 PDFSDK_FieldAction faOld = fa; | 658 PDFSDK_FieldAction faOld = fa; |
| 689 pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView); | 659 pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView); |
| 690 | 660 |
| 691 bRC = fa.bRC; | 661 bRC = fa.bRC; |
| 692 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, | |
| 693 // pWidget); | |
| 694 | |
| 695 m_bNotifying = FALSE; | 662 m_bNotifying = FALSE; |
| 696 } | 663 } |
| 697 } | 664 } |
| 698 } | 665 } |
| 699 | 666 |
| 700 void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, | 667 void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, |
| 701 CPDFSDK_PageView* pPageView, | 668 CPDFSDK_PageView* pPageView, |
| 702 FX_BOOL& bRC, | 669 FX_BOOL& bRC, |
| 703 FX_BOOL& bExit, | 670 FX_BOOL& bExit, |
| 704 FX_DWORD nFlag) { | 671 FX_DWORD nFlag) { |
| 705 if (!m_bNotifying) { | 672 if (!m_bNotifying) { |
| 706 ASSERT(pWidget != NULL); | |
| 707 if (pWidget->GetAAction(CPDF_AAction::Validate)) { | 673 if (pWidget->GetAAction(CPDF_AAction::Validate)) { |
| 708 m_bNotifying = TRUE; | 674 m_bNotifying = TRUE; |
| 709 pWidget->ClearAppModified(); | 675 pWidget->ClearAppModified(); |
| 710 | 676 |
| 711 ASSERT(pPageView != NULL); | 677 ASSERT(pPageView); |
| 712 // CReader_DocView* pDocView = pPageView->GetDocView(); | |
| 713 // ASSERT(pDocView != NULL); | |
| 714 | 678 |
| 715 PDFSDK_FieldAction fa; | 679 PDFSDK_FieldAction fa; |
| 716 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 680 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 717 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 681 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 718 fa.bKeyDown = TRUE; | 682 fa.bKeyDown = TRUE; |
| 719 fa.bRC = TRUE; | 683 fa.bRC = TRUE; |
| 720 | 684 |
| 721 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); | 685 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); |
| 722 ASSERT(pFormFiller != NULL); | |
| 723 | |
| 724 pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa); | 686 pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa); |
| 725 pFormFiller->SaveState(pPageView); | 687 pFormFiller->SaveState(pPageView); |
| 726 | 688 |
| 727 PDFSDK_FieldAction faOld = fa; | 689 PDFSDK_FieldAction faOld = fa; |
| 728 pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView); | 690 pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView); |
| 729 | 691 |
| 730 bRC = fa.bRC; | 692 bRC = fa.bRC; |
| 731 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, | |
| 732 // pWidget); | |
| 733 | |
| 734 m_bNotifying = FALSE; | 693 m_bNotifying = FALSE; |
| 735 } | 694 } |
| 736 } | 695 } |
| 737 } | 696 } |
| 738 | 697 |
| 739 void CFFL_IFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, | 698 void CFFL_IFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, |
| 740 CPDFSDK_PageView* pPageView, | 699 CPDFSDK_PageView* pPageView, |
| 741 FX_BOOL& bExit, | 700 FX_BOOL& bExit, |
| 742 FX_DWORD nFlag) { | 701 FX_DWORD nFlag) { |
| 743 if (!m_bNotifying) { | 702 if (!m_bNotifying) { |
| 744 ASSERT(pWidget != NULL); | 703 ASSERT(pWidget); |
| 745 ASSERT(pPageView != NULL); | |
| 746 // CReader_DocView* pDocView = pPageView->GetDocView(); | |
| 747 // ASSERT(pDocView != NULL); | |
| 748 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); | 704 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); |
| 749 ASSERT(pDocument != NULL); | |
| 750 | |
| 751 CPDFSDK_InterForm* pInterForm = | 705 CPDFSDK_InterForm* pInterForm = |
| 752 (CPDFSDK_InterForm*)pDocument->GetInterForm(); | 706 (CPDFSDK_InterForm*)pDocument->GetInterForm(); |
| 753 ASSERT(pInterForm != NULL); | |
| 754 | |
| 755 pInterForm->OnCalculate(pWidget->GetFormField()); | 707 pInterForm->OnCalculate(pWidget->GetFormField()); |
| 756 | 708 |
| 757 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, | |
| 758 // pWidget); | |
| 759 | |
| 760 m_bNotifying = FALSE; | 709 m_bNotifying = FALSE; |
| 761 } | 710 } |
| 762 } | 711 } |
| 763 | 712 |
| 764 void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, | 713 void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, |
| 765 CPDFSDK_PageView* pPageView, | 714 CPDFSDK_PageView* pPageView, |
| 766 FX_BOOL& bExit, | 715 FX_BOOL& bExit, |
| 767 FX_DWORD nFlag) { | 716 FX_DWORD nFlag) { |
| 768 if (!m_bNotifying) { | 717 if (!m_bNotifying) { |
| 769 ASSERT(pWidget != NULL); | 718 ASSERT(pWidget); |
| 770 ASSERT(pPageView != NULL); | |
| 771 // CReader_DocView* pDocView = pPageView->GetDocView(); | |
| 772 // ASSERT(pDocView != NULL); | |
| 773 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); | 719 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); |
| 774 ASSERT(pDocument != NULL); | |
| 775 | |
| 776 CPDFSDK_InterForm* pInterForm = | 720 CPDFSDK_InterForm* pInterForm = |
| 777 (CPDFSDK_InterForm*)pDocument->GetInterForm(); | 721 (CPDFSDK_InterForm*)pDocument->GetInterForm(); |
| 778 ASSERT(pInterForm != NULL); | |
| 779 | 722 |
| 780 FX_BOOL bFormated = FALSE; | 723 FX_BOOL bFormated = FALSE; |
| 781 CFX_WideString sValue = | 724 CFX_WideString sValue = |
| 782 pInterForm->OnFormat(pWidget->GetFormField(), bFormated); | 725 pInterForm->OnFormat(pWidget->GetFormField(), bFormated); |
| 783 | 726 |
| 784 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, | |
| 785 // pWidget); | |
| 786 | |
| 787 if (bExit) | 727 if (bExit) |
| 788 return; | 728 return; |
| 789 | 729 |
| 790 if (bFormated) { | 730 if (bFormated) { |
| 791 pInterForm->ResetFieldAppearance(pWidget->GetFormField(), sValue.c_str(), | 731 pInterForm->ResetFieldAppearance(pWidget->GetFormField(), sValue.c_str(), |
| 792 TRUE); | 732 TRUE); |
| 793 pInterForm->UpdateField(pWidget->GetFormField()); | 733 pInterForm->UpdateField(pWidget->GetFormField()); |
| 794 } | 734 } |
| 795 | 735 |
| 796 m_bNotifying = FALSE; | 736 m_bNotifying = FALSE; |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 991 | 931 |
| 992 void CFFL_IFormFiller::OnBeforeKeyStroke(void* pPrivateData, | 932 void CFFL_IFormFiller::OnBeforeKeyStroke(void* pPrivateData, |
| 993 CFX_WideString& strChange, | 933 CFX_WideString& strChange, |
| 994 const CFX_WideString& strChangeEx, | 934 const CFX_WideString& strChangeEx, |
| 995 int nSelStart, | 935 int nSelStart, |
| 996 int nSelEnd, | 936 int nSelEnd, |
| 997 FX_BOOL bKeyDown, | 937 FX_BOOL bKeyDown, |
| 998 FX_BOOL& bRC, | 938 FX_BOOL& bRC, |
| 999 FX_BOOL& bExit, | 939 FX_BOOL& bExit, |
| 1000 FX_DWORD nFlag) { | 940 FX_DWORD nFlag) { |
| 1001 ASSERT(pPrivateData != NULL); | |
| 1002 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 941 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
| 1003 ASSERT(pData->pWidget != NULL); | 942 ASSERT(pData->pWidget); |
| 1004 | 943 |
| 1005 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); | 944 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); |
|
Lei Zhang
2015/12/15 02:27:18
Conflict here
| |
| 1006 ASSERT(pFormFiller != NULL); | |
| 1007 | 945 |
| 1008 #ifdef PDF_ENABLE_XFA | 946 #ifdef PDF_ENABLE_XFA |
| 1009 if (pFormFiller->IsFieldFull(pData->pPageView)) { | 947 if (pFormFiller->IsFieldFull(pData->pPageView)) { |
| 1010 FX_BOOL bFullExit = FALSE; | 948 FX_BOOL bFullExit = FALSE; |
| 1011 FX_BOOL bFullReset = FALSE; | 949 FX_BOOL bFullReset = FALSE; |
| 1012 OnFull(pData->pWidget, pData->pPageView, bFullReset, bFullExit, nFlag); | 950 OnFull(pData->pWidget, pData->pPageView, bFullReset, bFullExit, nFlag); |
| 1013 | 951 |
| 1014 if (bFullReset || bFullExit) { | 952 if (bFullReset || bFullExit) { |
| 1015 bExit = TRUE; | 953 bExit = TRUE; |
| 1016 return; | 954 return; |
| 1017 } | 955 } |
| 1018 } | 956 } |
| 1019 #endif // PDF_ENABLE_XFA | 957 #endif // PDF_ENABLE_XFA |
| 1020 | 958 |
| 1021 if (!m_bNotifying) { | 959 if (!m_bNotifying) { |
| 1022 if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) { | 960 if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) { |
| 1023 m_bNotifying = TRUE; | 961 m_bNotifying = TRUE; |
| 1024 int nAge = pData->pWidget->GetAppearanceAge(); | 962 int nAge = pData->pWidget->GetAppearanceAge(); |
| 1025 int nValueAge = pData->pWidget->GetValueAge(); | 963 int nValueAge = pData->pWidget->GetValueAge(); |
| 1026 | 964 |
| 1027 ASSERT(pData->pPageView != NULL); | |
| 1028 CPDFSDK_Document* pDocument = pData->pPageView->GetSDKDocument(); | 965 CPDFSDK_Document* pDocument = pData->pPageView->GetSDKDocument(); |
| 1029 | 966 |
| 1030 PDFSDK_FieldAction fa; | 967 PDFSDK_FieldAction fa; |
| 1031 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 968 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 1032 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 969 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 1033 fa.sChange = strChange; | 970 fa.sChange = strChange; |
| 1034 fa.sChangeEx = strChangeEx; | 971 fa.sChangeEx = strChangeEx; |
| 1035 fa.bKeyDown = bKeyDown; | 972 fa.bKeyDown = bKeyDown; |
| 1036 fa.bWillCommit = FALSE; | 973 fa.bWillCommit = FALSE; |
| 1037 fa.bRC = TRUE; | 974 fa.bRC = TRUE; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1074 bExit = TRUE; | 1011 bExit = TRUE; |
| 1075 m_bNotifying = FALSE; | 1012 m_bNotifying = FALSE; |
| 1076 return; | 1013 return; |
| 1077 } | 1014 } |
| 1078 } | 1015 } |
| 1079 | 1016 |
| 1080 m_bNotifying = FALSE; | 1017 m_bNotifying = FALSE; |
| 1081 } | 1018 } |
| 1082 } | 1019 } |
| 1083 } | 1020 } |
| OLD | NEW |