| 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_IFormFiller.h" | 8 #include "../../include/formfiller/FFL_IFormFiller.h" |
| 9 #include "../../include/formfiller/FFL_CheckBox.h" | 9 #include "../../include/formfiller/FFL_CheckBox.h" |
| 10 #include "../../include/formfiller/FFL_ComboBox.h" | 10 #include "../../include/formfiller/FFL_ComboBox.h" |
| 11 #include "../../include/formfiller/FFL_ListBox.h" | 11 #include "../../include/formfiller/FFL_ListBox.h" |
| 12 #include "../../include/formfiller/FFL_PushButton.h" | 12 #include "../../include/formfiller/FFL_PushButton.h" |
| 13 #include "../../include/formfiller/FFL_RadioButton.h" | 13 #include "../../include/formfiller/FFL_RadioButton.h" |
| 14 #include "../../include/formfiller/FFL_TextField.h" | 14 #include "../../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; | 18 // HHOOK CFFL_IFormFiller::m_hookSheet = NULL; |
| 19 // MSG CFFL_IFormFiller::g_Msg; | 19 // MSG CFFL_IFormFiller::g_Msg; |
| 20 | 20 |
| 21 /* ----------------------------- CFFL_IFormFiller -----------------------------
*/ | 21 /* ----------------------------- CFFL_IFormFiller -----------------------------
*/ |
| 22 | 22 |
| 23 CFFL_IFormFiller::CFFL_IFormFiller(CPDFDoc_Environment* pApp) : | 23 CFFL_IFormFiller::CFFL_IFormFiller(CPDFDoc_Environment* pApp) : |
| 24 m_pApp(pApp), | 24 m_pApp(pApp), |
| 25 m_bNotifying(FALSE) | 25 m_bNotifying(false) |
| 26 { | 26 { |
| 27 } | 27 } |
| 28 | 28 |
| 29 CFFL_IFormFiller::~CFFL_IFormFiller() | 29 CFFL_IFormFiller::~CFFL_IFormFiller() |
| 30 { | 30 { |
| 31 for (auto& it : m_Maps) | 31 for (auto& it : m_Maps) |
| 32 delete it.second; | 32 delete it.second; |
| 33 m_Maps.clear(); | 33 m_Maps.clear(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 FX_BOOL CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView,CPDFSDK_Anno
t* pAnnot, CPDF_Point point) | 36 bool CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView,CPDFSDK_Annot*
pAnnot, CPDF_Point point) |
| 37 { | 37 { |
| 38 CPDF_Rect rc = pAnnot->GetRect(); | 38 CPDF_Rect rc = pAnnot->GetRect(); |
| 39 if(rc.Contains(point.x, point.y)) | 39 if(rc.Contains(point.x, point.y)) |
| 40 return TRUE; | 40 return true; |
| 41 return FALSE; | 41 return false; |
| 42 } | 42 } |
| 43 | 43 |
| 44 FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot
* pAnnot) | 44 FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, CPDFSDK_Annot
* pAnnot) |
| 45 { | 45 { |
| 46 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 46 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) |
| 47 return pFormFiller->GetViewBBox(pPageView, pAnnot); | 47 return pFormFiller->GetViewBBox(pPageView, pAnnot); |
| 48 | 48 |
| 49 ASSERT(pPageView != NULL); | 49 ASSERT(pPageView != NULL); |
| 50 | 50 |
| 51 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); | 51 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); |
| 52 CPDF_Rect rcAnnot; | 52 CPDF_Rect rcAnnot; |
| 53 pPDFAnnot->GetRect(rcAnnot); | 53 pPDFAnnot->GetRect(rcAnnot); |
| 54 | 54 |
| 55 CPDF_Rect rcWin = CPWL_Utils::InflateRect(rcAnnot, 1); | 55 CPDF_Rect rcWin = CPWL_Utils::InflateRect(rcAnnot, 1); |
| 56 return rcWin.GetOutterRect(); | 56 return rcWin.GetOutterRect(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, /*HDC hDC,*/ CPDFSDK_
Annot* pAnnot, | 59 void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, /*HDC hDC,*/ CPDFSDK_
Annot* pAnnot, |
| 60 CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, | 60 CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, |
| 61 /*const CRect& rcWindow,*/ FX_DWORD dwFlags) | 61 /*const CRect& rcWindow,*/ FX_DWORD dwFlags) |
| 62 { | 62 { |
| 63 ASSERT(pPageView != NULL); | 63 ASSERT(pPageView != NULL); |
| 64 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 64 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 65 | 65 |
| 66 if (IsVisible(pWidget)) | 66 if (IsVisible(pWidget)) |
| 67 { | 67 { |
| 68 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 68 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) |
| 69 { | 69 { |
| 70 if (pFormFiller->IsValid()) | 70 if (pFormFiller->IsValid()) |
| 71 { | 71 { |
| 72 pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dw
Flags); | 72 pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dw
Flags); |
| 73 pAnnot->GetPDFPage(); | 73 pAnnot->GetPDFPage(); |
| 74 | 74 |
| 75 CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); | 75 CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); |
| 76 if (pDocument->GetFocusAnnot() == pAnnot) | 76 if (pDocument->GetFocusAnnot() == pAnnot) |
| 77 { | 77 { |
| 78 CPDF_Rect rcFocus = pFormFiller->GetFocusBox(pPageView); | 78 CPDF_Rect rcFocus = pFormFiller->GetFocusBox(pPageView); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 91 gsd.m_DashArray[0] = 1.0f; | 91 gsd.m_DashArray[0] = 1.0f; |
| 92 gsd.m_DashPhase = 0; | 92 gsd.m_DashPhase = 0; |
| 93 gsd.m_LineWidth = 1.0f; | 93 gsd.m_LineWidth = 1.0f; |
| 94 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, ArgbEnco
de(255,0,0,0), FXFILL_ALTERNATE); | 94 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, ArgbEnco
de(255,0,0,0), FXFILL_ALTERNATE); |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 return; | 97 return; |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 | 100 |
| 101 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 101 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) |
| 102 pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device
, dwFlags); | 102 pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device
, dwFlags); |
| 103 else | 103 else |
| 104 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, N
ULL); | 104 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, N
ULL); |
| 105 | 105 |
| 106 if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget)) | 106 if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget)) |
| 107 pWidget->DrawShadow(pDevice, pPageView); | 107 pWidget->DrawShadow(pDevice, pPageView); |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 | 110 |
| 111 void CFFL_IFormFiller::OnCreate(CPDFSDK_Annot* pAnnot) | 111 void CFFL_IFormFiller::OnCreate(CPDFSDK_Annot* pAnnot) |
| 112 { | 112 { |
| 113 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 113 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) |
| 114 { | 114 { |
| 115 pFormFiller->OnCreate(pAnnot); | 115 pFormFiller->OnCreate(pAnnot); |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 | 118 |
| 119 void CFFL_IFormFiller::OnLoad(CPDFSDK_Annot* pAnnot) | 119 void CFFL_IFormFiller::OnLoad(CPDFSDK_Annot* pAnnot) |
| 120 { | 120 { |
| 121 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 121 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) |
| 122 { | 122 { |
| 123 pFormFiller->OnLoad(pAnnot); | 123 pFormFiller->OnLoad(pAnnot); |
| 124 } | 124 } |
| 125 } | 125 } |
| 126 | 126 |
| 127 void CFFL_IFormFiller::OnDelete(CPDFSDK_Annot* pAnnot) | 127 void CFFL_IFormFiller::OnDelete(CPDFSDK_Annot* pAnnot) |
| 128 { | 128 { |
| 129 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 129 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) |
| 130 { | 130 { |
| 131 pFormFiller->OnDelete(pAnnot); | 131 pFormFiller->OnDelete(pAnnot); |
| 132 } | 132 } |
| 133 | 133 |
| 134 UnRegisterFormFiller(pAnnot); | 134 UnRegisterFormFiller(pAnnot); |
| 135 } | 135 } |
| 136 | 136 |
| 137 void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot*
pAnnot, FX_UINT nFlag) | 137 void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, CPDFSDK_Annot*
pAnnot, FX_UINT nFlag) |
| 138 { | 138 { |
| 139 ASSERT(pAnnot != NULL); | 139 ASSERT(pAnnot != NULL); |
| 140 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 140 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 141 | 141 |
| 142 if (!m_bNotifying) | 142 if (!m_bNotifying) |
| 143 { | 143 { |
| 144 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 144 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 145 if (pWidget->GetAAction(CPDF_AAction::CursorEnter)) | 145 if (pWidget->GetAAction(CPDF_AAction::CursorEnter)) |
| 146 { | 146 { |
| 147 m_bNotifying = TRUE; | 147 m_bNotifying = true; |
| 148 | 148 |
| 149 int nValueAge = pWidget->GetValueAge(); | 149 int nValueAge = pWidget->GetValueAge(); |
| 150 | 150 |
| 151 pWidget->ClearAppModified(); | 151 pWidget->ClearAppModified(); |
| 152 | 152 |
| 153 ASSERT(pPageView != NULL); | 153 ASSERT(pPageView != NULL); |
| 154 | 154 |
| 155 | 155 |
| 156 | 156 |
| 157 PDFSDK_FieldAction fa; | 157 PDFSDK_FieldAction fa; |
| 158 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 158 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 159 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 159 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 160 pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView ); | 160 pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView ); |
| 161 m_bNotifying = FALSE; | 161 m_bNotifying = false; |
| 162 | 162 |
| 163 //if ( !IsValidAnnot(pPageView, pAnnot) ) return; | 163 //if ( !IsValidAnnot(pPageView, pAnnot) ) return; |
| 164 | 164 |
| 165 if (pWidget->IsAppModified()) | 165 if (pWidget->IsAppModified()) |
| 166 { | 166 { |
| 167 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)
) | 167 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)
) |
| 168 { | 168 { |
| 169 pFormFiller->ResetPDFWindow(pPageView, pWidget->GetValueAge(
) == nValueAge); | 169 pFormFiller->ResetPDFWindow(pPageView, pWidget->GetValueAge(
) == nValueAge); |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 } | 173 } |
| 174 | 174 |
| 175 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) | 175 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, true)) |
| 176 { | 176 { |
| 177 pFormFiller->OnMouseEnter(pPageView, pAnnot); | 177 pFormFiller->OnMouseEnter(pPageView, pAnnot); |
| 178 } | 178 } |
| 179 } | 179 } |
| 180 | 180 |
| 181 void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* p
Annot, FX_UINT nFlag) | 181 void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* p
Annot, FX_UINT nFlag) |
| 182 { | 182 { |
| 183 ASSERT(pAnnot != NULL); | 183 ASSERT(pAnnot != NULL); |
| 184 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 184 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 185 | 185 |
| 186 if (!m_bNotifying) | 186 if (!m_bNotifying) |
| 187 { | 187 { |
| 188 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 188 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 189 if (pWidget->GetAAction(CPDF_AAction::CursorExit)) | 189 if (pWidget->GetAAction(CPDF_AAction::CursorExit)) |
| 190 { | 190 { |
| 191 m_bNotifying = TRUE; | 191 m_bNotifying = true; |
| 192 pWidget->GetAppearanceAge(); | 192 pWidget->GetAppearanceAge(); |
| 193 int nValueAge = pWidget->GetValueAge(); | 193 int nValueAge = pWidget->GetValueAge(); |
| 194 pWidget->ClearAppModified(); | 194 pWidget->ClearAppModified(); |
| 195 | 195 |
| 196 ASSERT(pPageView != NULL); | 196 ASSERT(pPageView != NULL); |
| 197 | 197 |
| 198 | 198 |
| 199 | 199 |
| 200 PDFSDK_FieldAction fa; | 200 PDFSDK_FieldAction fa; |
| 201 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 201 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 202 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 202 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 203 | 203 |
| 204 pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView); | 204 pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView); |
| 205 m_bNotifying = FALSE; | 205 m_bNotifying = false; |
| 206 | 206 |
| 207 //if (!IsValidAnnot(pPageView, pAnnot)) return; | 207 //if (!IsValidAnnot(pPageView, pAnnot)) return; |
| 208 | 208 |
| 209 if (pWidget->IsAppModified()) | 209 if (pWidget->IsAppModified()) |
| 210 { | 210 { |
| 211 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)
) | 211 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)
) |
| 212 { | 212 { |
| 213 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget-
>GetValueAge()); | 213 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget-
>GetValueAge()); |
| 214 } | 214 } |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 219 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) |
| 220 { | 220 { |
| 221 pFormFiller->OnMouseExit(pPageView, pAnnot); | 221 pFormFiller->OnMouseExit(pPageView, pAnnot); |
| 222 } | 222 } |
| 223 } | 223 } |
| 224 | 224 |
| 225 FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann
ot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 225 bool CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot*
pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
| 226 { | 226 { |
| 227 ASSERT(pAnnot != NULL); | 227 ASSERT(pAnnot != NULL); |
| 228 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 228 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 229 | 229 |
| 230 if (!m_bNotifying) | 230 if (!m_bNotifying) |
| 231 { | 231 { |
| 232 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 232 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 233 if (Annot_HitTest(pPageView, pAnnot, point) && pWidget->GetAAction(CPDF_
AAction::ButtonDown)) | 233 if (Annot_HitTest(pPageView, pAnnot, point) && pWidget->GetAAction(CPDF_
AAction::ButtonDown)) |
| 234 { | 234 { |
| 235 m_bNotifying = TRUE; | 235 m_bNotifying = true; |
| 236 pWidget->GetAppearanceAge(); | 236 pWidget->GetAppearanceAge(); |
| 237 int nValueAge = pWidget->GetValueAge(); | 237 int nValueAge = pWidget->GetValueAge(); |
| 238 pWidget->ClearAppModified(); | 238 pWidget->ClearAppModified(); |
| 239 | 239 |
| 240 ASSERT(pPageView != NULL); | 240 ASSERT(pPageView != NULL); |
| 241 | 241 |
| 242 | 242 |
| 243 | 243 |
| 244 PDFSDK_FieldAction fa; | 244 PDFSDK_FieldAction fa; |
| 245 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlags); | 245 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlags); |
| 246 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlags); | 246 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlags); |
| 247 pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageView); | 247 pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageView); |
| 248 m_bNotifying = FALSE; | 248 m_bNotifying = false; |
| 249 | 249 |
| 250 if (!IsValidAnnot(pPageView, pAnnot)) return TRUE; | 250 if (!IsValidAnnot(pPageView, pAnnot)) return true; |
| 251 | 251 |
| 252 if (pWidget->IsAppModified()) | 252 if (pWidget->IsAppModified()) |
| 253 { | 253 { |
| 254 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)
) | 254 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)
) |
| 255 { | 255 { |
| 256 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget-
>GetValueAge()); | 256 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget-
>GetValueAge()); |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 } | 260 } |
| 261 | 261 |
| 262 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 262 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) |
| 263 { | 263 { |
| 264 return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point); | 264 return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point); |
| 265 } | 265 } |
| 266 | 266 |
| 267 return FALSE; | 267 return false; |
| 268 } | 268 } |
| 269 | 269 |
| 270 FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot
* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 270 bool CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* p
Annot, FX_UINT nFlags, const CPDF_Point& point) |
| 271 { | 271 { |
| 272 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 272 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 273 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 273 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 274 CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); | 274 CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); |
| 275 | 275 |
| 276 switch (pWidget->GetFieldType()) | 276 switch (pWidget->GetFieldType()) |
| 277 { | 277 { |
| 278 case FIELDTYPE_PUSHBUTTON: | 278 case FIELDTYPE_PUSHBUTTON: |
| 279 case FIELDTYPE_CHECKBOX: | 279 case FIELDTYPE_CHECKBOX: |
| 280 case FIELDTYPE_RADIOBUTTON: | 280 case FIELDTYPE_RADIOBUTTON: |
| 281 if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)point.y)) | 281 if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)point.y)) |
| 282 pDocument->SetFocusAnnot(pAnnot); | 282 pDocument->SetFocusAnnot(pAnnot); |
| 283 break; | 283 break; |
| 284 default: | 284 default: |
| 285 pDocument->SetFocusAnnot(pAnnot); | 285 pDocument->SetFocusAnnot(pAnnot); |
| 286 break; | 286 break; |
| 287 } | 287 } |
| 288 | 288 |
| 289 FX_BOOL bRet = FALSE; | 289 bool bRet = false; |
| 290 | 290 |
| 291 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 291 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) |
| 292 { | 292 { |
| 293 bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); | 293 bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); |
| 294 } | 294 } |
| 295 | 295 |
| 296 if (pDocument->GetFocusAnnot() == pAnnot) | 296 if (pDocument->GetFocusAnnot() == pAnnot) |
| 297 { | 297 { |
| 298 FX_BOOL bExit = FALSE; | 298 bool bExit = false; |
| 299 FX_BOOL bReset = FALSE; | 299 bool bReset = false; |
| 300 OnButtonUp(pWidget, pPageView, bReset, bExit,nFlags); | 300 OnButtonUp(pWidget, pPageView, bReset, bExit,nFlags); |
| 301 if (bExit) return TRUE; | 301 if (bExit) return true; |
| 302 } | 302 } |
| 303 return bRet; | 303 return bRet; |
| 304 } | 304 } |
| 305 | 305 |
| 306 void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa
geView, FX_BOOL& bReset, FX_BOOL& bExit,FX_UINT nFlag) | 306 void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa
geView, bool& bReset, bool& bExit,FX_UINT nFlag) |
| 307 { | 307 { |
| 308 ASSERT(pWidget != NULL); | 308 ASSERT(pWidget != NULL); |
| 309 | 309 |
| 310 if (!m_bNotifying) | 310 if (!m_bNotifying) |
| 311 { | 311 { |
| 312 if (pWidget->GetAAction(CPDF_AAction::ButtonUp)) | 312 if (pWidget->GetAAction(CPDF_AAction::ButtonUp)) |
| 313 { | 313 { |
| 314 m_bNotifying = TRUE; | 314 m_bNotifying = true; |
| 315 int nAge = pWidget->GetAppearanceAge(); | 315 int nAge = pWidget->GetAppearanceAge(); |
| 316 int nValueAge = pWidget->GetValueAge(); | 316 int nValueAge = pWidget->GetValueAge(); |
| 317 | 317 |
| 318 ASSERT(pPageView != NULL); | 318 ASSERT(pPageView != NULL); |
| 319 // CReader_DocView* pDocView = pPageView->GetDocView(); | 319 // CReader_DocView* pDocView = pPageView->GetDocView(); |
| 320 // ASSERT(pDocView != NULL); | 320 // ASSERT(pDocView != NULL); |
| 321 | 321 |
| 322 | 322 |
| 323 | 323 |
| 324 PDFSDK_FieldAction fa; | 324 PDFSDK_FieldAction fa; |
| 325 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 325 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 326 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 326 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 327 | 327 |
| 328 pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView); | 328 pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView); |
| 329 m_bNotifying = FALSE; | 329 m_bNotifying = false; |
| 330 | 330 |
| 331 if (!IsValidAnnot(pPageView, pWidget)) | 331 if (!IsValidAnnot(pPageView, pWidget)) |
| 332 { | 332 { |
| 333 bExit = TRUE; | 333 bExit = true; |
| 334 return; | 334 return; |
| 335 } | 335 } |
| 336 | 336 |
| 337 if (nAge != pWidget->GetAppearanceAge()) | 337 if (nAge != pWidget->GetAppearanceAge()) |
| 338 { | 338 { |
| 339 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)
) | 339 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)
) |
| 340 { | 340 { |
| 341 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget-
>GetValueAge()); | 341 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget-
>GetValueAge()); |
| 342 } | 342 } |
| 343 | 343 |
| 344 bReset = TRUE; | 344 bReset = true; |
| 345 } | 345 } |
| 346 } | 346 } |
| 347 } | 347 } |
| 348 } | 348 } |
| 349 | 349 |
| 350 FX_BOOL CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_A
nnot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 350 bool CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_Anno
t* pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
| 351 { | 351 { |
| 352 ASSERT(pAnnot != NULL); | 352 ASSERT(pAnnot != NULL); |
| 353 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 353 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 354 | 354 |
| 355 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 355 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) |
| 356 { | 356 { |
| 357 return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); | 357 return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); |
| 358 } | 358 } |
| 359 | 359 |
| 360 return FALSE; | 360 return false; |
| 361 } | 361 } |
| 362 | 362 |
| 363 FX_BOOL CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot
* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 363 bool CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* p
Annot, FX_UINT nFlags, const CPDF_Point& point) |
| 364 { | 364 { |
| 365 ASSERT(pAnnot != NULL); | 365 ASSERT(pAnnot != NULL); |
| 366 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 366 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 367 | 367 |
| 368 //change cursor | 368 //change cursor |
| 369 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) | 369 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, true)) |
| 370 { | 370 { |
| 371 return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); | 371 return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); |
| 372 } | 372 } |
| 373 | 373 |
| 374 return FALSE; | 374 return false; |
| 375 } | 375 } |
| 376 | 376 |
| 377 FX_BOOL CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Anno
t* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point) | 377 bool CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Annot*
pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point) |
| 378 { | 378 { |
| 379 ASSERT(pAnnot != NULL); | 379 ASSERT(pAnnot != NULL); |
| 380 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 380 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 381 | 381 |
| 382 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 382 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) |
| 383 { | 383 { |
| 384 return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, poin
t); | 384 return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, poin
t); |
| 385 } | 385 } |
| 386 | 386 |
| 387 return FALSE; | 387 return false; |
| 388 } | 388 } |
| 389 | 389 |
| 390 FX_BOOL CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann
ot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 390 bool CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Annot*
pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
| 391 { | 391 { |
| 392 ASSERT(pAnnot != NULL); | 392 ASSERT(pAnnot != NULL); |
| 393 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 393 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 394 | 394 |
| 395 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 395 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) |
| 396 { | 396 { |
| 397 return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); | 397 return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); |
| 398 } | 398 } |
| 399 | 399 |
| 400 return FALSE; | 400 return false; |
| 401 } | 401 } |
| 402 | 402 |
| 403 FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot
* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 403 bool CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* p
Annot, FX_UINT nFlags, const CPDF_Point& point) |
| 404 { | 404 { |
| 405 ASSERT(pAnnot != NULL); | 405 ASSERT(pAnnot != NULL); |
| 406 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 406 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 407 | 407 |
| 408 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 408 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) |
| 409 { | 409 { |
| 410 return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); | 410 return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); |
| 411 } | 411 } |
| 412 | 412 |
| 413 return FALSE; | 413 return false; |
| 414 } | 414 } |
| 415 | 415 |
| 416 FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_
UINT nFlags) | 416 bool CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_UIN
T nFlags) |
| 417 { | 417 { |
| 418 ASSERT(pAnnot != NULL); | 418 ASSERT(pAnnot != NULL); |
| 419 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 419 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 420 | 420 |
| 421 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 421 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) |
| 422 { | 422 { |
| 423 return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); | 423 return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); |
| 424 } | 424 } |
| 425 | 425 |
| 426 return FALSE; | 426 return false; |
| 427 } | 427 } |
| 428 | 428 |
| 429 FX_BOOL CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT n
Flags) | 429 bool CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFla
gs) |
| 430 { | 430 { |
| 431 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 431 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 432 if (nChar == FWL_VKEY_Tab) | 432 if (nChar == FWL_VKEY_Tab) |
| 433 return TRUE; | 433 return true; |
| 434 | 434 |
| 435 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 435 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) |
| 436 return pFormFiller->OnChar(pAnnot, nChar, nFlags); | 436 return pFormFiller->OnChar(pAnnot, nChar, nFlags); |
| 437 | 437 |
| 438 return FALSE; | 438 return false; |
| 439 } | 439 } |
| 440 | 440 |
| 441 FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) | 441 bool CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) |
| 442 { | 442 { |
| 443 if (!pAnnot) | 443 if (!pAnnot) |
| 444 return FALSE; | 444 return false; |
| 445 | 445 |
| 446 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 446 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 447 | 447 |
| 448 if (!m_bNotifying) | 448 if (!m_bNotifying) |
| 449 { | 449 { |
| 450 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 450 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 451 if (pWidget->GetAAction(CPDF_AAction::GetFocus)) | 451 if (pWidget->GetAAction(CPDF_AAction::GetFocus)) |
| 452 { | 452 { |
| 453 m_bNotifying = TRUE; | 453 m_bNotifying = true; |
| 454 pWidget->GetAppearanceAge(); | 454 pWidget->GetAppearanceAge(); |
| 455 | 455 |
| 456 int nValueAge = pWidget->GetValueAge(); | 456 int nValueAge = pWidget->GetValueAge(); |
| 457 pWidget->ClearAppModified(); | 457 pWidget->ClearAppModified(); |
| 458 | 458 |
| 459 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); | 459 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); |
| 460 ASSERT(pPageView != NULL); | 460 ASSERT(pPageView != NULL); |
| 461 | 461 |
| 462 PDFSDK_FieldAction fa; | 462 PDFSDK_FieldAction fa; |
| 463 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 463 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 464 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 464 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 465 | 465 |
| 466 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TRUE); | 466 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, true); |
| 467 if(!pFormFiller) return FALSE; | 467 if(!pFormFiller) return false; |
| 468 pFormFiller->GetActionData(pPageView, CPDF_AAction::GetFocus, fa); | 468 pFormFiller->GetActionData(pPageView, CPDF_AAction::GetFocus, fa); |
| 469 pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView); | 469 pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView); |
| 470 m_bNotifying = FALSE; | 470 m_bNotifying = false; |
| 471 | 471 |
| 472 if (pWidget->IsAppModified()) | 472 if (pWidget->IsAppModified()) |
| 473 { | 473 { |
| 474 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)
) | 474 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false)
) |
| 475 { | 475 { |
| 476 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget-
>GetValueAge()); | 476 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget-
>GetValueAge()); |
| 477 } | 477 } |
| 478 } | 478 } |
| 479 } | 479 } |
| 480 } | 480 } |
| 481 | 481 |
| 482 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) | 482 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, true)) |
| 483 return pFormFiller->OnSetFocus(pAnnot, nFlag); | 483 return pFormFiller->OnSetFocus(pAnnot, nFlag); |
| 484 | 484 |
| 485 return TRUE; | 485 return true; |
| 486 } | 486 } |
| 487 | 487 |
| 488 FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) | 488 bool CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) |
| 489 { | 489 { |
| 490 if(!pAnnot) return FALSE; | 490 if(!pAnnot) return false; |
| 491 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 491 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 492 | 492 |
| 493 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 493 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, false)) |
| 494 { | 494 { |
| 495 if (pFormFiller->OnKillFocus(pAnnot, nFlag)) | 495 if (pFormFiller->OnKillFocus(pAnnot, nFlag)) |
| 496 { | 496 { |
| 497 if (!m_bNotifying) | 497 if (!m_bNotifying) |
| 498 { | 498 { |
| 499 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 499 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 500 if (pWidget->GetAAction(CPDF_AAction::LoseFocus)) | 500 if (pWidget->GetAAction(CPDF_AAction::LoseFocus)) |
| 501 { | 501 { |
| 502 m_bNotifying = TRUE; | 502 m_bNotifying = true; |
| 503 pWidget->ClearAppModified(); | 503 pWidget->ClearAppModified(); |
| 504 | 504 |
| 505 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); | 505 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); |
| 506 ASSERT(pPageView != NULL); | 506 ASSERT(pPageView != NULL); |
| 507 | 507 |
| 508 PDFSDK_FieldAction fa; | 508 PDFSDK_FieldAction fa; |
| 509 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 509 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 510 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 510 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 511 | 511 |
| 512 pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocu
s, fa); | 512 pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocu
s, fa); |
| 513 | 513 |
| 514 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); | 514 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); |
| 515 m_bNotifying = FALSE; | 515 m_bNotifying = false; |
| 516 | 516 |
| 517 } | 517 } |
| 518 } | 518 } |
| 519 } | 519 } |
| 520 else | 520 else |
| 521 return FALSE; | 521 return false; |
| 522 } | 522 } |
| 523 | 523 |
| 524 return TRUE; | 524 return true; |
| 525 } | 525 } |
| 526 | 526 |
| 527 FX_BOOL CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) | 527 bool CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) |
| 528 { | 528 { |
| 529 return pWidget->IsVisible(); | 529 return pWidget->IsVisible(); |
| 530 } | 530 } |
| 531 | 531 |
| 532 FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) | 532 bool CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) |
| 533 { | 533 { |
| 534 ASSERT(pWidget != NULL); | 534 ASSERT(pWidget != NULL); |
| 535 | 535 |
| 536 int nFieldFlags = pWidget->GetFieldFlags(); | 536 int nFieldFlags = pWidget->GetFieldFlags(); |
| 537 | 537 |
| 538 return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY; | 538 return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY; |
| 539 } | 539 } |
| 540 | 540 |
| 541 FX_BOOL CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) | 541 bool CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) |
| 542 { | 542 { |
| 543 ASSERT(pWidget != NULL); | 543 ASSERT(pWidget != NULL); |
| 544 | 544 |
| 545 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) | 545 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) |
| 546 return TRUE; | 546 return true; |
| 547 else | 547 else |
| 548 { | 548 { |
| 549 CPDF_Page* pPage = pWidget->GetPDFPage(); | 549 CPDF_Page* pPage = pWidget->GetPDFPage(); |
| 550 ASSERT(pPage != NULL); | 550 ASSERT(pPage != NULL); |
| 551 | 551 |
| 552 CPDF_Document* pDocument = pPage->m_pDocument; | 552 CPDF_Document* pDocument = pPage->m_pDocument; |
| 553 ASSERT(pDocument != NULL); | 553 ASSERT(pDocument != NULL); |
| 554 | 554 |
| 555 FX_DWORD dwPermissions = pDocument->GetUserPermissions(); | 555 FX_DWORD dwPermissions = pDocument->GetUserPermissions(); |
| 556 return (dwPermissions&FPDFPERM_FILL_FORM) || | 556 return (dwPermissions&FPDFPERM_FILL_FORM) || |
| 557 (dwPermissions&FPDFPERM_ANNOT_FORM) || | 557 (dwPermissions&FPDFPERM_ANNOT_FORM) || |
| 558 (dwPermissions&FPDFPERM_MODIFY); | 558 (dwPermissions&FPDFPERM_MODIFY); |
| 559 } | 559 } |
| 560 return TRUE; | 560 return true; |
| 561 } | 561 } |
| 562 | 562 |
| 563 CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL
bRegister) | 563 CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot, bool bRe
gister) |
| 564 { | 564 { |
| 565 auto it = m_Maps.find(pAnnot); | 565 auto it = m_Maps.find(pAnnot); |
| 566 if (it != m_Maps.end()) | 566 if (it != m_Maps.end()) |
| 567 return it->second; | 567 return it->second; |
| 568 | 568 |
| 569 if (!bRegister) | 569 if (!bRegister) |
| 570 return nullptr; | 570 return nullptr; |
| 571 | 571 |
| 572 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 572 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 573 int nFieldType = pWidget->GetFieldType(); | 573 int nFieldType = pWidget->GetFieldType(); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 659 fTop = rcAnnot.bottom - rcPageView.bottom; | 659 fTop = rcAnnot.bottom - rcPageView.bottom; |
| 660 fBottom = rcPageView.top - rcAnnot.top; | 660 fBottom = rcPageView.top - rcAnnot.top; |
| 661 break; | 661 break; |
| 662 case 3: | 662 case 3: |
| 663 fTop = rcPageView.right - rcAnnot.right; | 663 fTop = rcPageView.right - rcAnnot.right; |
| 664 fBottom = rcAnnot.left - rcPageView.left; | 664 fBottom = rcAnnot.left - rcPageView.left; |
| 665 break; | 665 break; |
| 666 } | 666 } |
| 667 | 667 |
| 668 FX_FLOAT fFactHeight = 0; | 668 FX_FLOAT fFactHeight = 0; |
| 669 FX_BOOL bBottom = TRUE; | 669 bool bBottom = true; |
| 670 FX_FLOAT fMaxListBoxHeight = 0; | 670 FX_FLOAT fMaxListBoxHeight = 0; |
| 671 if (fPopupMax > FFL_MAXLISTBOXHEIGHT) | 671 if (fPopupMax > FFL_MAXLISTBOXHEIGHT) |
| 672 { | 672 { |
| 673 if (fPopupMin > FFL_MAXLISTBOXHEIGHT) | 673 if (fPopupMin > FFL_MAXLISTBOXHEIGHT) |
| 674 { | 674 { |
| 675 fMaxListBoxHeight = fPopupMin; | 675 fMaxListBoxHeight = fPopupMin; |
| 676 } | 676 } |
| 677 else | 677 else |
| 678 { | 678 { |
| 679 fMaxListBoxHeight = FFL_MAXLISTBOXHEIGHT; | 679 fMaxListBoxHeight = FFL_MAXLISTBOXHEIGHT; |
| 680 } | 680 } |
| 681 } | 681 } |
| 682 else | 682 else |
| 683 fMaxListBoxHeight = fPopupMax; | 683 fMaxListBoxHeight = fPopupMax; |
| 684 | 684 |
| 685 if (fBottom > fMaxListBoxHeight) | 685 if (fBottom > fMaxListBoxHeight) |
| 686 { | 686 { |
| 687 fFactHeight = fMaxListBoxHeight; | 687 fFactHeight = fMaxListBoxHeight; |
| 688 bBottom = TRUE; | 688 bBottom = true; |
| 689 } | 689 } |
| 690 else | 690 else |
| 691 { | 691 { |
| 692 if (fTop > fMaxListBoxHeight) | 692 if (fTop > fMaxListBoxHeight) |
| 693 { | 693 { |
| 694 fFactHeight = fMaxListBoxHeight; | 694 fFactHeight = fMaxListBoxHeight; |
| 695 bBottom = FALSE; | 695 bBottom = false; |
| 696 } | 696 } |
| 697 else | 697 else |
| 698 { | 698 { |
| 699 if (fTop > fBottom) | 699 if (fTop > fBottom) |
| 700 { | 700 { |
| 701 fFactHeight = fTop; | 701 fFactHeight = fTop; |
| 702 bBottom = FALSE; | 702 bBottom = false; |
| 703 } | 703 } |
| 704 else | 704 else |
| 705 { | 705 { |
| 706 fFactHeight = fBottom; | 706 fFactHeight = fBottom; |
| 707 bBottom = TRUE; | 707 bBottom = true; |
| 708 } | 708 } |
| 709 } | 709 } |
| 710 } | 710 } |
| 711 | 711 |
| 712 nRet = bBottom ? 0 : 1; | 712 nRet = bBottom ? 0 : 1; |
| 713 fPopupRet = fFactHeight; | 713 fPopupRet = fFactHeight; |
| 714 } | 714 } |
| 715 | 715 |
| 716 void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, CPDFSDK_PageVi
ew* pPageView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag) | 716 void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, CPDFSDK_PageVi
ew* pPageView, bool& bRC, bool& bExit, FX_DWORD nFlag) |
| 717 { | 717 { |
| 718 if (!m_bNotifying) | 718 if (!m_bNotifying) |
| 719 { | 719 { |
| 720 ASSERT(pWidget != NULL); | 720 ASSERT(pWidget != NULL); |
| 721 if (pWidget->GetAAction(CPDF_AAction::KeyStroke)) | 721 if (pWidget->GetAAction(CPDF_AAction::KeyStroke)) |
| 722 { | 722 { |
| 723 m_bNotifying = TRUE; | 723 m_bNotifying = true; |
| 724 pWidget->ClearAppModified(); | 724 pWidget->ClearAppModified(); |
| 725 | 725 |
| 726 ASSERT(pPageView != NULL); | 726 ASSERT(pPageView != NULL); |
| 727 | 727 |
| 728 PDFSDK_FieldAction fa; | 728 PDFSDK_FieldAction fa; |
| 729 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 729 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 730 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 730 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 731 fa.bWillCommit = TRUE; | 731 fa.bWillCommit = true; |
| 732 fa.bKeyDown = TRUE; | 732 fa.bKeyDown = true; |
| 733 fa.bRC = TRUE; | 733 fa.bRC = true; |
| 734 | 734 |
| 735 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); | 735 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false); |
| 736 ASSERT(pFormFiller != NULL); | 736 ASSERT(pFormFiller != NULL); |
| 737 | 737 |
| 738 pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa); | 738 pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa); |
| 739 pFormFiller->SaveState(pPageView); | 739 pFormFiller->SaveState(pPageView); |
| 740 | 740 |
| 741 PDFSDK_FieldAction faOld = fa; | 741 PDFSDK_FieldAction faOld = fa; |
| 742 pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView); | 742 pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView); |
| 743 | 743 |
| 744 bRC = fa.bRC; | 744 bRC = fa.bRC; |
| 745 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidge
t); | 745 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidge
t); |
| 746 | 746 |
| 747 m_bNotifying = FALSE; | 747 m_bNotifying = false; |
| 748 } | 748 } |
| 749 } | 749 } |
| 750 } | 750 } |
| 751 | 751 |
| 752 void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa
geView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag) | 752 void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa
geView, bool& bRC, bool& bExit, FX_DWORD nFlag) |
| 753 { | 753 { |
| 754 if (!m_bNotifying) | 754 if (!m_bNotifying) |
| 755 { | 755 { |
| 756 ASSERT(pWidget != NULL); | 756 ASSERT(pWidget != NULL); |
| 757 if (pWidget->GetAAction(CPDF_AAction::Validate)) | 757 if (pWidget->GetAAction(CPDF_AAction::Validate)) |
| 758 { | 758 { |
| 759 m_bNotifying = TRUE; | 759 m_bNotifying = true; |
| 760 pWidget->ClearAppModified(); | 760 pWidget->ClearAppModified(); |
| 761 | 761 |
| 762 ASSERT(pPageView != NULL); | 762 ASSERT(pPageView != NULL); |
| 763 // CReader_DocView* pDocView = pPageView->GetDocView(); | 763 // CReader_DocView* pDocView = pPageView->GetDocView(); |
| 764 // ASSERT(pDocView != NULL); | 764 // ASSERT(pDocView != NULL); |
| 765 | 765 |
| 766 | 766 |
| 767 | 767 |
| 768 PDFSDK_FieldAction fa; | 768 PDFSDK_FieldAction fa; |
| 769 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 769 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 770 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 770 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 771 fa.bKeyDown = TRUE; | 771 fa.bKeyDown = true; |
| 772 fa.bRC = TRUE; | 772 fa.bRC = true; |
| 773 | 773 |
| 774 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); | 774 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, false); |
| 775 ASSERT(pFormFiller != NULL); | 775 ASSERT(pFormFiller != NULL); |
| 776 | 776 |
| 777 pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa); | 777 pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa); |
| 778 pFormFiller->SaveState(pPageView); | 778 pFormFiller->SaveState(pPageView); |
| 779 | 779 |
| 780 PDFSDK_FieldAction faOld = fa; | 780 PDFSDK_FieldAction faOld = fa; |
| 781 pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView); | 781 pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView); |
| 782 | 782 |
| 783 bRC = fa.bRC; | 783 bRC = fa.bRC; |
| 784 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidge
t); | 784 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidge
t); |
| 785 | 785 |
| 786 m_bNotifying = FALSE; | 786 m_bNotifying = false; |
| 787 } | 787 } |
| 788 } | 788 } |
| 789 } | 789 } |
| 790 | 790 |
| 791 void CFFL_IFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pP
ageView, FX_BOOL& bExit, FX_DWORD nFlag) | 791 void CFFL_IFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pP
ageView, bool& bExit, FX_DWORD nFlag) |
| 792 { | 792 { |
| 793 if (!m_bNotifying) | 793 if (!m_bNotifying) |
| 794 { | 794 { |
| 795 ASSERT(pWidget != NULL); | 795 ASSERT(pWidget != NULL); |
| 796 ASSERT(pPageView != NULL); | 796 ASSERT(pPageView != NULL); |
| 797 // CReader_DocView* pDocView = pPageView->GetDocView(); | 797 // CReader_DocView* pDocView = pPageView->GetDocView(); |
| 798 // ASSERT(pDocView != NULL); | 798 // ASSERT(pDocView != NULL); |
| 799 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); | 799 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); |
| 800 ASSERT(pDocument != NULL); | 800 ASSERT(pDocument != NULL); |
| 801 | 801 |
| 802 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); | 802 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); |
| 803 ASSERT(pInterForm != NULL); | 803 ASSERT(pInterForm != NULL); |
| 804 | 804 |
| 805 pInterForm->OnCalculate(pWidget->GetFormField()); | 805 pInterForm->OnCalculate(pWidget->GetFormField()); |
| 806 | 806 |
| 807 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidget); | 807 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidget); |
| 808 | 808 |
| 809 m_bNotifying = FALSE; | 809 m_bNotifying = false; |
| 810 } | 810 } |
| 811 } | 811 } |
| 812 | 812 |
| 813 void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPage
View, FX_BOOL& bExit, FX_DWORD nFlag) | 813 void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPage
View, bool& bExit, FX_DWORD nFlag) |
| 814 { | 814 { |
| 815 if (!m_bNotifying) | 815 if (!m_bNotifying) |
| 816 { | 816 { |
| 817 ASSERT(pWidget != NULL); | 817 ASSERT(pWidget != NULL); |
| 818 ASSERT(pPageView != NULL); | 818 ASSERT(pPageView != NULL); |
| 819 // CReader_DocView* pDocView = pPageView->GetDocView(); | 819 // CReader_DocView* pDocView = pPageView->GetDocView(); |
| 820 // ASSERT(pDocView != NULL); | 820 // ASSERT(pDocView != NULL); |
| 821 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); | 821 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); |
| 822 ASSERT(pDocument != NULL); | 822 ASSERT(pDocument != NULL); |
| 823 | 823 |
| 824 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); | 824 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); |
| 825 ASSERT(pInterForm != NULL); | 825 ASSERT(pInterForm != NULL); |
| 826 | 826 |
| 827 FX_BOOL bFormated = FALSE; | 827 bool bFormated = false; |
| 828 CFX_WideString sValue = pInterForm->OnFormat(pWidget->GetFormField(), bF
ormated); | 828 CFX_WideString sValue = pInterForm->OnFormat(pWidget->GetFormField(), bF
ormated); |
| 829 | 829 |
| 830 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidget); | 830 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidget); |
| 831 | 831 |
| 832 if (bExit) return; | 832 if (bExit) return; |
| 833 | 833 |
| 834 if (bFormated) | 834 if (bFormated) |
| 835 { | 835 { |
| 836 pInterForm->ResetFieldAppearance(pWidget->GetFormField(), sValue.c_s
tr(), TRUE); | 836 pInterForm->ResetFieldAppearance(pWidget->GetFormField(), sValue.c_s
tr(), true); |
| 837 pInterForm->UpdateField(pWidget->GetFormField()); | 837 pInterForm->UpdateField(pWidget->GetFormField()); |
| 838 } | 838 } |
| 839 | 839 |
| 840 m_bNotifying = FALSE; | 840 m_bNotifying = false; |
| 841 } | 841 } |
| 842 } | 842 } |
| 843 | 843 |
| 844 FX_BOOL CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Anno
t* pAnnot) | 844 bool CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Annot*
pAnnot) |
| 845 { | 845 { |
| 846 | 846 |
| 847 ASSERT(pPageView != NULL); | 847 ASSERT(pPageView != NULL); |
| 848 ASSERT(pAnnot != NULL); | 848 ASSERT(pAnnot != NULL); |
| 849 | 849 |
| 850 if(pPageView) | 850 if(pPageView) |
| 851 return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot()); | 851 return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot()); |
| 852 else | 852 else |
| 853 return FALSE; | 853 return false; |
| 854 } | 854 } |
| 855 | 855 |
| 856 void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData
, int32_t nKeyCode, | 856 void CFFL_IFormFiller::OnBeforeKeyStroke(bool bEditOrList, void* pPrivateData, i
nt32_t nKeyCode, |
| 857 CFX_WideString & strChange, const
CFX_WideString& strChangeEx, | 857 CFX_WideString & strChange, const
CFX_WideString& strChangeEx, |
| 858 int nSelStart, int nSelEnd, | 858 int nSelStart, int nSelEnd, |
| 859 FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL
& bExit, FX_DWORD nFlag) | 859 bool bKeyDown, bool & bRC, bool & bExit,
FX_DWORD nFlag) |
| 860 { | 860 { |
| 861 ASSERT(pPrivateData != NULL); | 861 ASSERT(pPrivateData != NULL); |
| 862 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 862 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
| 863 ASSERT(pData->pWidget != NULL); | 863 ASSERT(pData->pWidget != NULL); |
| 864 | 864 |
| 865 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); | 865 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, false); |
| 866 ASSERT(pFormFiller != NULL); | 866 ASSERT(pFormFiller != NULL); |
| 867 | 867 |
| 868 if (!m_bNotifying) | 868 if (!m_bNotifying) |
| 869 { | 869 { |
| 870 if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) | 870 if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) |
| 871 { | 871 { |
| 872 m_bNotifying = TRUE; | 872 m_bNotifying = true; |
| 873 int nAge = pData->pWidget->GetAppearanceAge(); | 873 int nAge = pData->pWidget->GetAppearanceAge(); |
| 874 int nValueAge = pData->pWidget->GetValueAge(); | 874 int nValueAge = pData->pWidget->GetValueAge(); |
| 875 | 875 |
| 876 ASSERT(pData->pPageView != NULL); | 876 ASSERT(pData->pPageView != NULL); |
| 877 CPDFSDK_Document* pDocument = pData->pPageView->GetSDKDocument(); | 877 CPDFSDK_Document* pDocument = pData->pPageView->GetSDKDocument(); |
| 878 | 878 |
| 879 PDFSDK_FieldAction fa; | 879 PDFSDK_FieldAction fa; |
| 880 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 880 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 881 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 881 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 882 fa.sChange = strChange; | 882 fa.sChange = strChange; |
| 883 fa.sChangeEx = strChangeEx; | 883 fa.sChangeEx = strChangeEx; |
| 884 fa.bKeyDown = bKeyDown; | 884 fa.bKeyDown = bKeyDown; |
| 885 fa.bWillCommit = FALSE; | 885 fa.bWillCommit = false; |
| 886 fa.bRC = TRUE; | 886 fa.bRC = true; |
| 887 fa.nSelStart = nSelStart; | 887 fa.nSelStart = nSelStart; |
| 888 fa.nSelEnd = nSelEnd; | 888 fa.nSelEnd = nSelEnd; |
| 889 | 889 |
| 890 | 890 |
| 891 pFormFiller->GetActionData(pData->pPageView, CPDF_AAction::KeyStroke
, fa); | 891 pFormFiller->GetActionData(pData->pPageView, CPDF_AAction::KeyStroke
, fa); |
| 892 pFormFiller->SaveState(pData->pPageView); | 892 pFormFiller->SaveState(pData->pPageView); |
| 893 | 893 |
| 894 if (pData->pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pData->pP
ageView)) | 894 if (pData->pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pData->pP
ageView)) |
| 895 { | 895 { |
| 896 if (!IsValidAnnot(pData->pPageView, pData->pWidget)) | 896 if (!IsValidAnnot(pData->pPageView, pData->pWidget)) |
| 897 { | 897 { |
| 898 bExit = TRUE; | 898 bExit = true; |
| 899 m_bNotifying = FALSE; | 899 m_bNotifying = false; |
| 900 return; | 900 return; |
| 901 } | 901 } |
| 902 | 902 |
| 903 if (nAge != pData->pWidget->GetAppearanceAge()) | 903 if (nAge != pData->pWidget->GetAppearanceAge()) |
| 904 { | 904 { |
| 905 CPWL_Wnd* pWnd = pFormFiller->ResetPDFWindow(pData->pPageVie
w, nValueAge == pData->pWidget->GetValueAge()); | 905 CPWL_Wnd* pWnd = pFormFiller->ResetPDFWindow(pData->pPageVie
w, nValueAge == pData->pWidget->GetValueAge()); |
| 906 pData = (CFFL_PrivateData*)pWnd->GetAttachedData(); | 906 pData = (CFFL_PrivateData*)pWnd->GetAttachedData(); |
| 907 bExit = TRUE; | 907 bExit = true; |
| 908 } | 908 } |
| 909 | 909 |
| 910 if (fa.bRC) | 910 if (fa.bRC) |
| 911 { | 911 { |
| 912 pFormFiller->SetActionData(pData->pPageView, CPDF_AAction::K
eyStroke, fa); | 912 pFormFiller->SetActionData(pData->pPageView, CPDF_AAction::K
eyStroke, fa); |
| 913 bRC = FALSE; | 913 bRC = false; |
| 914 } | 914 } |
| 915 else | 915 else |
| 916 { | 916 { |
| 917 pFormFiller->RestoreState(pData->pPageView); | 917 pFormFiller->RestoreState(pData->pPageView); |
| 918 bRC = FALSE; | 918 bRC = false; |
| 919 } | 919 } |
| 920 | 920 |
| 921 if (pDocument->GetFocusAnnot() != pData->pWidget) | 921 if (pDocument->GetFocusAnnot() != pData->pWidget) |
| 922 { | 922 { |
| 923 pFormFiller->CommitData(pData->pPageView,nFlag); | 923 pFormFiller->CommitData(pData->pPageView,nFlag); |
| 924 bExit = TRUE; | 924 bExit = true; |
| 925 } | 925 } |
| 926 } | 926 } |
| 927 else | 927 else |
| 928 { | 928 { |
| 929 if (!IsValidAnnot(pData->pPageView, pData->pWidget)) | 929 if (!IsValidAnnot(pData->pPageView, pData->pWidget)) |
| 930 { | 930 { |
| 931 bExit = TRUE; | 931 bExit = true; |
| 932 m_bNotifying = FALSE; | 932 m_bNotifying = false; |
| 933 return; | 933 return; |
| 934 } | 934 } |
| 935 } | 935 } |
| 936 | 936 |
| 937 m_bNotifying = FALSE; | 937 m_bNotifying = false; |
| 938 } | 938 } |
| 939 } | 939 } |
| 940 } | 940 } |
| 941 | 941 |
| 942 void CFFL_IFormFiller::OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateDa
ta, FX_BOOL & bExit,FX_DWORD nFlag) | 942 void CFFL_IFormFiller::OnAfterKeyStroke(bool bEditOrList, void* pPrivateData,
bool & bExit,FX_DWORD nFlag) |
| 943 { | 943 { |
| 944 ASSERT(pPrivateData != NULL); | 944 ASSERT(pPrivateData != NULL); |
| 945 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 945 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
| 946 ASSERT(pData->pWidget != NULL); | 946 ASSERT(pData->pWidget != NULL); |
| 947 | 947 |
| 948 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); | 948 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, false); |
| 949 ASSERT(pFormFiller != NULL); | 949 ASSERT(pFormFiller != NULL); |
| 950 | 950 |
| 951 if (!bEditOrList) | 951 if (!bEditOrList) |
| 952 pFormFiller->OnKeyStroke(bExit); | 952 pFormFiller->OnKeyStroke(bExit); |
| 953 } | 953 } |
| OLD | NEW |