| 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 » » OnClick(pWidget, pPageView, bReset, bExit, nFlags); | 303 OnClick(pWidget, pPageView, bReset, bExit, nFlags); |
| 315 » » if (bExit) return TRUE; | 304 if (bExit) return TRUE; |
| 316 » } | 305 } |
| 317 » return bRet; | 306 return bRet; |
| 318 } | 307 } |
| 319 | 308 |
| 320 void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa
geView, FX_BOOL& bReset, FX_BOOL& bExit,FX_UINT nFlag) | 309 void CFFL_IFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa
geView, FX_BOOL& bReset, FX_BOOL& bExit,FX_UINT nFlag) |
| 321 { | 310 { |
| 322 » ASSERT(pWidget != NULL); | 311 ASSERT(pWidget != NULL); |
| 323 | 312 |
| 324 » if (!m_bNotifying) | 313 if (!m_bNotifying) |
| 325 » { | 314 { |
| 326 » » if (pWidget->GetAAction(CPDF_AAction::ButtonUp)) | 315 if (pWidget->GetAAction(CPDF_AAction::ButtonUp)) |
| 327 » » { | 316 { |
| 328 » » » m_bNotifying = TRUE; | 317 m_bNotifying = TRUE; |
| 329 » » » int nAge = pWidget->GetAppearanceAge(); | 318 int nAge = pWidget->GetAppearanceAge(); |
| 330 » » » int nValueAge = pWidget->GetValueAge(); | 319 int nValueAge = pWidget->GetValueAge(); |
| 331 | 320 |
| 332 » » » ASSERT(pPageView != NULL); | 321 ASSERT(pPageView != NULL); |
| 333 // » » » CReader_DocView* pDocView = pPageView->GetDocView(); | 322 // CReader_DocView* pDocView = pPageView->GetDocView(); |
| 334 // » » » ASSERT(pDocView != NULL); | 323 // ASSERT(pDocView != NULL); |
| 335 | 324 |
| 336 | 325 |
| 337 | 326 |
| 338 » » » PDFSDK_FieldAction fa; | 327 PDFSDK_FieldAction fa; |
| 339 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 328 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 340 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 329 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 341 | 330 |
| 342 » » » pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView
); | 331 pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView); |
| 343 » » » m_bNotifying = FALSE; | 332 m_bNotifying = FALSE; |
| 344 | 333 |
| 345 » » » if (!IsValidAnnot(pPageView, pWidget)) | 334 if (!IsValidAnnot(pPageView, pWidget)) |
| 346 » » » { | 335 { |
| 347 » » » » bExit = TRUE; | 336 bExit = TRUE; |
| 348 » » » » return; | 337 return; |
| 349 » » » } | 338 } |
| 350 | 339 |
| 351 » » » if (nAge != pWidget->GetAppearanceAge()) | 340 if (nAge != pWidget->GetAppearanceAge()) |
| 352 » » » { | 341 { |
| 353 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller
(pWidget, FALSE)) | 342 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)
) |
| 354 » » » » { | 343 { |
| 355 » » » » » pFormFiller->ResetPDFWindow(pPageView, n
ValueAge == pWidget->GetValueAge()); | 344 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget-
>GetValueAge()); |
| 356 » » » » } | 345 } |
| 357 | 346 |
| 358 » » » » bReset = TRUE; | 347 bReset = TRUE; |
| 359 » » » } | 348 } |
| 360 » » } | 349 } |
| 361 » } | 350 } |
| 362 } | 351 } |
| 363 | 352 |
| 364 FX_BOOL»CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_A
nnot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 353 FX_BOOL CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_A
nnot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
| 365 { | 354 { |
| 366 » ASSERT(pAnnot != NULL); | 355 ASSERT(pAnnot != NULL); |
| 367 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 356 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 368 | 357 |
| 369 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 358 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 370 » { | 359 { |
| 371 » » return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, p
oint); | 360 return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); |
| 372 » } | 361 } |
| 373 | 362 |
| 374 » return FALSE; | 363 return FALSE; |
| 375 } | 364 } |
| 376 | 365 |
| 377 FX_BOOL»CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot
* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 366 FX_BOOL CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, CPDFSDK_Annot
* pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
| 378 { | 367 { |
| 379 » ASSERT(pAnnot != NULL); | 368 ASSERT(pAnnot != NULL); |
| 380 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 369 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 381 | 370 |
| 382 » //change cursor | 371 //change cursor |
| 383 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) | 372 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) |
| 384 » { | 373 { |
| 385 » » return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point
); | 374 return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); |
| 386 » } | 375 } |
| 387 | 376 |
| 388 » return FALSE; | 377 return FALSE; |
| 389 } | 378 } |
| 390 | 379 |
| 391 FX_BOOL»CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Anno
t* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point) | 380 FX_BOOL CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, CPDFSDK_Anno
t* pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point) |
| 392 { | 381 { |
| 393 » ASSERT(pAnnot != NULL); | 382 ASSERT(pAnnot != NULL); |
| 394 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 383 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 395 | 384 |
| 396 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 385 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 397 » { | 386 { |
| 398 » » return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDel
ta, point); | 387 return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, poin
t); |
| 399 » } | 388 } |
| 400 | 389 |
| 401 » return FALSE; | 390 return FALSE; |
| 402 } | 391 } |
| 403 | 392 |
| 404 FX_BOOL»CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann
ot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 393 FX_BOOL CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, CPDFSDK_Ann
ot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
| 405 { | 394 { |
| 406 » ASSERT(pAnnot != NULL); | 395 ASSERT(pAnnot != NULL); |
| 407 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 396 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 408 | 397 |
| 409 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 398 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 410 » { | 399 { |
| 411 » » return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, poi
nt); | 400 return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); |
| 412 » } | 401 } |
| 413 | 402 |
| 414 » return FALSE; | 403 return FALSE; |
| 415 } | 404 } |
| 416 | 405 |
| 417 FX_BOOL»CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot
* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 406 FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, CPDFSDK_Annot
* pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
| 418 { | 407 { |
| 419 » ASSERT(pAnnot != NULL); | 408 ASSERT(pAnnot != NULL); |
| 420 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 409 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 421 | 410 |
| 422 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 411 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 423 » { | 412 { |
| 424 » » return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point
); | 413 return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); |
| 425 » } | 414 } |
| 426 | 415 |
| 427 » return FALSE; | 416 return FALSE; |
| 428 } | 417 } |
| 429 | 418 |
| 430 FX_BOOL»CFFL_IFormFiller::OnRButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_A
nnot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 419 FX_BOOL CFFL_IFormFiller::OnRButtonDblClk(CPDFSDK_PageView* pPageView, CPDFSDK_A
nnot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
| 431 { | 420 { |
| 432 » ASSERT(pAnnot != NULL); | 421 ASSERT(pAnnot != NULL); |
| 433 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 422 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 434 | 423 |
| 435 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 424 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 436 » { | 425 { |
| 437 » » return pFormFiller->OnRButtonDblClk(pPageView, pAnnot, nFlags, p
oint); | 426 return pFormFiller->OnRButtonDblClk(pPageView, pAnnot, nFlags, point); |
| 438 » } | 427 } |
| 439 | 428 |
| 440 » return FALSE; | 429 return FALSE; |
| 441 } | 430 } |
| 442 | 431 |
| 443 FX_BOOL»CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_
UINT nFlags) | 432 FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_
UINT nFlags) |
| 444 { | 433 { |
| 445 » ASSERT(pAnnot != NULL); | 434 ASSERT(pAnnot != NULL); |
| 446 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 435 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 447 | 436 |
| 448 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 437 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 449 » { | 438 { |
| 450 » » return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); | 439 return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); |
| 451 » } | 440 } |
| 452 | 441 |
| 453 » return FALSE; | 442 return FALSE; |
| 454 } | 443 } |
| 455 | 444 |
| 456 FX_BOOL»CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT n
Flags) | 445 FX_BOOL CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT n
Flags) |
| 457 { | 446 { |
| 458 » ASSERT(pAnnot != NULL); | 447 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 459 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 448 if (nChar == FWL_VKEY_Tab) |
| 460 | 449 return TRUE; |
| 461 » if (nChar == FWL_VKEY_Tab) return TRUE; | 450 |
| 462 | 451 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 463 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 452 return pFormFiller->OnChar(pAnnot, nChar, nFlags); |
| 464 » { | 453 |
| 465 » » return pFormFiller->OnChar(pAnnot, nChar, nFlags); | 454 return FALSE; |
| 466 » } | |
| 467 | |
| 468 » return FALSE; | |
| 469 } | 455 } |
| 470 | 456 |
| 471 void CFFL_IFormFiller::OnDeSelected(CPDFSDK_Annot* pAnnot) | 457 void CFFL_IFormFiller::OnDeSelected(CPDFSDK_Annot* pAnnot) |
| 472 { | 458 { |
| 473 ASSERT(pAnnot != NULL); | 459 ASSERT(pAnnot != NULL); |
| 474 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 460 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 475 | 461 |
| 476 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 462 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 477 { | 463 { |
| 478 pFormFiller->OnDeSelected(pAnnot); | 464 pFormFiller->OnDeSelected(pAnnot); |
| 479 } | 465 } |
| 480 } | 466 } |
| 481 | 467 |
| 482 void CFFL_IFormFiller::OnSelected(CPDFSDK_Annot* pAnnot) | 468 void CFFL_IFormFiller::OnSelected(CPDFSDK_Annot* pAnnot) |
| 483 { | 469 { |
| 484 ASSERT(pAnnot != NULL); | 470 ASSERT(pAnnot != NULL); |
| 485 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 471 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 486 | 472 |
| 487 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 473 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 488 { | 474 { |
| 489 pFormFiller->OnSelected(pAnnot); | 475 pFormFiller->OnSelected(pAnnot); |
| 490 } | 476 } |
| 491 } | 477 } |
| 492 | 478 |
| 493 FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) | 479 FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) |
| 494 { | 480 { |
| 495 » if(!pAnnot) return FALSE; | 481 if (!pAnnot) |
| 496 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 482 return FALSE; |
| 497 | 483 |
| 498 » if (!m_bNotifying) | 484 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 499 » { | |
| 500 » » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | |
| 501 » » if (pWidget->GetAAction(CPDF_AAction::GetFocus)) | |
| 502 » » { | |
| 503 » » » m_bNotifying = TRUE; | |
| 504 » » » pWidget->GetAppearanceAge(); | |
| 505 » » » int nValueAge = pWidget->GetValueAge(); | |
| 506 » » » pWidget->ClearAppModified(); | |
| 507 | 485 |
| 486 if (!m_bNotifying) |
| 487 { |
| 488 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 489 if (pWidget->GetAAction(CPDF_AAction::GetFocus)) |
| 490 { |
| 491 m_bNotifying = TRUE; |
| 492 pWidget->GetAppearanceAge(); |
| 508 | 493 |
| 509 » » » CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); | 494 int nValueAge = pWidget->GetValueAge(); |
| 510 » » » ASSERT(pPageView != NULL); | 495 pWidget->ClearAppModified(); |
| 511 | 496 |
| 512 » » » PDFSDK_FieldAction fa; | 497 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); |
| 513 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 498 ASSERT(pPageView != NULL); |
| 514 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | |
| 515 | 499 |
| 500 PDFSDK_FieldAction fa; |
| 501 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 502 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 516 | 503 |
| 517 » » » CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TR
UE); | 504 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TRUE); |
| 518 » » » if(!pFormFiller) return FALSE; | 505 if(!pFormFiller) return FALSE; |
| 519 » » » pFormFiller->GetActionData(pPageView, CPDF_AAction::GetF
ocus, fa); | 506 pFormFiller->GetActionData(pPageView, CPDF_AAction::GetFocus, fa); |
| 507 pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView); |
| 508 m_bNotifying = FALSE; |
| 520 | 509 |
| 521 » » » pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView
); | 510 if (pWidget->IsAppModified()) |
| 522 » » » m_bNotifying = FALSE; | 511 { |
| 512 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)
) |
| 513 { |
| 514 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget-
>GetValueAge()); |
| 515 } |
| 516 } |
| 517 } |
| 518 } |
| 523 | 519 |
| 524 //» » » if (!IsValidAnnot(m_pApp, pDocument, pDocView, pPageView
, pAnnot)) return FALSE; | 520 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) |
| 521 return pFormFiller->OnSetFocus(pAnnot, nFlag); |
| 525 | 522 |
| 526 » » » if (pWidget->IsAppModified()) | 523 return TRUE; |
| 527 » » » { | |
| 528 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller
(pWidget, FALSE)) | |
| 529 » » » » { | |
| 530 » » » » » pFormFiller->ResetPDFWindow(pPageView, n
ValueAge == pWidget->GetValueAge()); | |
| 531 » » » » } | |
| 532 » » » } | |
| 533 » » } | |
| 534 » } | |
| 535 | |
| 536 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) | |
| 537 » { | |
| 538 » » if (pFormFiller->OnSetFocus(pAnnot, nFlag)) | |
| 539 » » { | |
| 540 » » » return TRUE; | |
| 541 » » } | |
| 542 » » else | |
| 543 » » » return FALSE; | |
| 544 » } | |
| 545 | |
| 546 » return TRUE; | |
| 547 } | 524 } |
| 548 | 525 |
| 549 FX_BOOL»CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) | 526 FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot,FX_UINT nFlag) |
| 550 { | 527 { |
| 551 » if(!pAnnot) return FALSE; | 528 if(!pAnnot) return FALSE; |
| 552 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 529 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
| 553 | 530 |
| 554 » if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 531 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
| 555 » { | 532 { |
| 556 » » if (pFormFiller->OnKillFocus(pAnnot, nFlag)) | 533 if (pFormFiller->OnKillFocus(pAnnot, nFlag)) |
| 557 » » { | 534 { |
| 558 » » » if (!m_bNotifying) | 535 if (!m_bNotifying) |
| 559 » » » { | 536 { |
| 560 » » » » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnno
t; | 537 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
| 561 » » » » if (pWidget->GetAAction(CPDF_AAction::LoseFocus)
) | 538 if (pWidget->GetAAction(CPDF_AAction::LoseFocus)) |
| 562 » » » » { | 539 { |
| 563 » » » » » m_bNotifying = TRUE; | 540 m_bNotifying = TRUE; |
| 564 » » » » » pWidget->ClearAppModified(); | 541 pWidget->ClearAppModified(); |
| 565 | 542 |
| 566 » » » » » CPDFSDK_PageView* pPageView = pWidget->G
etPageView(); | 543 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); |
| 567 » » » » » ASSERT(pPageView != NULL); | 544 ASSERT(pPageView != NULL); |
| 568 | 545 |
| 569 » » » » » PDFSDK_FieldAction fa; | 546 PDFSDK_FieldAction fa; |
| 570 » » » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown
(nFlag); | 547 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 571 » » » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(n
Flag); | 548 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 572 | 549 |
| 573 » » » » » pFormFiller->GetActionData(pPageView, CP
DF_AAction::LoseFocus, fa); | 550 pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocu
s, fa); |
| 574 | 551 |
| 575 » » » » » pWidget->OnAAction(CPDF_AAction::LoseFoc
us, fa, pPageView); | 552 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); |
| 576 » » » » » m_bNotifying = FALSE; | 553 m_bNotifying = FALSE; |
| 577 | 554 |
| 578 » » » » } | 555 } |
| 579 » » » } | 556 } |
| 580 » » } | 557 } |
| 581 » » else | 558 else |
| 582 » » » return FALSE; | 559 return FALSE; |
| 583 » } | 560 } |
| 584 | 561 |
| 585 » return TRUE; | 562 return TRUE; |
| 586 } | 563 } |
| 587 | 564 |
| 588 FX_BOOL»CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) | 565 FX_BOOL CFFL_IFormFiller::IsVisible(CPDFSDK_Widget* pWidget) |
| 589 { | 566 { |
| 590 » return pWidget->IsVisible(); | 567 return pWidget->IsVisible(); |
| 591 } | 568 } |
| 592 | 569 |
| 593 FX_BOOL»CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) | 570 FX_BOOL CFFL_IFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) |
| 594 { | 571 { |
| 595 » ASSERT(pWidget != NULL); | 572 ASSERT(pWidget != NULL); |
| 596 | 573 |
| 597 » int nFieldFlags = pWidget->GetFieldFlags(); | 574 int nFieldFlags = pWidget->GetFieldFlags(); |
| 598 | 575 |
| 599 » return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY; | 576 return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY; |
| 600 } | 577 } |
| 601 | 578 |
| 602 FX_BOOL»CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) | 579 FX_BOOL CFFL_IFormFiller::IsFillingAllowed(CPDFSDK_Widget* pWidget) |
| 603 { | 580 { |
| 604 » ASSERT(pWidget != NULL); | 581 if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) |
| 582 return TRUE; |
| 605 | 583 |
| 606 » if (pWidget->GetFieldType() == FIELDTYPE_PUSHBUTTON) | 584 CPDF_Page* pPage = pWidget->GetPDFPage(); |
| 607 » » return TRUE; | 585 CPDF_Document* pDocument = pPage->m_pDocument; |
| 608 » else | 586 FX_DWORD dwPermissions = pDocument->GetUserPermissions(); |
| 609 » { | 587 return (dwPermissions & FPDFPERM_FILL_FORM) || |
| 610 » » CPDF_Page* pPage = pWidget->GetPDFPage(); | 588 (dwPermissions & FPDFPERM_ANNOT_FORM) || |
| 611 » » ASSERT(pPage != NULL); | 589 (dwPermissions & FPDFPERM_MODIFY); |
| 612 | |
| 613 » » CPDF_Document* pDocument = pPage->m_pDocument; | |
| 614 » » ASSERT(pDocument != NULL); | |
| 615 | |
| 616 » » FX_DWORD dwPermissions = pDocument->GetUserPermissions(); | |
| 617 » » return (dwPermissions&FPDFPERM_FILL_FORM) || | |
| 618 » » » » (dwPermissions&FPDFPERM_ANNOT_FORM) || | |
| 619 » » » (dwPermissions&FPDFPERM_MODIFY); | |
| 620 » } | |
| 621 » return TRUE; | |
| 622 } | 590 } |
| 623 | 591 |
| 624 CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL
bRegister) | 592 CFFL_FormFiller* CFFL_IFormFiller::GetFormFiller(CPDFSDK_Annot* pAnnot, FX_BOOL
bRegister) |
| 625 { | 593 { |
| 626 auto it = m_Maps.find(pAnnot); | 594 auto it = m_Maps.find(pAnnot); |
| 627 if (it != m_Maps.end()) | 595 if (it != m_Maps.end()) |
| 628 return it->second; | 596 return it->second; |
| 629 | 597 |
| 630 if (!bRegister) | 598 if (!bRegister) |
| 631 return nullptr; | 599 return nullptr; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 660 | 628 |
| 661 if (!pFormFiller) | 629 if (!pFormFiller) |
| 662 return nullptr; | 630 return nullptr; |
| 663 | 631 |
| 664 m_Maps[pAnnot] = pFormFiller; | 632 m_Maps[pAnnot] = pFormFiller; |
| 665 return pFormFiller; | 633 return pFormFiller; |
| 666 } | 634 } |
| 667 | 635 |
| 668 void CFFL_IFormFiller::RemoveFormFiller(CPDFSDK_Annot* pAnnot) | 636 void CFFL_IFormFiller::RemoveFormFiller(CPDFSDK_Annot* pAnnot) |
| 669 { | 637 { |
| 670 » if ( pAnnot != NULL ) | 638 if ( pAnnot != NULL ) |
| 671 » { | 639 { |
| 672 » » UnRegisterFormFiller( pAnnot ); | 640 UnRegisterFormFiller( pAnnot ); |
| 673 » } | 641 } |
| 674 } | 642 } |
| 675 | 643 |
| 676 void CFFL_IFormFiller::UnRegisterFormFiller(CPDFSDK_Annot* pAnnot) | 644 void CFFL_IFormFiller::UnRegisterFormFiller(CPDFSDK_Annot* pAnnot) |
| 677 { | 645 { |
| 678 auto it = m_Maps.find(pAnnot); | 646 auto it = m_Maps.find(pAnnot); |
| 679 if (it == m_Maps.end()) | 647 if (it == m_Maps.end()) |
| 680 return; | 648 return; |
| 681 | 649 |
| 682 delete it->second; | 650 delete it->second; |
| 683 m_Maps.erase(it); | 651 m_Maps.erase(it); |
| 684 } | 652 } |
| 685 | 653 |
| 686 void CFFL_IFormFiller::SetFocusAnnotTab(CPDFSDK_Annot* pWidget, FX_BOOL bSameFie
ld, FX_BOOL bNext) | 654 void CFFL_IFormFiller::SetFocusAnnotTab(CPDFSDK_Annot* pWidget, FX_BOOL bSameFie
ld, FX_BOOL bNext) |
| 687 { | 655 { |
| 688 | 656 |
| 689 } | 657 } |
| 690 | 658 |
| 691 void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX
_FLOAT fPopupMax, int32_t & nRet, FX_FLOAT & fPopupRet) | 659 void CFFL_IFormFiller::QueryWherePopup(void* pPrivateData, FX_FLOAT fPopupMin,FX
_FLOAT fPopupMax, int32_t & nRet, FX_FLOAT & fPopupRet) |
| 692 { | 660 { |
| 693 » ASSERT(pPrivateData != NULL); | 661 ASSERT(pPrivateData != NULL); |
| 694 | 662 |
| 695 » CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 663 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
| 696 | 664 |
| 697 | 665 |
| 698 | 666 |
| 699 | 667 |
| 700 » CPDF_Rect rcPageView(0,0,0,0); | 668 CPDF_Rect rcPageView(0,0,0,0); |
| 701 » rcPageView.right = pData->pWidget->GetPDFPage()->GetPageWidth(); | 669 rcPageView.right = pData->pWidget->GetPDFPage()->GetPageWidth(); |
| 702 » rcPageView.bottom = pData->pWidget->GetPDFPage()->GetPageHeight(); | 670 rcPageView.bottom = pData->pWidget->GetPDFPage()->GetPageHeight(); |
| 703 » rcPageView.Normalize(); | 671 rcPageView.Normalize(); |
| 704 | 672 |
| 705 | 673 |
| 706 » ASSERT(pData->pWidget != NULL); | 674 ASSERT(pData->pWidget != NULL); |
| 707 » CPDF_Rect rcAnnot = pData->pWidget->GetRect(); | 675 CPDF_Rect rcAnnot = pData->pWidget->GetRect(); |
| 708 | 676 |
| 709 » FX_FLOAT fTop = 0.0f; | 677 FX_FLOAT fTop = 0.0f; |
| 710 » FX_FLOAT fBottom = 0.0f; | 678 FX_FLOAT fBottom = 0.0f; |
| 711 | 679 |
| 712 » CPDFSDK_Widget * pWidget = (CPDFSDK_Widget*)pData->pWidget; | 680 CPDFSDK_Widget * pWidget = (CPDFSDK_Widget*)pData->pWidget; |
| 713 » switch (pWidget->GetRotate() / 90) | 681 switch (pWidget->GetRotate() / 90) |
| 714 » { | 682 { |
| 715 » default: | 683 default: |
| 716 » case 0: | 684 case 0: |
| 717 » » fTop = rcPageView.top - rcAnnot.top; | 685 fTop = rcPageView.top - rcAnnot.top; |
| 718 » » fBottom = rcAnnot.bottom - rcPageView.bottom; | 686 fBottom = rcAnnot.bottom - rcPageView.bottom; |
| 719 » » break; | 687 break; |
| 720 » case 1: | 688 case 1: |
| 721 » » fTop = rcAnnot.left - rcPageView.left; | 689 fTop = rcAnnot.left - rcPageView.left; |
| 722 » » fBottom = rcPageView.right - rcAnnot.right; | 690 fBottom = rcPageView.right - rcAnnot.right; |
| 723 » » break; | 691 break; |
| 724 » case 2: | 692 case 2: |
| 725 » » fTop = rcAnnot.bottom - rcPageView.bottom; | 693 fTop = rcAnnot.bottom - rcPageView.bottom; |
| 726 » » fBottom = rcPageView.top - rcAnnot.top; | 694 fBottom = rcPageView.top - rcAnnot.top; |
| 727 » » break; | 695 break; |
| 728 » case 3: | 696 case 3: |
| 729 » » fTop = rcPageView.right - rcAnnot.right; | 697 fTop = rcPageView.right - rcAnnot.right; |
| 730 » » fBottom = rcAnnot.left - rcPageView.left; | 698 fBottom = rcAnnot.left - rcPageView.left; |
| 731 » » break; | 699 break; |
| 732 » } | 700 } |
| 733 | 701 |
| 734 » FX_FLOAT fFactHeight = 0; | 702 FX_FLOAT fFactHeight = 0; |
| 735 » FX_BOOL bBottom = TRUE; | 703 FX_BOOL bBottom = TRUE; |
| 736 » FX_FLOAT fMaxListBoxHeight = 0; | 704 FX_FLOAT fMaxListBoxHeight = 0; |
| 737 » if (fPopupMax > FFL_MAXLISTBOXHEIGHT) | 705 if (fPopupMax > FFL_MAXLISTBOXHEIGHT) |
| 738 » { | 706 { |
| 739 » » if (fPopupMin > FFL_MAXLISTBOXHEIGHT) | 707 if (fPopupMin > FFL_MAXLISTBOXHEIGHT) |
| 740 » » { | 708 { |
| 741 » » » fMaxListBoxHeight = fPopupMin; | 709 fMaxListBoxHeight = fPopupMin; |
| 742 » » } | 710 } |
| 743 » » else | 711 else |
| 744 » » { | 712 { |
| 745 » » » fMaxListBoxHeight = FFL_MAXLISTBOXHEIGHT; | 713 fMaxListBoxHeight = FFL_MAXLISTBOXHEIGHT; |
| 746 » » } | 714 } |
| 747 » } | 715 } |
| 748 » else | 716 else |
| 749 » » fMaxListBoxHeight = fPopupMax; | 717 fMaxListBoxHeight = fPopupMax; |
| 750 | 718 |
| 751 » if (fBottom > fMaxListBoxHeight) | 719 if (fBottom > fMaxListBoxHeight) |
| 752 » { | 720 { |
| 753 » » fFactHeight = fMaxListBoxHeight; | 721 fFactHeight = fMaxListBoxHeight; |
| 754 » » bBottom = TRUE; | 722 bBottom = TRUE; |
| 755 » } | 723 } |
| 756 » else | 724 else |
| 757 » { | 725 { |
| 758 » » if (fTop > fMaxListBoxHeight) | 726 if (fTop > fMaxListBoxHeight) |
| 759 » » { | 727 { |
| 760 » » » fFactHeight = fMaxListBoxHeight; | 728 fFactHeight = fMaxListBoxHeight; |
| 761 » » » bBottom = FALSE; | 729 bBottom = FALSE; |
| 762 » » } | 730 } |
| 763 » » else | 731 else |
| 764 » » { | 732 { |
| 765 » » » if (fTop > fBottom) | 733 if (fTop > fBottom) |
| 766 » » » { | 734 { |
| 767 » » » » fFactHeight = fTop; | 735 fFactHeight = fTop; |
| 768 » » » » bBottom = FALSE; | 736 bBottom = FALSE; |
| 769 » » » } | 737 } |
| 770 » » » else | 738 else |
| 771 » » » { | 739 { |
| 772 » » » » fFactHeight = fBottom; | 740 fFactHeight = fBottom; |
| 773 » » » » bBottom = TRUE; | 741 bBottom = TRUE; |
| 774 » » » } | 742 } |
| 775 » » } | 743 } |
| 776 » } | 744 } |
| 777 | 745 |
| 778 » nRet = bBottom ? 0 : 1; | 746 nRet = bBottom ? 0 : 1; |
| 779 » fPopupRet = fFactHeight; | 747 fPopupRet = fFactHeight; |
| 780 } | 748 } |
| 781 | 749 |
| 782 void CFFL_IFormFiller::OnSetWindowRect(void* pPrivateData, const CPDF_Rect & rcW
indow) | 750 void CFFL_IFormFiller::OnSetWindowRect(void* pPrivateData, const CPDF_Rect & rcW
indow) |
| 783 { | 751 { |
| 784 ASSERT(pPrivateData != NULL); | 752 ASSERT(pPrivateData != NULL); |
| 785 | 753 |
| 786 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 754 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
| 787 | 755 |
| 788 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, TRUE)) | 756 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, TRUE)) |
| 789 { | 757 { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 812 ASSERT(pData->pWidget != NULL); | 780 ASSERT(pData->pWidget != NULL); |
| 813 | 781 |
| 814 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); | 782 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); |
| 815 ASSERT(pFormFiller != NULL); | 783 ASSERT(pFormFiller != NULL); |
| 816 | 784 |
| 817 pFormFiller->OnKeyStroke(bKeyDown); | 785 pFormFiller->OnKeyStroke(bKeyDown); |
| 818 } | 786 } |
| 819 | 787 |
| 820 void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, CPDFSDK_PageVi
ew* pPageView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag) | 788 void CFFL_IFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, CPDFSDK_PageVi
ew* pPageView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag) |
| 821 { | 789 { |
| 822 » if (!m_bNotifying) | 790 if (!m_bNotifying) |
| 823 » { | 791 { |
| 824 » » ASSERT(pWidget != NULL); | 792 ASSERT(pWidget != NULL); |
| 825 » » if (pWidget->GetAAction(CPDF_AAction::KeyStroke)) | 793 if (pWidget->GetAAction(CPDF_AAction::KeyStroke)) |
| 826 » » { | 794 { |
| 827 » » » m_bNotifying = TRUE; | 795 m_bNotifying = TRUE; |
| 828 » » » pWidget->ClearAppModified(); | 796 pWidget->ClearAppModified(); |
| 829 | 797 |
| 830 » » » ASSERT(pPageView != NULL); | 798 ASSERT(pPageView != NULL); |
| 831 // » » » CReader_DocView* pDocView = pPageView->GetDocView(); | 799 |
| 832 // » » » ASSERT(pDocView != NULL); | 800 PDFSDK_FieldAction fa; |
| 833 | 801 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 834 | 802 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 835 | 803 fa.bWillCommit = TRUE; |
| 836 » » » PDFSDK_FieldAction fa; | 804 fa.bKeyDown = TRUE; |
| 837 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 805 fa.bRC = TRUE; |
| 838 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 806 |
| 839 » » » fa.bWillCommit = TRUE; | 807 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); |
| 840 » » » fa.bKeyDown = TRUE; | 808 ASSERT(pFormFiller != NULL); |
| 841 » » » fa.bRC = TRUE; | 809 |
| 842 | 810 pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa); |
| 843 » » » CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FA
LSE); | 811 pFormFiller->SaveState(pPageView); |
| 844 » » » ASSERT(pFormFiller != NULL); | 812 |
| 845 | 813 PDFSDK_FieldAction faOld = fa; |
| 846 » » » pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyS
troke, fa); | 814 pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView); |
| 847 » » » pFormFiller->SaveState(pPageView); | 815 |
| 848 | 816 bRC = fa.bRC; |
| 849 » » » PDFSDK_FieldAction faOld = fa; | 817 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidge
t); |
| 850 » » » pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageVie
w); | 818 |
| 851 | 819 m_bNotifying = FALSE; |
| 852 » » » bRC = fa.bRC; | 820 } |
| 853 //» » » bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPage
View, pWidget); | 821 } |
| 854 | |
| 855 » » » m_bNotifying = FALSE; | |
| 856 » » } | |
| 857 » } | |
| 858 } | 822 } |
| 859 | 823 |
| 860 void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa
geView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag) | 824 void CFFL_IFormFiller::OnValidate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPa
geView, FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag) |
| 861 { | 825 { |
| 862 » if (!m_bNotifying) | 826 if (!m_bNotifying) |
| 863 » { | 827 { |
| 864 » » ASSERT(pWidget != NULL); | 828 ASSERT(pWidget != NULL); |
| 865 » » if (pWidget->GetAAction(CPDF_AAction::Validate)) | 829 if (pWidget->GetAAction(CPDF_AAction::Validate)) |
| 866 » » { | 830 { |
| 867 » » » m_bNotifying = TRUE; | 831 m_bNotifying = TRUE; |
| 868 » » » pWidget->ClearAppModified(); | 832 pWidget->ClearAppModified(); |
| 869 | 833 |
| 870 » » » ASSERT(pPageView != NULL); | 834 ASSERT(pPageView != NULL); |
| 871 // » » » CReader_DocView* pDocView = pPageView->GetDocView(); | 835 // CReader_DocView* pDocView = pPageView->GetDocView(); |
| 872 // » » » ASSERT(pDocView != NULL); | 836 // ASSERT(pDocView != NULL); |
| 873 | 837 |
| 874 | 838 |
| 875 | 839 |
| 876 » » » PDFSDK_FieldAction fa; | 840 PDFSDK_FieldAction fa; |
| 877 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 841 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 878 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 842 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 879 » » » fa.bKeyDown = TRUE; | 843 fa.bKeyDown = TRUE; |
| 880 » » » fa.bRC = TRUE; | 844 fa.bRC = TRUE; |
| 881 | 845 |
| 882 » » » CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FA
LSE); | 846 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); |
| 883 » » » ASSERT(pFormFiller != NULL); | 847 ASSERT(pFormFiller != NULL); |
| 884 | 848 |
| 885 » » » pFormFiller->GetActionData(pPageView, CPDF_AAction::Vali
date, fa); | 849 pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa); |
| 886 » » » pFormFiller->SaveState(pPageView); | 850 pFormFiller->SaveState(pPageView); |
| 887 | 851 |
| 888 » » » PDFSDK_FieldAction faOld = fa; | 852 PDFSDK_FieldAction faOld = fa; |
| 889 » » » pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView
); | 853 pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView); |
| 890 | 854 |
| 891 » » » bRC = fa.bRC; | 855 bRC = fa.bRC; |
| 892 //» » » bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPage
View, pWidget); | 856 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidge
t); |
| 893 | 857 |
| 894 » » » m_bNotifying = FALSE; | 858 m_bNotifying = FALSE; |
| 895 » » } | 859 } |
| 896 » } | 860 } |
| 897 } | 861 } |
| 898 | 862 |
| 899 void CFFL_IFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pP
ageView, FX_BOOL& bExit, FX_DWORD nFlag) | 863 void CFFL_IFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pP
ageView, FX_BOOL& bExit, FX_DWORD nFlag) |
| 900 { | 864 { |
| 901 » if (!m_bNotifying) | 865 if (!m_bNotifying) |
| 902 » { | 866 { |
| 903 » » ASSERT(pWidget != NULL); | 867 ASSERT(pWidget != NULL); |
| 904 » » ASSERT(pPageView != NULL); | 868 ASSERT(pPageView != NULL); |
| 905 // » » CReader_DocView* pDocView = pPageView->GetDocView(); | 869 // CReader_DocView* pDocView = pPageView->GetDocView(); |
| 906 // » » ASSERT(pDocView != NULL); | 870 // ASSERT(pDocView != NULL); |
| 907 » » CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); | 871 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); |
| 908 » » ASSERT(pDocument != NULL); | 872 ASSERT(pDocument != NULL); |
| 909 | 873 |
| 910 » » CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->G
etInterForm(); | 874 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); |
| 911 » » ASSERT(pInterForm != NULL); | 875 ASSERT(pInterForm != NULL); |
| 912 | 876 |
| 913 » » pInterForm->OnCalculate(pWidget->GetFormField()); | 877 pInterForm->OnCalculate(pWidget->GetFormField()); |
| 914 | 878 |
| 915 //» » bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pW
idget); | 879 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidget); |
| 916 | 880 |
| 917 » » m_bNotifying = FALSE; | 881 m_bNotifying = FALSE; |
| 918 » } | 882 } |
| 919 } | 883 } |
| 920 | 884 |
| 921 void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPage
View, FX_BOOL& bExit, FX_DWORD nFlag) | 885 void CFFL_IFormFiller::OnFormat(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPage
View, FX_BOOL& bExit, FX_DWORD nFlag) |
| 922 { | 886 { |
| 923 » if (!m_bNotifying) | 887 if (!m_bNotifying) |
| 924 » { | 888 { |
| 925 » » ASSERT(pWidget != NULL); | 889 ASSERT(pWidget != NULL); |
| 926 » » ASSERT(pPageView != NULL); | 890 ASSERT(pPageView != NULL); |
| 927 // » » CReader_DocView* pDocView = pPageView->GetDocView(); | 891 // CReader_DocView* pDocView = pPageView->GetDocView(); |
| 928 // » » ASSERT(pDocView != NULL); | 892 // ASSERT(pDocView != NULL); |
| 929 » » CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); | 893 CPDFSDK_Document* pDocument = pPageView->GetSDKDocument(); |
| 930 » » ASSERT(pDocument != NULL); | 894 ASSERT(pDocument != NULL); |
| 931 | 895 |
| 932 » » CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->G
etInterForm(); | 896 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); |
| 933 » » ASSERT(pInterForm != NULL); | 897 ASSERT(pInterForm != NULL); |
| 934 | 898 |
| 935 » » FX_BOOL bFormated = FALSE; | 899 FX_BOOL bFormated = FALSE; |
| 936 » » CFX_WideString sValue = pInterForm->OnFormat(pWidget->GetFormFie
ld(), bFormated); | 900 CFX_WideString sValue = pInterForm->OnFormat(pWidget->GetFormField(), bF
ormated); |
| 937 | 901 |
| 938 //» » bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pW
idget); | 902 // bExit = !IsValidAnnot(m_pApp, pDocument, pDocView, pPageView, pWidget); |
| 939 | 903 |
| 940 » » if (bExit) return; | 904 if (bExit) return; |
| 941 | 905 |
| 942 » » if (bFormated) | 906 if (bFormated) |
| 943 » » { | 907 { |
| 944 » » » pInterForm->ResetFieldAppearance(pWidget->GetFormField()
, sValue.c_str(), TRUE); | 908 pInterForm->ResetFieldAppearance(pWidget->GetFormField(), sValue.c_s
tr(), TRUE); |
| 945 » » » pInterForm->UpdateField(pWidget->GetFormField()); | 909 pInterForm->UpdateField(pWidget->GetFormField()); |
| 946 » » } | 910 } |
| 947 | 911 |
| 948 » » m_bNotifying = FALSE; | 912 m_bNotifying = FALSE; |
| 949 » } | 913 } |
| 950 } | 914 } |
| 951 | 915 |
| 952 void CFFL_IFormFiller::OnClick(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageV
iew, FX_BOOL& bReset, FX_BOOL& bExit, FX_UINT nFlag) | 916 void CFFL_IFormFiller::OnClick(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageV
iew, FX_BOOL& bReset, FX_BOOL& bExit, FX_UINT nFlag) |
| 953 { | 917 { |
| 954 » ASSERT(pWidget != NULL); | 918 ASSERT(pWidget != NULL); |
| 955 | 919 |
| 956 » if (!m_bNotifying) | 920 if (!m_bNotifying) |
| 957 » { | 921 { |
| 958 » » if (pWidget->HasXFAAAction(PDFSDK_XFA_Click)) | 922 if (pWidget->HasXFAAAction(PDFSDK_XFA_Click)) |
| 959 » » { | 923 { |
| 960 » » » m_bNotifying = TRUE; | 924 m_bNotifying = TRUE; |
| 961 » » » int nAge = pWidget->GetAppearanceAge(); | 925 int nAge = pWidget->GetAppearanceAge(); |
| 962 » » » int nValueAge = pWidget->GetValueAge(); | 926 int nValueAge = pWidget->GetValueAge(); |
| 963 | 927 |
| 964 » » » PDFSDK_FieldAction fa; | 928 PDFSDK_FieldAction fa; |
| 965 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 929 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 966 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 930 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 967 | 931 |
| 968 » » » pWidget->OnXFAAAction(PDFSDK_XFA_Click, fa, pPageView); | 932 pWidget->OnXFAAAction(PDFSDK_XFA_Click, fa, pPageView); |
| 969 » » » m_bNotifying = FALSE; | 933 m_bNotifying = FALSE; |
| 970 | 934 |
| 971 » » » if (!IsValidAnnot(pPageView, pWidget)) | 935 if (!IsValidAnnot(pPageView, pWidget)) |
| 972 » » » { | 936 { |
| 973 » » » » bExit = TRUE; | 937 bExit = TRUE; |
| 974 » » » » return; | 938 return; |
| 975 » » » } | 939 } |
| 976 | 940 |
| 977 » » » if (nAge != pWidget->GetAppearanceAge()) | 941 if (nAge != pWidget->GetAppearanceAge()) |
| 978 » » » { | 942 { |
| 979 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller
(pWidget, FALSE)) | 943 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)
) |
| 980 » » » » { | 944 { |
| 981 » » » » » pFormFiller->ResetPDFWindow(pPageView, n
ValueAge == pWidget->GetValueAge()); | 945 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget-
>GetValueAge()); |
| 982 » » » » } | 946 } |
| 983 | 947 |
| 984 » » » » bReset = TRUE; | 948 bReset = TRUE; |
| 985 » » » } | 949 } |
| 986 » » } | 950 } |
| 987 » } | 951 } |
| 988 } | 952 } |
| 989 | 953 |
| 990 void CFFL_IFormFiller::OnFull(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageVi
ew, FX_BOOL& bReset, FX_BOOL& bExit, FX_UINT nFlag) | 954 void CFFL_IFormFiller::OnFull(CPDFSDK_Widget* pWidget, CPDFSDK_PageView* pPageVi
ew, FX_BOOL& bReset, FX_BOOL& bExit, FX_UINT nFlag) |
| 991 { | 955 { |
| 992 » ASSERT(pWidget != NULL); | 956 ASSERT(pWidget != NULL); |
| 993 | 957 |
| 994 » if (!m_bNotifying) | 958 if (!m_bNotifying) |
| 995 » { | 959 { |
| 996 » » if (pWidget->HasXFAAAction(PDFSDK_XFA_Full)) | 960 if (pWidget->HasXFAAAction(PDFSDK_XFA_Full)) |
| 997 » » { | 961 { |
| 998 » » » m_bNotifying = TRUE; | 962 m_bNotifying = TRUE; |
| 999 » » » int nAge = pWidget->GetAppearanceAge(); | 963 int nAge = pWidget->GetAppearanceAge(); |
| 1000 » » » int nValueAge = pWidget->GetValueAge(); | 964 int nValueAge = pWidget->GetValueAge(); |
| 1001 | 965 |
| 1002 » » » PDFSDK_FieldAction fa; | 966 PDFSDK_FieldAction fa; |
| 1003 » » » fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); | 967 fa.bModifier = m_pApp->FFI_IsCTRLKeyDown(nFlag); |
| 1004 » » » fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); | 968 fa.bShift = m_pApp->FFI_IsSHIFTKeyDown(nFlag); |
| 1005 | 969 |
| 1006 » » » pWidget->OnXFAAAction(PDFSDK_XFA_Full, fa, pPageView); | 970 pWidget->OnXFAAAction(PDFSDK_XFA_Full, fa, pPageView); |
| 1007 » » » m_bNotifying = FALSE; | 971 m_bNotifying = FALSE; |
| 1008 | 972 |
| 1009 » » » if (!IsValidAnnot(pPageView, pWidget)) | 973 if (!IsValidAnnot(pPageView, pWidget)) |
| 1010 » » » { | 974 { |
| 1011 » » » » bExit = TRUE; | 975 bExit = TRUE; |
| 1012 » » » » return; | 976 return; |
| 1013 » » » } | 977 } |
| 1014 | 978 |
| 1015 » » » if (nAge != pWidget->GetAppearanceAge()) | 979 if (nAge != pWidget->GetAppearanceAge()) |
| 1016 » » » { | 980 { |
| 1017 » » » » if (CFFL_FormFiller* pFormFiller = GetFormFiller
(pWidget, FALSE)) | 981 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)
) |
| 1018 » » » » { | 982 { |
| 1019 » » » » » pFormFiller->ResetPDFWindow(pPageView, n
ValueAge == pWidget->GetValueAge()); | 983 pFormFiller->ResetPDFWindow(pPageView, nValueAge == pWidget-
>GetValueAge()); |
| 1020 » » » » } | 984 } |
| 1021 | 985 |
| 1022 » » » » bReset = TRUE; | 986 bReset = TRUE; |
| 1023 » » » } | 987 } |
| 1024 » » } | 988 } |
| 1025 » } | 989 } |
| 1026 } | 990 } |
| 1027 | 991 |
| 1028 void CFFL_IFormFiller::OnPopupPreOpen(void* pPrivateData, FX_BOOL& bExit, FX_DWO
RD nFlag) | 992 void CFFL_IFormFiller::OnPopupPreOpen(void* pPrivateData, FX_BOOL& bExit, FX_DWO
RD nFlag) |
| 1029 { | 993 { |
| 1030 ASSERT(pPrivateData != NULL); | 994 ASSERT(pPrivateData != NULL); |
| 1031 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 995 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
| 1032 ASSERT(pData->pWidget != NULL); | 996 ASSERT(pData->pWidget != NULL); |
| 1033 | 997 |
| 1034 FX_BOOL bTempReset = FALSE; | 998 FX_BOOL bTempReset = FALSE; |
| 1035 FX_BOOL bTempExit = FALSE; | 999 FX_BOOL bTempExit = FALSE; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 } | 1092 } |
| 1129 | 1093 |
| 1130 bReset = TRUE; | 1094 bReset = TRUE; |
| 1131 } | 1095 } |
| 1132 } | 1096 } |
| 1133 } | 1097 } |
| 1134 } | 1098 } |
| 1135 | 1099 |
| 1136 FX_BOOL CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Anno
t* pAnnot) | 1100 FX_BOOL CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, CPDFSDK_Anno
t* pAnnot) |
| 1137 { | 1101 { |
| 1102 if(pPageView) |
| 1103 return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot()); |
| 1138 | 1104 |
| 1139 » ASSERT(pPageView != NULL); | 1105 return FALSE; |
| 1140 » ASSERT(pAnnot != NULL); | |
| 1141 | |
| 1142 » if(pPageView) | |
| 1143 » » return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot()); | |
| 1144 » else | |
| 1145 » » return FALSE; | |
| 1146 } | 1106 } |
| 1147 | 1107 |
| 1148 void CFFL_IFormFiller::BeforeUndo(CPDFSDK_Document* pDocument) | 1108 void CFFL_IFormFiller::BeforeUndo(CPDFSDK_Document* pDocument) |
| 1149 { | 1109 { |
| 1150 | 1110 |
| 1151 } | 1111 } |
| 1152 | 1112 |
| 1153 void CFFL_IFormFiller::BeforeRedo(CPDFSDK_Document* pDocument) | 1113 void CFFL_IFormFiller::BeforeRedo(CPDFSDK_Document* pDocument) |
| 1154 { | 1114 { |
| 1155 BeforeUndo(pDocument); | 1115 BeforeUndo(pDocument); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 ASSERT(pPrivateData != NULL); | 1257 ASSERT(pPrivateData != NULL); |
| 1298 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 1258 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
| 1299 ASSERT(pData->pWidget != NULL); | 1259 ASSERT(pData->pWidget != NULL); |
| 1300 | 1260 |
| 1301 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); | 1261 CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); |
| 1302 ASSERT(pFormFiller != NULL); | 1262 ASSERT(pFormFiller != NULL); |
| 1303 | 1263 |
| 1304 if (!bEditOrList) | 1264 if (!bEditOrList) |
| 1305 pFormFiller->OnKeyStroke(bExit); | 1265 pFormFiller->OnKeyStroke(bExit); |
| 1306 } | 1266 } |
| OLD | NEW |