| 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 FX_BOOL CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView,CPDFSDK_Anno
t* 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 » { | 47 return pFormFiller->GetViewBBox(pPageView, pAnnot); |
| 48 » » return pFormFiller->GetViewBBox(pPageView, pAnnot); | 48 |
| 49 » } | 49 ASSERT(pPageView != NULL); |
| 50 » else | 50 |
| 51 » { | 51 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); |
| 52 » » ASSERT(pPageView != NULL); | 52 CPDF_Rect rcAnnot; |
| 53 » » ASSERT(pAnnot != NULL); | 53 pPDFAnnot->GetRect(rcAnnot); |
| 54 | 54 |
| 55 » » CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); | 55 CPDF_Rect rcWin = CPWL_Utils::InflateRect(rcAnnot, 1); |
| 56 » » ASSERT(pPDFAnnot != NULL); | 56 return rcWin.GetOutterRect(); |
| 57 | |
| 58 » » CPDF_Rect rcAnnot; | |
| 59 » » pPDFAnnot->GetRect(rcAnnot); | |
| 60 | |
| 61 // » » CRect rcWin; | |
| 62 // » » pPageView->DocToWindow(rcAnnot, rcWin); | |
| 63 » » CPDF_Rect rcWin = CPWL_Utils::InflateRect(rcAnnot,1); | |
| 64 //» » rcWin.InflateRect(1, 1); | |
| 65 | |
| 66 » » return rcWin.GetOutterRect(); | |
| 67 » } | |
| 68 } | 57 } |
| 69 | 58 |
| 70 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, |
| 71 » » » » » » CFX_RenderDevice* pDevice, CPDF_
Matrix* pUser2Device, | 60 CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, |
| 72 » » » » » » /*const CRect& rcWindow,*/ FX_DW
ORD dwFlags) | 61 /*const CRect& rcWindow,*/ FX_DWORD dwFlags) |
| 73 { | 62 { |
| 74 » ASSERT(pPageView != NULL); | 63 ASSERT(pPageView != NULL); |
| 75 » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 64 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 76 | 65 |
| 77 » if (IsVisible(pWidget)) | 66 if (IsVisible(pWidget)) |
| 78 » { | 67 { |
| 79 » » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 68 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 80 » » { | 69 { |
| 81 » » » if (pFormFiller->IsValid()) | 70 if (pFormFiller->IsValid()) |
| 82 » » » { | 71 { |
| 83 » » » » pFormFiller->OnDraw(pPageView, pAnnot, pDevice,
pUser2Device, dwFlags); | 72 pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dw
Flags); |
| 84 » » » » pAnnot->GetPDFPage(); | 73 pAnnot->GetPDFPage(); |
| 85 | 74 |
| 86 » » » » CPDFSDK_Document* pDocument = m_pApp->GetSDKDocu
ment(); | 75 CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); |
| 87 » » » » if (pDocument->GetFocusAnnot() == pAnnot) | 76 if (pDocument->GetFocusAnnot() == pAnnot) |
| 88 » » » » { | 77 { |
| 89 » » » » » CPDF_Rect rcFocus = pFormFiller->GetFocu
sBox(pPageView); | 78 CPDF_Rect rcFocus = pFormFiller->GetFocusBox(pPageView); |
| 90 » » » » » if (!rcFocus.IsEmpty()) | 79 if (!rcFocus.IsEmpty()) |
| 91 » » » » » { | 80 { |
| 92 » » » » » » CFX_PathData path; | 81 CFX_PathData path; |
| 93 » » » » » » path.SetPointCount(5); | 82 path.SetPointCount(5); |
| 94 » » » » » » path.SetPoint(0, rcFocus.left,
rcFocus.top, FXPT_MOVETO); | 83 path.SetPoint(0, rcFocus.left, rcFocus.top, FXPT_MOVETO
); |
| 95 » » » » » » path.SetPoint(1, rcFocus.left,
rcFocus.bottom, FXPT_LINETO); | 84 path.SetPoint(1, rcFocus.left, rcFocus.bottom, FXPT_LIN
ETO); |
| 96 » » » » » » path.SetPoint(2, rcFocus.right,
rcFocus.bottom, FXPT_LINETO); | 85 path.SetPoint(2, rcFocus.right, rcFocus.bottom, FXPT_LI
NETO); |
| 97 » » » » » » path.SetPoint(3, rcFocus.right,
rcFocus.top, FXPT_LINETO); | 86 path.SetPoint(3, rcFocus.right, rcFocus.top, FXPT_LINET
O); |
| 98 » » » » » » path.SetPoint(4, rcFocus.left,
rcFocus.top, FXPT_LINETO); | 87 path.SetPoint(4, rcFocus.left, rcFocus.top, FXPT_LINETO
); |
| 99 | 88 |
| 100 » » » » » » CFX_GraphStateData gsd; | 89 CFX_GraphStateData gsd; |
| 101 » » » » » » gsd.SetDashCount(1); | 90 gsd.SetDashCount(1); |
| 102 » » » » » » gsd.m_DashArray[0] = 1.0f; | 91 gsd.m_DashArray[0] = 1.0f; |
| 103 » » » » » » gsd.m_DashPhase = 0; | 92 gsd.m_DashPhase = 0; |
| 104 » » » » » » gsd.m_LineWidth = 1.0f; | 93 gsd.m_LineWidth = 1.0f; |
| 105 » » » » » » pDevice->DrawPath(&path, pUser2D
evice, &gsd, 0, ArgbEncode(255,0,0,0), FXFILL_ALTERNATE); | 94 pDevice->DrawPath(&path, pUser2Device, &gsd, 0, ArgbEnco
de(255,0,0,0), FXFILL_ALTERNATE); |
| 106 » » » » » } | 95 } |
| 107 » » » » } | 96 } |
| 108 » » » » return; | 97 return; |
| 109 » » » } | 98 } |
| 110 » » } | 99 } |
| 111 | 100 |
| 112 » » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 101 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 113 » » » pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice,
pUser2Device, dwFlags); | 102 pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device
, dwFlags); |
| 114 » » else | 103 else |
| 115 » » » pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Anno
t::Normal, NULL); | 104 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, N
ULL); |
| 116 | 105 |
| 117 » » if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget)) | 106 if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget)) |
| 118 » » » pWidget->DrawShadow(pDevice, pPageView); | 107 pWidget->DrawShadow(pDevice, pPageView); |
| 119 » } | 108 } |
| 120 } | 109 } |
| 121 | 110 |
| 122 void CFFL_IFormFiller::OnCreate(CPDFSDK_Annot* pAnnot) | 111 void CFFL_IFormFiller::OnCreate(CPDFSDK_Annot* pAnnot) |
| 123 { | 112 { |
| 124 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 113 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 125 » { | 114 { |
| 126 » » pFormFiller->OnCreate(pAnnot); | 115 pFormFiller->OnCreate(pAnnot); |
| 127 » } | 116 } |
| 128 } | 117 } |
| 129 | 118 |
| 130 void CFFL_IFormFiller::OnLoad(CPDFSDK_Annot* pAnnot) | 119 void CFFL_IFormFiller::OnLoad(CPDFSDK_Annot* pAnnot) |
| 131 { | 120 { |
| 132 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 121 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 133 » { | 122 { |
| 134 » » pFormFiller->OnLoad(pAnnot); | 123 pFormFiller->OnLoad(pAnnot); |
| 135 » } | 124 } |
| 136 } | 125 } |
| 137 | 126 |
| 138 void CFFL_IFormFiller::OnDelete(CPDFSDK_Annot* pAnnot) | 127 void CFFL_IFormFiller::OnDelete(CPDFSDK_Annot* pAnnot) |
| 139 { | 128 { |
| 140 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 129 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 141 » { | 130 { |
| 142 » » pFormFiller->OnDelete(pAnnot); | 131 pFormFiller->OnDelete(pAnnot); |
| 143 » } | 132 } |
| 144 | 133 |
| 145 » UnRegisterFormFiller(pAnnot); | 134 UnRegisterFormFiller(pAnnot); |
| 146 } | 135 } |
| 147 | 136 |
| 148 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) |
| 149 { | 138 { |
| 150 » ASSERT(pAnnot != NULL); | 139 ASSERT(pAnnot != NULL); |
| 151 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 140 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 152 | 141 |
| 153 » if (!m_bNotifying) | 142 if (!m_bNotifying) |
| 154 » { | 143 { |
| 155 » » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 144 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 156 » » if (pWidget->GetAAction(CPDF_AAction::CursorEnter)) | 145 if (pWidget->GetAAction(CPDF_AAction::CursorEnter)) |
| 157 » » { | 146 { |
| 158 » » » m_bNotifying = TRUE; | 147 m_bNotifying = TRUE; |
| 159 | 148 |
| 160 » » » int nValueAge = pWidget->GetValueAge(); | 149 int nValueAge = pWidget->GetValueAge(); |
| 161 | 150 |
| 162 » » » pWidget->ClearAppModified(); | 151 pWidget->ClearAppModified(); |
| 163 | 152 |
| 164 » » » ASSERT(pPageView != NULL); | 153 ASSERT(pPageView != NULL); |
| 165 | 154 |
| 166 | 155 |
| 167 | 156 |
| 168 » » » PDFSDK_FieldAction fa; | 157 PDFSDK_FieldAction fa; |
| 169 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 158 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 170 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 159 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 171 » » » pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageV
iew ); | 160 pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView ); |
| 172 » » » m_bNotifying = FALSE; | 161 m_bNotifying = FALSE; |
| 173 | 162 |
| 174 » » » //if ( !IsValidAnnot(pPageView, pAnnot) ) return; | 163 //if ( !IsValidAnnot(pPageView, pAnnot) ) return; |
| 175 | 164 |
| 176 » » » if (pWidget->IsAppModified()) | 165 if (pWidget->IsAppModified()) |
| 177 » » » { | 166 { |
| 178 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller
(pWidget, FALSE)) | 167 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)
) |
| 179 » » » » { | 168 { |
| 180 » » » » » pFormFiller->ResetPDFWindow(pPageView, p
Widget->GetValueAge() == nValueAge); | 169 pFormFiller->ResetPDFWindow(pPageView, pWidget->GetValueAge(
) == nValueAge); |
| 181 » » » » } | 170 } |
| 182 » » » } | 171 } |
| 183 » » } | 172 } |
| 184 » } | 173 } |
| 185 | 174 |
| 186 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) | 175 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) |
| 187 » { | 176 { |
| 188 » » pFormFiller->OnMouseEnter(pPageView, pAnnot); | 177 pFormFiller->OnMouseEnter(pPageView, pAnnot); |
| 189 » } | 178 } |
| 190 } | 179 } |
| 191 | 180 |
| 192 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) |
| 193 { | 182 { |
| 194 » ASSERT(pAnnot != NULL); | 183 ASSERT(pAnnot != NULL); |
| 195 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 184 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 196 | 185 |
| 197 » if (!m_bNotifying) | 186 if (!m_bNotifying) |
| 198 » { | 187 { |
| 199 » » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 188 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 200 » » if (pWidget->GetAAction(CPDF_AAction::CursorExit)) | 189 if (pWidget->GetAAction(CPDF_AAction::CursorExit)) |
| 201 » » { | 190 { |
| 202 » » » m_bNotifying = TRUE; | 191 m_bNotifying = TRUE; |
| 203 » » » pWidget->GetAppearanceAge(); | 192 pWidget->GetAppearanceAge(); |
| 204 » » » int nValueAge = pWidget->GetValueAge(); | 193 int nValueAge = pWidget->GetValueAge(); |
| 205 » » » pWidget->ClearAppModified(); | 194 pWidget->ClearAppModified(); |
| 206 | 195 |
| 207 » » » ASSERT(pPageView != NULL); | 196 ASSERT(pPageView != NULL); |
| 208 | 197 |
| 209 | 198 |
| 210 | 199 |
| 211 » » » PDFSDK_FieldAction fa; | 200 PDFSDK_FieldAction fa; |
| 212 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 201 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 213 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 202 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 214 | 203 |
| 215 » » » pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageVi
ew); | 204 pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView); |
| 216 » » » m_bNotifying = FALSE; | 205 m_bNotifying = FALSE; |
| 217 | 206 |
| 218 » » » //if (!IsValidAnnot(pPageView, pAnnot)) return; | 207 //if (!IsValidAnnot(pPageView, pAnnot)) return; |
| 219 | 208 |
| 220 » » » if (pWidget->IsAppModified()) | 209 if (pWidget->IsAppModified()) |
| 221 » » » { | 210 { |
| 222 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller
(pWidget, FALSE)) | 211 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)
) |
| 223 » » » » { | 212 { |
| 224 » » » » » pFormFiller->ResetPDFWindow(pPageView, n
ValueAge == pWidget->GetValueAge()); | 213 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget-
>GetValueAge()); |
| 225 » » » » } | 214 } |
| 226 » » » } | 215 } |
| 227 » » } | 216 } |
| 228 » } | 217 } |
| 229 | 218 |
| 230 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 219 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 231 » { | 220 { |
| 232 » » pFormFiller->OnMouseExit(pPageView, pAnnot); | 221 pFormFiller->OnMouseExit(pPageView, pAnnot); |
| 233 » } | 222 } |
| 234 } | 223 } |
| 235 | 224 |
| 236 FX_BOOL»CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann
ot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 225 FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann
ot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
| 237 { | 226 { |
| 238 » ASSERT(pAnnot != NULL); | 227 ASSERT(pAnnot != NULL); |
| 239 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 228 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 240 | 229 |
| 241 » if (!m_bNotifying) | 230 if (!m_bNotifying) |
| 242 » { | 231 { |
| 243 » » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 232 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 244 » » if (Annot_HitTest(pPageView, pAnnot, point) && pWidget->GetAActi
on(CPDF_AAction::ButtonDown)) | 233 if (Annot_HitTest(pPageView, pAnnot, point) && pWidget->GetAAction(CPDF_
AAction::ButtonDown)) |
| 245 » » { | 234 { |
| 246 » » » m_bNotifying = TRUE; | 235 m_bNotifying = TRUE; |
| 247 » » » pWidget->GetAppearanceAge(); | 236 pWidget->GetAppearanceAge(); |
| 248 » » » int nValueAge = pWidget->GetValueAge(); | 237 int nValueAge = pWidget->GetValueAge(); |
| 249 » » » pWidget->ClearAppModified(); | 238 pWidget->ClearAppModified(); |
| 250 | 239 |
| 251 » » » ASSERT(pPageView != NULL); | 240 ASSERT(pPageView != NULL); |
| 252 | 241 |
| 253 | 242 |
| 254 | 243 |
| 255 » » » PDFSDK_FieldAction fa; | 244 PDFSDK_FieldAction fa; |
| 256 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlags); | 245 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlags); |
| 257 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlags); | 246 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlags); |
| 258 » » » pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageVi
ew); | 247 pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageView); |
| 259 » » » m_bNotifying = FALSE; | 248 m_bNotifying = FALSE; |
| 260 | 249 |
| 261 » » » if (!IsValidAnnot(pPageView, pAnnot)) return TRUE; | 250 if (!IsValidAnnot(pPageView, pAnnot)) return TRUE; |
| 262 | 251 |
| 263 » » » if (pWidget->IsAppModified()) | 252 if (pWidget->IsAppModified()) |
| 264 » » » { | 253 { |
| 265 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller
(pWidget, FALSE)) | 254 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)
) |
| 266 » » » » { | 255 { |
| 267 » » » » » pFormFiller->ResetPDFWindow(pPageView, n
ValueAge == pWidget->GetValueAge()); | 256 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget-
>GetValueAge()); |
| 268 » » » » } | 257 } |
| 269 » » » } | 258 } |
| 270 » » } | 259 } |
| 271 » } | 260 } |
| 272 | 261 |
| 273 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 262 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 274 » { | 263 { |
| 275 » » return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, poi
nt); | 264 return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point); |
| 276 » } | 265 } |
| 277 | 266 |
| 278 » return FALSE; | 267 return FALSE; |
| 279 } | 268 } |
| 280 | 269 |
| 281 FX_BOOL»CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot
* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 270 FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot
* pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
| 282 { | 271 { |
| 283 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 272 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 284 » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 273 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 285 » CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); | 274 CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); |
| 286 | 275 |
| 287 » switch (pWidget->GetFieldType()) | 276 switch (pWidget->GetFieldType()) |
| 288 » { | 277 { |
| 289 » case FIELDTYPE_PUSHBUTTON: | 278 case FIELDTYPE_PUSHBUTTON: |
| 290 » case FIELDTYPE_CHECKBOX: | 279 case FIELDTYPE_CHECKBOX: |
| 291 » case FIELDTYPE_RADIOBUTTON: | 280 case FIELDTYPE_RADIOBUTTON: |
| 292 » » if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)p
oint.y)) | 281 if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)point.y)) |
| 293 » » » pDocument->SetFocusAnnot(pAnnot); | 282 pDocument->SetFocusAnnot(pAnnot); |
| 294 » » break; | 283 break; |
| 295 » default: | 284 default: |
| 296 » » pDocument->SetFocusAnnot(pAnnot); | 285 pDocument->SetFocusAnnot(pAnnot); |
| 297 » » break; | 286 break; |
| 298 » } | 287 } |
| 299 | 288 |
| 300 » FX_BOOL bRet = FALSE; | 289 FX_BOOL bRet = FALSE; |
| 301 | 290 |
| 302 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 291 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 303 » { | 292 { |
| 304 » » bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point
); | 293 bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); |
| 305 » } | 294 } |
| 306 | 295 |
| 307 » if (pDocument->GetFocusAnnot() == pAnnot) | 296 if (pDocument->GetFocusAnnot() == pAnnot) |
| 308 » { | 297 { |
| 309 » » FX_BOOL bExit = FALSE; | 298 FX_BOOL bExit = FALSE; |
| 310 » » FX_BOOL bReset = FALSE; | 299 FX_BOOL bReset = FALSE; |
| 311 » » OnButtonUp(pWidget, pPageView, bReset, bExit,nFlags); | 300 OnButtonUp(pWidget, pPageView, bReset, bExit,nFlags); |
| 312 » » if (bExit) return TRUE; | 301 if (bExit) return TRUE; |
| 313 » } | 302 } |
| 314 » return bRet; | 303 return bRet; |
| 315 } | 304 } |
| 316 | 305 |
| 317 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, FX_BOOL& bReset, FX_BOOL& bExit,FX_UINT nFlag) |
| 318 { | 307 { |
| 319 » ASSERT(pWidget != NULL); | 308 ASSERT(pWidget != NULL); |
| 320 | 309 |
| 321 » if (!m_bNotifying) | 310 if (!m_bNotifying) |
| 322 » { | 311 { |
| 323 » » if (pWidget->GetAAction(CPDF_AAction::ButtonUp)) | 312 if (pWidget->GetAAction(CPDF_AAction::ButtonUp)) |
| 324 » » { | 313 { |
| 325 » » » m_bNotifying = TRUE; | 314 m_bNotifying = TRUE; |
| 326 » » » int nAge = pWidget->GetAppearanceAge(); | 315 int nAge = pWidget->GetAppearanceAge(); |
| 327 » » » int nValueAge = pWidget->GetValueAge(); | 316 int nValueAge = pWidget->GetValueAge(); |
| 328 | 317 |
| 329 » » » ASSERT(pPageView != NULL); | 318 ASSERT(pPageView != NULL); |
| 330 // » » » CReader_DocView* pDocView = pPageView->GetDocView(); | 319 // CReader_DocView* pDocView = pPageView->GetDocView(); |
| 331 // » » » ASSERT(pDocView != NULL); | 320 // ASSERT(pDocView != NULL); |
| 332 | 321 |
| 333 | 322 |
| 334 | 323 |
| 335 » » » PDFSDK_FieldAction fa; | 324 PDFSDK_FieldAction fa; |
| 336 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 325 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 337 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 326 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 338 | 327 |
| 339 » » » pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView
); | 328 pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView); |
| 340 » » » m_bNotifying = FALSE; | 329 m_bNotifying = FALSE; |
| 341 | 330 |
| 342 » » » if (!IsValidAnnot(pPageView, pWidget)) | 331 if (!IsValidAnnot(pPageView, pWidget)) |
| 343 » » » { | 332 { |
| 344 » » » » bExit = TRUE; | 333 bExit = TRUE; |
| 345 » » » » return; | 334 return; |
| 346 » » » } | 335 } |
| 347 | 336 |
| 348 » » » if (nAge != pWidget->GetAppearanceAge()) | 337 if (nAge != pWidget->GetAppearanceAge()) |
| 349 » » » { | 338 { |
| 350 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller
(pWidget, FALSE)) | 339 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)
) |
| 351 » » » » { | 340 { |
| 352 » » » » » pFormFiller->ResetPDFWindow(pPageView, n
ValueAge == pWidget->GetValueAge()); | 341 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget-
>GetValueAge()); |
| 353 » » » » } | 342 } |
| 354 | 343 |
| 355 » » » » bReset = TRUE; | 344 bReset = TRUE; |
| 356 » » » } | 345 } |
| 357 » » } | 346 } |
| 358 » } | 347 } |
| 359 } | 348 } |
| 360 | 349 |
| 361 FX_BOOL»CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_A
nnot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 350 FX_BOOL CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_A
nnot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
| 362 { | 351 { |
| 363 » ASSERT(pAnnot != NULL); | 352 ASSERT(pAnnot != NULL); |
| 364 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 353 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 365 | 354 |
| 366 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 355 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 367 » { | 356 { |
| 368 » » return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, p
oint); | 357 return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); |
| 369 » } | 358 } |
| 370 | 359 |
| 371 » return FALSE; | 360 return FALSE; |
| 372 } | 361 } |
| 373 | 362 |
| 374 FX_BOOL»CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot
* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 363 FX_BOOL CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot
* pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
| 375 { | 364 { |
| 376 » ASSERT(pAnnot != NULL); | 365 ASSERT(pAnnot != NULL); |
| 377 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 366 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 378 | 367 |
| 379 » //change cursor | 368 //change cursor |
| 380 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) | 369 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) |
| 381 » { | 370 { |
| 382 » » return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point
); | 371 return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); |
| 383 » } | 372 } |
| 384 | 373 |
| 385 » return FALSE; | 374 return FALSE; |
| 386 } | 375 } |
| 387 | 376 |
| 388 FX_BOOL»CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Anno
t* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point) | 377 FX_BOOL CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Anno
t* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point) |
| 389 { | 378 { |
| 390 » ASSERT(pAnnot != NULL); | 379 ASSERT(pAnnot != NULL); |
| 391 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 380 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 392 | 381 |
| 393 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 382 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 394 » { | 383 { |
| 395 » » return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDel
ta, point); | 384 return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, poin
t); |
| 396 » } | 385 } |
| 397 | 386 |
| 398 » return FALSE; | 387 return FALSE; |
| 399 } | 388 } |
| 400 | 389 |
| 401 FX_BOOL»CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann
ot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 390 FX_BOOL CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann
ot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
| 402 { | 391 { |
| 403 » ASSERT(pAnnot != NULL); | 392 ASSERT(pAnnot != NULL); |
| 404 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 393 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 405 | 394 |
| 406 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 395 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 407 » { | 396 { |
| 408 » » return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, poi
nt); | 397 return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); |
| 409 » } | 398 } |
| 410 | 399 |
| 411 » return FALSE; | 400 return FALSE; |
| 412 } | 401 } |
| 413 | 402 |
| 414 FX_BOOL»CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot
* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 403 FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot
* pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
| 415 { | 404 { |
| 416 » ASSERT(pAnnot != NULL); | 405 ASSERT(pAnnot != NULL); |
| 417 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 406 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 418 | 407 |
| 419 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 408 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 420 » { | 409 { |
| 421 » » return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point
); | 410 return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); |
| 422 » } | 411 } |
| 423 | 412 |
| 424 » return FALSE; | 413 return FALSE; |
| 425 } | 414 } |
| 426 | 415 |
| 427 FX_BOOL»CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_
UINT nFlags) | 416 FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_
UINT nFlags) |
| 428 { | 417 { |
| 429 » ASSERT(pAnnot != NULL); | 418 ASSERT(pAnnot != NULL); |
| 430 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 419 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 431 | 420 |
| 432 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 421 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 433 » { | 422 { |
| 434 » » return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); | 423 return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); |
| 435 » } | 424 } |
| 436 | 425 |
| 437 » return FALSE; | 426 return FALSE; |
| 438 } | 427 } |
| 439 | 428 |
| 440 FX_BOOL»CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT n
Flags) | 429 FX_BOOL CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT n
Flags) |
| 441 { | 430 { |
| 442 » ASSERT(pAnnot != NULL); | 431 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 443 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 432 if (nChar == FWL_VKEY_Tab) |
| 444 | 433 return TRUE; |
| 445 » if (nChar == FWL_VKEY_Tab) return TRUE; | 434 |
| 446 | 435 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 447 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 436 return pFormFiller->OnChar(pAnnot, nChar, nFlags); |
| 448 » { | 437 |
| 449 » » return pFormFiller->OnChar(pAnnot, nChar, nFlags); | 438 return FALSE; |
| 450 » } | |
| 451 | |
| 452 » return FALSE; | |
| 453 } | 439 } |
| 454 | 440 |
| 455 FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) | 441 FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) |
| 456 { | 442 { |
| 457 » if(!pAnnot) return FALSE; | 443 if (!pAnnot) |
| 458 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 444 return FALSE; |
| 459 | 445 |
| 460 » if (!m_bNotifying) | 446 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 461 » { | 447 |
| 462 » » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 448 if (!m_bNotifying) |
| 463 » » if (pWidget->GetAAction(CPDF_AAction::GetFocus)) | 449 { |
| 464 » » { | 450 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 465 » » » m_bNotifying = TRUE; | 451 if (pWidget->GetAAction(CPDF_AAction::GetFocus)) |
| 466 » » » pWidget->GetAppearanceAge(); | 452 { |
| 467 » » » int nValueAge = pWidget->GetValueAge(); | 453 m_bNotifying = TRUE; |
| 468 » » » pWidget->ClearAppModified(); | 454 pWidget->GetAppearanceAge(); |
| 469 | 455 |
| 470 | 456 int nValueAge = pWidget->GetValueAge(); |
| 471 » » » CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); | 457 pWidget->ClearAppModified(); |
| 472 » » » ASSERT(pPageView != NULL); | 458 |
| 473 | 459 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); |
| 474 » » » PDFSDK_FieldAction fa; | 460 ASSERT(pPageView != NULL); |
| 475 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 461 |
| 476 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 462 PDFSDK_FieldAction fa; |
| 477 | 463 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 478 | 464 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 479 » » » CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TR
UE); | 465 |
| 480 » » » if(!pFormFiller) return FALSE; | 466 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TRUE); |
| 481 » » » pFormFiller->GetActionData(pPageView, CPDF_AAction::GetF
ocus, fa); | 467 if(!pFormFiller) return FALSE; |
| 482 | 468 pFormFiller->GetActionData(pPageView, CPDF_AAction::GetFocus, fa); |
| 483 » » » pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView
); | 469 pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView); |
| 484 » » » m_bNotifying = FALSE; | 470 m_bNotifying = FALSE; |
| 485 | 471 |
| 486 //» » » if (!IsValidAnnot(m_pApp, pDocument, pDocView, pPageView
, pAnnot)) return FALSE; | 472 if (pWidget->IsAppModified()) |
| 487 | 473 { |
| 488 » » » if (pWidget->IsAppModified()) | 474 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)
) |
| 489 » » » { | 475 { |
| 490 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller
(pWidget, FALSE)) | 476 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget-
>GetValueAge()); |
| 491 » » » » { | 477 } |
| 492 » » » » » pFormFiller->ResetPDFWindow(pPageView, n
ValueAge == pWidget->GetValueAge()); | 478 } |
| 493 » » » » } | 479 } |
| 494 » » » } | 480 } |
| 495 » » } | 481 |
| 496 » } | 482 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) |
| 497 | 483 return pFormFiller->OnSetFocus(pAnnot, nFlag); |
| 498 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) | 484 |
| 499 » { | 485 return TRUE; |
| 500 » » if (pFormFiller->OnSetFocus(pAnnot, nFlag)) | 486 } |
| 501 » » { | 487 |
| 502 » » » return TRUE; | 488 FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) |
| 503 » » } | 489 { |
| 504 » » else | 490 if(!pAnnot) return FALSE; |
| 505 » » » return FALSE; | 491 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 506 » } | 492 |
| 507 | 493 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 508 » return TRUE; | 494 { |
| 509 } | 495 if (pFormFiller->OnKillFocus(pAnnot, nFlag)) |
| 510 | 496 { |
| 511 FX_BOOL»CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) | 497 if (!m_bNotifying) |
| 512 { | 498 { |
| 513 » if(!pAnnot) return FALSE; | 499 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 514 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 500 if (pWidget->GetAAction(CPDF_AAction::LoseFocus)) |
| 515 | 501 { |
| 516 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 502 m_bNotifying = TRUE; |
| 517 » { | 503 pWidget->ClearAppModified(); |
| 518 » » if (pFormFiller->OnKillFocus(pAnnot, nFlag)) | 504 |
| 519 » » { | 505 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); |
| 520 » » » if (!m_bNotifying) | 506 ASSERT(pPageView != NULL); |
| 521 » » » { | 507 |
| 522 » » » » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnno
t; | 508 PDFSDK_FieldAction fa; |
| 523 » » » » if (pWidget->GetAAction(CPDF_AAction::LoseFocus)
) | 509 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 524 » » » » { | 510 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 525 » » » » » m_bNotifying = TRUE; | 511 |
| 526 » » » » » pWidget->ClearAppModified(); | 512 pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocu
s, fa); |
| 527 | 513 |
| 528 » » » » » CPDFSDK_PageView* pPageView = pWidget->G
etPageView(); | 514 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); |
| 529 » » » » » ASSERT(pPageView != NULL); | 515 m_bNotifying = FALSE; |
| 530 | 516 |
| 531 » » » » » PDFSDK_FieldAction fa; | 517 } |
| 532 » » » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown
(nFlag); | 518 } |
| 533 » » » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(n
Flag); | 519 } |
| 534 | 520 else |
| 535 » » » » » pFormFiller->GetActionData(pPageView, CP
DF_AAction::LoseFocus, fa); | 521 return FALSE; |
| 536 | 522 } |
| 537 » » » » » pWidget->OnAAction(CPDF_AAction::LoseFoc
us, fa, pPageView); | 523 |
| 538 » » » » » m_bNotifying = FALSE; | 524 return TRUE; |
| 539 | 525 } |
| 540 » » » » } | 526 |
| 541 » » » } | 527 FX_BOOL CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) |
| 542 » » } | 528 { |
| 543 » » else | 529 return pWidget->IsVisible(); |
| 544 » » » return FALSE; | 530 } |
| 545 » } | 531 |
| 546 | 532 FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) |
| 547 » return TRUE; | 533 { |
| 548 } | 534 ASSERT(pWidget != NULL); |
| 549 | 535 |
| 550 FX_BOOL»CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) | 536 int nFieldFlags = pWidget->GetFieldFlags(); |
| 551 { | 537 |
| 552 » return pWidget->IsVisible(); | 538 return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY; |
| 553 } | 539 } |
| 554 | 540 |
| 555 FX_BOOL»CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) | 541 FX_BOOL CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) |
| 556 { | 542 { |
| 557 » ASSERT(pWidget != NULL); | 543 ASSERT(pWidget != NULL); |
| 558 | 544 |
| 559 » int nFieldFlags = pWidget->GetFieldFlags(); | 545 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) |
| 560 | 546 return TRUE; |
| 561 » return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY; | 547 else |
| 562 } | 548 { |
| 563 | 549 CPDF_Page* pPage = pWidget->GetPDFPage(); |
| 564 FX_BOOL»CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) | 550 ASSERT(pPage != NULL); |
| 565 { | 551 |
| 566 » ASSERT(pWidget != NULL); | 552 CPDF_Document* pDocument = pPage->m_pDocument; |
| 567 | 553 ASSERT(pDocument != NULL); |
| 568 » if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) | 554 |
| 569 » » return TRUE; | 555 FX_DWORD dwPermissions = pDocument->GetUserPermissions(); |
| 570 » else | 556 return (dwPermissions&FPDFPERM_FILL_FORM) || |
| 571 » { | 557 (dwPermissions&FPDFPERM_ANNOT_FORM) || |
| 572 » » CPDF_Page* pPage = pWidget->GetPDFPage(); | 558 (dwPermissions&FPDFPERM_MODIFY); |
| 573 » » ASSERT(pPage != NULL); | 559 } |
| 574 | 560 return TRUE; |
| 575 » » CPDF_Document* pDocument = pPage->m_pDocument; | |
| 576 » » ASSERT(pDocument != NULL); | |
| 577 | |
| 578 » » FX_DWORD dwPermissions = pDocument->GetUserPermissions(); | |
| 579 » » return (dwPermissions&FPDFPERM_FILL_FORM) || | |
| 580 » » » » (dwPermissions&FPDFPERM_ANNOT_FORM) || | |
| 581 » » » (dwPermissions&FPDFPERM_MODIFY); | |
| 582 » } | |
| 583 » return TRUE; | |
| 584 } | 561 } |
| 585 | 562 |
| 586 CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL
bRegister) | 563 CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL
bRegister) |
| 587 { | 564 { |
| 588 auto it = m_Maps.find(pAnnot); | 565 auto it = m_Maps.find(pAnnot); |
| 589 if (it != m_Maps.end()) | 566 if (it != m_Maps.end()) |
| 590 return it->second; | 567 return it->second; |
| 591 | 568 |
| 592 if (!bRegister) | 569 if (!bRegister) |
| 593 return nullptr; | 570 return nullptr; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 622 | 599 |
| 623 if (!pFormFiller) | 600 if (!pFormFiller) |
| 624 return nullptr; | 601 return nullptr; |
| 625 | 602 |
| 626 m_Maps[pAnnot] = pFormFiller; | 603 m_Maps[pAnnot] = pFormFiller; |
| 627 return pFormFiller; | 604 return pFormFiller; |
| 628 } | 605 } |
| 629 | 606 |
| 630 void CFFL_IFormFiller::RemoveFormFiller(CPDFSDK_Annot* pAnnot) | 607 void CFFL_IFormFiller::RemoveFormFiller(CPDFSDK_Annot* pAnnot) |
| 631 { | 608 { |
| 632 » if ( pAnnot != NULL ) | 609 if ( pAnnot != NULL ) |
| 633 » { | 610 { |
| 634 » » UnRegisterFormFiller( pAnnot ); | 611 UnRegisterFormFiller( pAnnot ); |
| 635 » } | 612 } |
| 636 } | 613 } |
| 637 | 614 |
| 638 void CFFL_IFormFiller::UnRegisterFormFiller(CPDFSDK_Annot* pAnnot) | 615 void CFFL_IFormFiller::UnRegisterFormFiller(CPDFSDK_Annot* pAnnot) |
| 639 { | 616 { |
| 640 auto it = m_Maps.find(pAnnot); | 617 auto it = m_Maps.find(pAnnot); |
| 641 if (it == m_Maps.end()) | 618 if (it == m_Maps.end()) |
| 642 return; | 619 return; |
| 643 | 620 |
| 644 delete it->second; | 621 delete it->second; |
| 645 m_Maps.erase(it); | 622 m_Maps.erase(it); |
| 646 } | 623 } |
| 647 | 624 |
| 648 void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX
_FLOAT fPopupMax, int32_t & nRet, FX_FLOAT & fPopupRet) | 625 void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX
_FLOAT fPopupMax, int32_t & nRet, FX_FLOAT & fPopupRet) |
| 649 { | 626 { |
| 650 » ASSERT(pPrivateData != NULL); | 627 ASSERT(pPrivateData != NULL); |
| 651 | 628 |
| 652 » CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 629 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
| 653 | 630 |
| 654 | 631 |
| 655 | 632 |
| 656 | 633 |
| 657 » CPDF_Rect rcPageView(0,0,0,0); | 634 CPDF_Rect rcPageView(0,0,0,0); |
| 658 » rcPageView.right = pData->pWidget->GetPDFPage()->GetPageWidth(); | 635 rcPageView.right = pData->pWidget->GetPDFPage()->GetPageWidth(); |
| 659 » rcPageView.bottom = pData->pWidget->GetPDFPage()->GetPageHeight(); | 636 rcPageView.bottom = pData->pWidget->GetPDFPage()->GetPageHeight(); |
| 660 » rcPageView.Normalize(); | 637 rcPageView.Normalize(); |
| 661 | 638 |
| 662 | 639 |
| 663 » ASSERT(pData->pWidget != NULL); | 640 ASSERT(pData->pWidget != NULL); |
| 664 » CPDF_Rect rcAnnot = pData->pWidget->GetRect(); | 641 CPDF_Rect rcAnnot = pData->pWidget->GetRect(); |
| 665 | 642 |
| 666 » FX_FLOAT fTop = 0.0f; | 643 FX_FLOAT fTop = 0.0f; |
| 667 » FX_FLOAT fBottom = 0.0f; | 644 FX_FLOAT fBottom = 0.0f; |
| 668 | 645 |
| 669 » CPDFSDK_Widget * pWidget = (CPDFSDK_Widget*)pData->pWidget; | 646 CPDFSDK_Widget * pWidget = (CPDFSDK_Widget*)pData->pWidget; |
| 670 » switch (pWidget->GetRotate() / 90) | 647 switch (pWidget->GetRotate() / 90) |
| 671 » { | 648 { |
| 672 » default: | 649 default: |
| 673 » case 0: | 650 case 0: |
| 674 » » fTop = rcPageView.top - rcAnnot.top; | 651 fTop = rcPageView.top - rcAnnot.top; |
| 675 » » fBottom = rcAnnot.bottom - rcPageView.bottom; | 652 fBottom = rcAnnot.bottom - rcPageView.bottom; |
| 676 » » break; | 653 break; |
| 677 » case 1: | 654 case 1: |
| 678 » » fTop = rcAnnot.left - rcPageView.left; | 655 fTop = rcAnnot.left - rcPageView.left; |
| 679 » » fBottom = rcPageView.right - rcAnnot.right; | 656 fBottom = rcPageView.right - rcAnnot.right; |
| 680 » » break; | 657 break; |
| 681 » case 2: | 658 case 2: |
| 682 » » fTop = rcAnnot.bottom - rcPageView.bottom; | 659 fTop = rcAnnot.bottom - rcPageView.bottom; |
| 683 » » fBottom = rcPageView.top - rcAnnot.top; | 660 fBottom = rcPageView.top - rcAnnot.top; |
| 684 » » break; | 661 break; |
| 685 » case 3: | 662 case 3: |
| 686 » » fTop = rcPageView.right - rcAnnot.right; | 663 fTop = rcPageView.right - rcAnnot.right; |
| 687 » » fBottom = rcAnnot.left - rcPageView.left; | 664 fBottom = rcAnnot.left - rcPageView.left; |
| 688 » » break; | 665 break; |
| 689 » } | 666 } |
| 690 | 667 |
| 691 » FX_FLOAT fFactHeight = 0; | 668 FX_FLOAT fFactHeight = 0; |
| 692 » FX_BOOL bBottom = TRUE; | 669 FX_BOOL bBottom = TRUE; |
| 693 » FX_FLOAT fMaxListBoxHeight = 0; | 670 FX_FLOAT fMaxListBoxHeight = 0; |
| 694 » if (fPopupMax > FFL_MAXLISTBOXHEIGHT) | 671 if (fPopupMax > FFL_MAXLISTBOXHEIGHT) |
| 695 » { | 672 { |
| 696 » » if (fPopupMin > FFL_MAXLISTBOXHEIGHT) | 673 if (fPopupMin > FFL_MAXLISTBOXHEIGHT) |
| 697 » » { | 674 { |
| 698 » » » fMaxListBoxHeight = fPopupMin; | 675 fMaxListBoxHeight = fPopupMin; |
| 699 » » } | 676 } |
| 700 » » else | 677 else |
| 701 » » { | 678 { |
| 702 » » » fMaxListBoxHeight = FFL_MAXLISTBOXHEIGHT; | 679 fMaxListBoxHeight = FFL_MAXLISTBOXHEIGHT; |
| 703 » » } | 680 } |
| 704 » } | 681 } |
| 705 » else | 682 else |
| 706 » » fMaxListBoxHeight = fPopupMax; | 683 fMaxListBoxHeight = fPopupMax; |
| 707 | 684 |
| 708 » if (fBottom > fMaxListBoxHeight) | 685 if (fBottom > fMaxListBoxHeight) |
| 709 » { | 686 { |
| 710 » » fFactHeight = fMaxListBoxHeight; | 687 fFactHeight = fMaxListBoxHeight; |
| 711 » » bBottom = TRUE; | 688 bBottom = TRUE; |
| 712 » } | 689 } |
| 713 » else | 690 else |
| 714 » { | 691 { |
| 715 » » if (fTop > fMaxListBoxHeight) | 692 if (fTop > fMaxListBoxHeight) |
| 716 » » { | 693 { |
| 717 » » » fFactHeight = fMaxListBoxHeight; | 694 fFactHeight = fMaxListBoxHeight; |
| 718 » » » bBottom = FALSE; | 695 bBottom = FALSE; |
| 719 » » } | 696 } |
| 720 » » else | 697 else |
| 721 » » { | 698 { |
| 722 » » » if (fTop > fBottom) | 699 if (fTop > fBottom) |
| 723 » » » { | 700 { |
| 724 » » » » fFactHeight = fTop; | 701 fFactHeight = fTop; |
| 725 » » » » bBottom = FALSE; | 702 bBottom = FALSE; |
| 726 » » » } | 703 } |
| 727 » » » else | 704 else |
| 728 » » » { | 705 { |
| 729 » » » » fFactHeight = fBottom; | 706 fFactHeight = fBottom; |
| 730 » » » » bBottom = TRUE; | 707 bBottom = TRUE; |
| 731 » » » } | 708 } |
| 732 » » } | 709 } |
| 733 » } | 710 } |
| 734 | 711 |
| 735 » nRet = bBottom ? 0 : 1; | 712 nRet = bBottom ? 0 : 1; |
| 736 » fPopupRet = fFactHeight; | 713 fPopupRet = fFactHeight; |
| 737 } | 714 } |
| 738 | 715 |
| 739 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, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag) |
| 740 { | 717 { |
| 741 » if (!m_bNotifying) | 718 if (!m_bNotifying) |
| 742 » { | 719 { |
| 743 » » ASSERT(pWidget != NULL); | 720 ASSERT(pWidget != NULL); |
| 744 » » if (pWidget->GetAAction(CPDF_AAction::KeyStroke)) | 721 if (pWidget->GetAAction(CPDF_AAction::KeyStroke)) |
| 745 » » { | 722 { |
| 746 » » » m_bNotifying = TRUE; | 723 m_bNotifying = TRUE; |
| 747 » » » pWidget->ClearAppModified(); | 724 pWidget->ClearAppModified(); |
| 748 | 725 |
| 749 » » » ASSERT(pPageView != NULL); | 726 ASSERT(pPageView != NULL); |
| 750 | 727 |
| 751 » » » PDFSDK_FieldAction fa; | 728 PDFSDK_FieldAction fa; |
| 752 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 729 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 753 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 730 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 754 » » » fa.bWillCommit = TRUE; | 731 fa.bWillCommit = TRUE; |
| 755 » » » fa.bKeyDown = TRUE; | 732 fa.bKeyDown = TRUE; |
| 756 » » » fa.bRC = TRUE; | 733 fa.bRC = TRUE; |
| 757 | 734 |
| 758 » » » CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FA
LSE); | 735 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); |
| 759 » » » ASSERT(pFormFiller != NULL); | 736 ASSERT(pFormFiller != NULL); |
| 760 | 737 |
| 761 » » » pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyS
troke, fa); | 738 pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa); |
| 762 » » » pFormFiller->SaveState(pPageView); | 739 pFormFiller->SaveState(pPageView); |
| 763 | 740 |
| 764 » » » PDFSDK_FieldAction faOld = fa; | 741 PDFSDK_FieldAction faOld = fa; |
| 765 » » » pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageVie
w); | 742 pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView); |
| 766 | 743 |
| 767 » » » bRC = fa.bRC; | 744 bRC = fa.bRC; |
| 768 //» » » bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPage
View, pWidget); | 745 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidge
t); |
| 769 | 746 |
| 770 » » » m_bNotifying = FALSE; | 747 m_bNotifying = FALSE; |
| 771 » » } | 748 } |
| 772 » } | 749 } |
| 773 } | 750 } |
| 774 | 751 |
| 775 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, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag) |
| 776 { | 753 { |
| 777 » if (!m_bNotifying) | 754 if (!m_bNotifying) |
| 778 » { | 755 { |
| 779 » » ASSERT(pWidget != NULL); | 756 ASSERT(pWidget != NULL); |
| 780 » » if (pWidget->GetAAction(CPDF_AAction::Validate)) | 757 if (pWidget->GetAAction(CPDF_AAction::Validate)) |
| 781 » » { | 758 { |
| 782 » » » m_bNotifying = TRUE; | 759 m_bNotifying = TRUE; |
| 783 » » » pWidget->ClearAppModified(); | 760 pWidget->ClearAppModified(); |
| 784 | 761 |
| 785 » » » ASSERT(pPageView != NULL); | 762 ASSERT(pPageView != NULL); |
| 786 // » » » CReader_DocView* pDocView = pPageView->GetDocView(); | 763 // CReader_DocView* pDocView = pPageView->GetDocView(); |
| 787 // » » » ASSERT(pDocView != NULL); | 764 // ASSERT(pDocView != NULL); |
| 788 | 765 |
| 789 | 766 |
| 790 | 767 |
| 791 » » » PDFSDK_FieldAction fa; | 768 PDFSDK_FieldAction fa; |
| 792 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 769 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 793 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 770 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 794 » » » fa.bKeyDown = TRUE; | 771 fa.bKeyDown = TRUE; |
| 795 » » » fa.bRC = TRUE; | 772 fa.bRC = TRUE; |
| 796 | 773 |
| 797 » » » CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FA
LSE); | 774 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); |
| 798 » » » ASSERT(pFormFiller != NULL); | 775 ASSERT(pFormFiller != NULL); |
| 799 | 776 |
| 800 » » » pFormFiller->GetActionData(pPageView, CPDF_AAction::Vali
date, fa); | 777 pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa); |
| 801 » » » pFormFiller->SaveState(pPageView); | 778 pFormFiller->SaveState(pPageView); |
| 802 | 779 |
| 803 » » » PDFSDK_FieldAction faOld = fa; | 780 PDFSDK_FieldAction faOld = fa; |
| 804 » » » pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView
); | 781 pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView); |
| 805 | 782 |
| 806 » » » bRC = fa.bRC; | 783 bRC = fa.bRC; |
| 807 //» » » bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPage
View, pWidget); | 784 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidge
t); |
| 808 | 785 |
| 809 » » » m_bNotifying = FALSE; | 786 m_bNotifying = FALSE; |
| 810 » » } | 787 } |
| 811 » } | 788 } |
| 812 } | 789 } |
| 813 | 790 |
| 814 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, FX_BOOL& bExit, FX_DWORD nFlag) |
| 815 { | 792 { |
| 816 » if (!m_bNotifying) | 793 if (!m_bNotifying) |
| 817 » { | 794 { |
| 818 » » ASSERT(pWidget != NULL); | 795 ASSERT(pWidget != NULL); |
| 819 » » ASSERT(pPageView != NULL); | 796 ASSERT(pPageView != NULL); |
| 820 // » » CReader_DocView* pDocView = pPageView->GetDocView(); | 797 // CReader_DocView* pDocView = pPageView->GetDocView(); |
| 821 // » » ASSERT(pDocView != NULL); | 798 // ASSERT(pDocView != NULL); |
| 822 » » CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); | 799 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); |
| 823 » » ASSERT(pDocument != NULL); | 800 ASSERT(pDocument != NULL); |
| 824 | 801 |
| 825 » » CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->G
etInterForm(); | 802 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); |
| 826 » » ASSERT(pInterForm != NULL); | 803 ASSERT(pInterForm != NULL); |
| 827 | 804 |
| 828 » » pInterForm->OnCalculate(pWidget->GetFormField()); | 805 pInterForm->OnCalculate(pWidget->GetFormField()); |
| 829 | 806 |
| 830 //» » bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pW
idget); | 807 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidget); |
| 831 | 808 |
| 832 » » m_bNotifying = FALSE; | 809 m_bNotifying = FALSE; |
| 833 » } | 810 } |
| 834 } | 811 } |
| 835 | 812 |
| 836 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, FX_BOOL& bExit, FX_DWORD nFlag) |
| 837 { | 814 { |
| 838 » if (!m_bNotifying) | 815 if (!m_bNotifying) |
| 839 » { | 816 { |
| 840 » » ASSERT(pWidget != NULL); | 817 ASSERT(pWidget != NULL); |
| 841 » » ASSERT(pPageView != NULL); | 818 ASSERT(pPageView != NULL); |
| 842 // » » CReader_DocView* pDocView = pPageView->GetDocView(); | 819 // CReader_DocView* pDocView = pPageView->GetDocView(); |
| 843 // » » ASSERT(pDocView != NULL); | 820 // ASSERT(pDocView != NULL); |
| 844 » » CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); | 821 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); |
| 845 » » ASSERT(pDocument != NULL); | 822 ASSERT(pDocument != NULL); |
| 846 | 823 |
| 847 » » CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->G
etInterForm(); | 824 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); |
| 848 » » ASSERT(pInterForm != NULL); | 825 ASSERT(pInterForm != NULL); |
| 849 | 826 |
| 850 » » FX_BOOL bFormated = FALSE; | 827 FX_BOOL bFormated = FALSE; |
| 851 » » CFX_WideString sValue = pInterForm->OnFormat(pWidget->GetFormFie
ld(), bFormated); | 828 CFX_WideString sValue = pInterForm->OnFormat(pWidget->GetFormField(), bF
ormated); |
| 852 | 829 |
| 853 //» » bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pW
idget); | 830 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidget); |
| 854 | 831 |
| 855 » » if (bExit) return; | 832 if (bExit) return; |
| 856 | 833 |
| 857 » » if (bFormated) | 834 if (bFormated) |
| 858 » » { | 835 { |
| 859 » » » pInterForm->ResetFieldAppearance(pWidget->GetFormField()
, sValue.c_str(), TRUE); | 836 pInterForm->ResetFieldAppearance(pWidget->GetFormField(), sValue.c_s
tr(), TRUE); |
| 860 » » » pInterForm->UpdateField(pWidget->GetFormField()); | 837 pInterForm->UpdateField(pWidget->GetFormField()); |
| 861 » » } | 838 } |
| 862 | 839 |
| 863 » » m_bNotifying = FALSE; | 840 m_bNotifying = FALSE; |
| 864 » } | 841 } |
| 865 } | 842 } |
| 866 | 843 |
| 867 FX_BOOL»CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Anno
t* pAnnot) | 844 FX_BOOL CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Anno
t* pAnnot) |
| 868 { | 845 { |
| 869 | 846 |
| 870 » ASSERT(pPageView != NULL); | 847 ASSERT(pPageView != NULL); |
| 871 » ASSERT(pAnnot != NULL); | 848 ASSERT(pAnnot != NULL); |
| 872 | 849 |
| 873 » if(pPageView) | 850 if(pPageView) |
| 874 » » return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot()); | 851 return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot()); |
| 875 » else | 852 else |
| 876 » » return FALSE; | 853 return FALSE; |
| 877 } | 854 } |
| 878 | 855 |
| 879 void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData
, int32_t nKeyCode, | 856 void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, void* pPrivateData
, int32_t nKeyCode, |
| 880 » » » » » » » » » »
» CFX_WideString & strChange, const CFX_WideString& strChangeEx, | 857 CFX_WideString & strChange, const
CFX_WideString& strChangeEx, |
| 881 » » » » » » » » » »
» int nSelStart, int nSelEnd, | 858 int nSelStart, int nSelEnd, |
| 882 » » » » » » » » » »
FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL & bExit, FX_DWORD nFlag) | 859 FX_BOOL bKeyDown, FX_BOOL & bRC, FX_BOOL
& bExit, FX_DWORD nFlag) |
| 883 { | 860 { |
| 884 » ASSERT(pPrivateData != NULL); | 861 ASSERT(pPrivateData != NULL); |
| 885 » CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 862 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
| 886 » ASSERT(pData->pWidget != NULL); | 863 ASSERT(pData->pWidget != NULL); |
| 887 | 864 |
| 888 » CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); | 865 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); |
| 889 » ASSERT(pFormFiller != NULL); | 866 ASSERT(pFormFiller != NULL); |
| 890 | 867 |
| 891 » if (!m_bNotifying) | 868 if (!m_bNotifying) |
| 892 » { | 869 { |
| 893 » » if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) | 870 if (pData->pWidget->GetAAction(CPDF_AAction::KeyStroke)) |
| 894 » » { | 871 { |
| 895 » » » m_bNotifying = TRUE; | 872 m_bNotifying = TRUE; |
| 896 » » » int nAge = pData->pWidget->GetAppearanceAge(); | 873 int nAge = pData->pWidget->GetAppearanceAge(); |
| 897 » » » int nValueAge = pData->pWidget->GetValueAge(); | 874 int nValueAge = pData->pWidget->GetValueAge(); |
| 898 | 875 |
| 899 » » » ASSERT(pData->pPageView != NULL); | 876 ASSERT(pData->pPageView != NULL); |
| 900 » » » CPDFSDK_Document* pDocument = pData->pPageView->GetSDKD
ocument(); | 877 CPDFSDK_Document* pDocument = pData->pPageView->GetSDKDocument(); |
| 901 | 878 |
| 902 » » » PDFSDK_FieldAction fa; | 879 PDFSDK_FieldAction fa; |
| 903 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 880 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 904 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 881 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 905 » » » fa.sChange = strChange; | 882 fa.sChange = strChange; |
| 906 » » » fa.sChangeEx = strChangeEx; | 883 fa.sChangeEx = strChangeEx; |
| 907 » » » fa.bKeyDown = bKeyDown; | 884 fa.bKeyDown = bKeyDown; |
| 908 » » » fa.bWillCommit = FALSE; | 885 fa.bWillCommit = FALSE; |
| 909 » » » fa.bRC = TRUE; | 886 fa.bRC = TRUE; |
| 910 » » » fa.nSelStart = nSelStart; | 887 fa.nSelStart = nSelStart; |
| 911 » » » fa.nSelEnd = nSelEnd; | 888 fa.nSelEnd = nSelEnd; |
| 912 | 889 |
| 913 | 890 |
| 914 » » » pFormFiller->GetActionData(pData->pPageView, CPDF_AActio
n::KeyStroke, fa); | 891 pFormFiller->GetActionData(pData->pPageView, CPDF_AAction::KeyStroke
, fa); |
| 915 » » » pFormFiller->SaveState(pData->pPageView); | 892 pFormFiller->SaveState(pData->pPageView); |
| 916 | 893 |
| 917 » » » if (pData->pWidget->OnAAction(CPDF_AAction::KeyStroke, f
a, pData->pPageView)) | 894 if (pData->pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pData->pP
ageView)) |
| 918 » » » { | 895 { |
| 919 » » » » if (!IsValidAnnot(pData->pPageView, pData->pWidg
et)) | 896 if (!IsValidAnnot(pData->pPageView, pData->pWidget)) |
| 920 » » » » { | 897 { |
| 921 » » » » » bExit = TRUE; | 898 bExit = TRUE; |
| 922 » » » » » m_bNotifying = FALSE; | 899 m_bNotifying = FALSE; |
| 923 » » » » » return; | 900 return; |
| 924 » » » » } | 901 } |
| 925 | 902 |
| 926 » » » » if (nAge != pData->pWidget->GetAppearanceAge()) | 903 if (nAge != pData->pWidget->GetAppearanceAge()) |
| 927 » » » » { | 904 { |
| 928 » » » » » CPWL_Wnd* pWnd = pFormFiller->ResetPDFWi
ndow(pData->pPageView, nValueAge == pData->pWidget->GetValueAge()); | 905 CPWL_Wnd* pWnd = pFormFiller->ResetPDFWindow(pData->pPageVie
w, nValueAge == pData->pWidget->GetValueAge()); |
| 929 » » » » » pData = (CFFL_PrivateData*)pWnd->GetAtta
chedData(); | 906 pData = (CFFL_PrivateData*)pWnd->GetAttachedData(); |
| 930 » » » » » bExit = TRUE; | 907 bExit = TRUE; |
| 931 » » » » } | 908 } |
| 932 | 909 |
| 933 » » » » if (fa.bRC) | 910 if (fa.bRC) |
| 934 » » » » { | 911 { |
| 935 » » » » » pFormFiller->SetActionData(pData->pPageV
iew, CPDF_AAction::KeyStroke, fa); | 912 pFormFiller->SetActionData(pData->pPageView, CPDF_AAction::K
eyStroke, fa); |
| 936 » » » » » bRC = FALSE; | 913 bRC = FALSE; |
| 937 » » » » } | 914 } |
| 938 » » » » else | 915 else |
| 939 » » » » { | 916 { |
| 940 » » » » » pFormFiller->RestoreState(pData->pPageVi
ew); | 917 pFormFiller->RestoreState(pData->pPageView); |
| 941 » » » » » bRC = FALSE; | 918 bRC = FALSE; |
| 942 » » » » } | 919 } |
| 943 | 920 |
| 944 » » » » if (pDocument->GetFocusAnnot() != pData->pWidget
) | 921 if (pDocument->GetFocusAnnot() != pData->pWidget) |
| 945 » » » » { | 922 { |
| 946 » » » » » pFormFiller->CommitData(pData->pPageView
,nFlag); | 923 pFormFiller->CommitData(pData->pPageView,nFlag); |
| 947 » » » » » bExit = TRUE; | 924 bExit = TRUE; |
| 948 » » » » } | 925 } |
| 949 » » » } | 926 } |
| 950 » » » else | 927 else |
| 951 » » » { | 928 { |
| 952 » » » » if (!IsValidAnnot(pData->pPageView, pData->pWidg
et)) | 929 if (!IsValidAnnot(pData->pPageView, pData->pWidget)) |
| 953 » » » » { | 930 { |
| 954 » » » » » bExit = TRUE; | 931 bExit = TRUE; |
| 955 » » » » » m_bNotifying = FALSE; | 932 m_bNotifying = FALSE; |
| 956 » » » » » return; | 933 return; |
| 957 » » » » } | 934 } |
| 958 » » » } | 935 } |
| 959 | 936 |
| 960 » » » m_bNotifying = FALSE; | 937 m_bNotifying = FALSE; |
| 961 » » } | 938 } |
| 962 » } | 939 } |
| 963 } | 940 } |
| 964 | 941 |
| 965 void» CFFL_IFormFiller::OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateDa
ta, FX_BOOL & bExit,FX_DWORD nFlag) | 942 void CFFL_IFormFiller::OnAfterKeyStroke(FX_BOOL bEditOrList, void* pPrivateDa
ta, FX_BOOL & bExit,FX_DWORD nFlag) |
| 966 { | 943 { |
| 967 » ASSERT(pPrivateData != NULL); | 944 ASSERT(pPrivateData != NULL); |
| 968 » CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 945 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
| 969 » ASSERT(pData->pWidget != NULL); | 946 ASSERT(pData->pWidget != NULL); |
| 970 | 947 |
| 971 » CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); | 948 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); |
| 972 » ASSERT(pFormFiller != NULL); | 949 ASSERT(pFormFiller != NULL); |
| 973 | 950 |
| 974 » if (!bEditOrList) | 951 if (!bEditOrList) |
| 975 » » pFormFiller->OnKeyStroke(bExit); | 952 pFormFiller->OnKeyStroke(bExit); |
| 976 } | 953 } |
| OLD | NEW |