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 | 7 |
8 #include "../../include/formfiller/FFL_FormFiller.h" | 8 #include "../../include/formfiller/FFL_FormFiller.h" |
9 #include "../../include/formfiller/FFL_Notify.h" | 9 #include "../../include/formfiller/FFL_Notify.h" |
10 #include "../../include/formfiller/FFL_CBA_Fontmap.h" | 10 #include "../../include/formfiller/FFL_CBA_Fontmap.h" |
11 | 11 |
12 #define GetRed(rgb)» » » ((uint8_t)(rgb)) | 12 #define GetRed(rgb) ((uint8_t)(rgb)) |
13 #define GetGreen(rgb)» » ((uint8_t)(((FX_WORD)(rgb)) >> 8)) | 13 #define GetGreen(rgb) ((uint8_t)(((FX_WORD)(rgb)) >> 8)) |
14 #define GetBlue(rgb)» » ((uint8_t)((rgb)>>16)) | 14 #define GetBlue(rgb) ((uint8_t)((rgb)>>16)) |
15 | 15 |
16 #define FFL_HINT_ELAPSE»» 800 | 16 #define FFL_HINT_ELAPSE 800 |
17 | 17 |
18 /* ------------------------- CFFL_FormFiller ------------------------- */ | 18 /* ------------------------- CFFL_FormFiller ------------------------- */ |
19 | 19 |
20 CFFL_FormFiller::CFFL_FormFiller(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnno t) | 20 CFFL_FormFiller::CFFL_FormFiller(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnno t) |
21 » :m_pApp(pApp), | 21 :m_pApp(pApp), |
Lei Zhang
2015/07/16 17:05:06
space after ':'
Tom Sepez
2015/07/16 18:01:27
Done.
| |
22 » m_pAnnot(pAnnot), | 22 m_pAnnot(pAnnot), |
Lei Zhang
2015/07/16 17:05:06
nit: indentation
Tom Sepez
2015/07/16 18:01:27
Done.
| |
23 » m_bValid(FALSE), | 23 m_bValid(FALSE), |
24 » m_ptOldPos(0,0) | 24 m_ptOldPos(0,0) |
25 { | 25 { |
26 » m_pWidget = (CPDFSDK_Widget*) pAnnot; | 26 m_pWidget = (CPDFSDK_Widget*) pAnnot; |
27 } | 27 } |
28 | 28 |
29 CFFL_FormFiller::~CFFL_FormFiller() | 29 CFFL_FormFiller::~CFFL_FormFiller() |
30 { | 30 { |
31 for (auto& it : m_Maps) { | 31 for (auto& it : m_Maps) { |
32 CPWL_Wnd* pWnd = it.second; | 32 CPWL_Wnd* pWnd = it.second; |
33 CFFL_PrivateData* pData = (CFFL_PrivateData*)pWnd->GetAttachedData(); | 33 CFFL_PrivateData* pData = (CFFL_PrivateData*)pWnd->GetAttachedData(); |
34 pWnd->Destroy(); | 34 pWnd->Destroy(); |
35 delete pWnd; | 35 delete pWnd; |
36 delete pData; | 36 delete pData; |
37 } | 37 } |
38 m_Maps.clear(); | 38 m_Maps.clear(); |
39 } | 39 } |
40 | 40 |
41 void CFFL_FormFiller::SetWindowRect(CPDFSDK_PageView* pPageView, const CPDF_Rect & rcWindow) | 41 void CFFL_FormFiller::SetWindowRect(CPDFSDK_PageView* pPageView, const CPDF_Rect & rcWindow) |
42 { | 42 { |
43 » if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) | 43 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) |
44 » { | 44 { |
45 » » pWnd->Move(CPDF_Rect(rcWindow), TRUE, FALSE); | 45 pWnd->Move(CPDF_Rect(rcWindow), TRUE, FALSE); |
46 » } | 46 } |
47 } | 47 } |
48 | 48 |
49 CPDF_Rect CFFL_FormFiller::GetWindowRect(CPDFSDK_PageView* pPageView) | 49 CPDF_Rect CFFL_FormFiller::GetWindowRect(CPDFSDK_PageView* pPageView) |
50 { | 50 { |
51 » if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) | 51 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) |
52 » { | 52 { |
53 » » return pWnd->GetWindowRect(); | 53 return pWnd->GetWindowRect(); |
54 » } | 54 } |
55 | 55 |
56 » return CPDF_Rect(0,0,0,0); | 56 return CPDF_Rect(0,0,0,0); |
57 } | 57 } |
58 | 58 |
59 FX_RECT CFFL_FormFiller::GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot) | 59 FX_RECT CFFL_FormFiller::GetViewBBox(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot) |
60 { | 60 { |
61 » ASSERT(pPageView != NULL); | 61 ASSERT(pPageView != NULL); |
62 » ASSERT(pAnnot != NULL); | 62 ASSERT(pAnnot != NULL); |
63 | 63 |
64 » CPDF_Rect rcAnnot = m_pWidget->GetRect(); | 64 CPDF_Rect rcAnnot = m_pWidget->GetRect(); |
65 | 65 |
66 » if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) | 66 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) |
67 » { | 67 { |
68 » » CPDF_Rect rcWindow = pWnd->GetWindowRect(); | 68 CPDF_Rect rcWindow = pWnd->GetWindowRect(); |
69 » » rcAnnot = PWLtoFFL(rcWindow); | 69 rcAnnot = PWLtoFFL(rcWindow); |
70 » } | 70 } |
71 | 71 |
72 » CPDF_Rect rcWin = rcAnnot; | 72 CPDF_Rect rcWin = rcAnnot; |
73 | 73 |
74 » CPDF_Rect rcFocus = GetFocusBox(pPageView); | 74 CPDF_Rect rcFocus = GetFocusBox(pPageView); |
75 » if (!rcFocus.IsEmpty()) | 75 if (!rcFocus.IsEmpty()) |
76 » » rcWin.Union(rcFocus); | 76 rcWin.Union(rcFocus); |
77 | 77 |
78 » CPDF_Rect rect = CPWL_Utils::InflateRect(rcWin,1); | 78 CPDF_Rect rect = CPWL_Utils::InflateRect(rcWin,1); |
79 | 79 |
80 » return rect.GetOutterRect(); | 80 return rect.GetOutterRect(); |
81 } | 81 } |
82 | 82 |
83 void CFFL_FormFiller::OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_A nnot* pAnnot, | 83 void CFFL_FormFiller::OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_A nnot* pAnnot, |
84 » » » » » » CFX_RenderDevice* pDevice, CPDF_ Matrix* pUser2Device, | 84 CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, |
Lei Zhang
2015/07/16 17:05:06
- funny indentation
- remove commented out params?
Tom Sepez
2015/07/16 18:01:27
Yep, also remove commented out parms in header.
| |
85 » » » » » » /*const CRect& rcWindow,*/ FX_DW ORD dwFlags) | 85 /*const CRect& rcWindow,*/ FX_DWORD dwFlags) |
86 { | 86 { |
87 » ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); | 87 ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget"); |
88 | 88 |
89 » if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) | 89 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) |
90 » { | 90 { |
91 » » CPDF_Matrix mt = GetCurMatrix(); | 91 CPDF_Matrix mt = GetCurMatrix(); |
92 » » mt.Concat(*pUser2Device); | 92 mt.Concat(*pUser2Device); |
93 » » pWnd->DrawAppearance(pDevice,&mt); | 93 pWnd->DrawAppearance(pDevice,&mt); |
94 » } | 94 } |
95 » else | 95 else |
96 » { | 96 { |
97 » » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 97 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
98 » » if (CFFL_IFormFiller::IsVisible(pWidget)) | 98 if (CFFL_IFormFiller::IsVisible(pWidget)) |
99 » » » pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Anno t::Normal, NULL); | 99 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, N ULL); |
100 » } | 100 } |
101 } | 101 } |
102 | 102 |
103 void CFFL_FormFiller::OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ C PDFSDK_Annot* pAnnot, | 103 void CFFL_FormFiller::OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ C PDFSDK_Annot* pAnnot, |
104 » » » » » » CFX_RenderDevice* pDevice, CPDF_ Matrix* pUser2Device, | 104 CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device, |
105 » » » » » » /*const CRect& rcWindow,*/ FX_DW ORD dwFlags) | 105 /*const CRect& rcWindow,*/ FX_DWORD dwFlags) |
106 { | 106 { |
107 » ASSERT(pAnnot != NULL); | 107 ASSERT(pAnnot != NULL); |
108 | 108 |
109 » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 109 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
110 | 110 |
111 » pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL) ; | 111 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); |
112 } | 112 } |
113 | 113 |
114 | 114 |
115 void CFFL_FormFiller::OnCreate(CPDFSDK_Annot* pAnnot) | 115 void CFFL_FormFiller::OnCreate(CPDFSDK_Annot* pAnnot) |
116 { | 116 { |
117 } | 117 } |
118 | 118 |
119 void CFFL_FormFiller::OnLoad(CPDFSDK_Annot* pAnnot) | 119 void CFFL_FormFiller::OnLoad(CPDFSDK_Annot* pAnnot) |
120 { | 120 { |
121 } | 121 } |
122 | 122 |
123 void CFFL_FormFiller::OnDelete(CPDFSDK_Annot* pAnnot) | 123 void CFFL_FormFiller::OnDelete(CPDFSDK_Annot* pAnnot) |
124 { | 124 { |
125 } | 125 } |
126 | 126 |
127 void CFFL_FormFiller::OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* p Annot) | 127 void CFFL_FormFiller::OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* p Annot) |
128 { | 128 { |
129 } | 129 } |
130 | 130 |
131 void CFFL_FormFiller::OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pA nnot) | 131 void CFFL_FormFiller::OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pA nnot) |
132 { | 132 { |
133 » EndTimer(); | 133 EndTimer(); |
134 » ASSERT(m_pWidget != NULL); | 134 ASSERT(m_pWidget != NULL); |
135 } | 135 } |
136 | 136 |
137 FX_BOOL CFFL_FormFiller::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Anno t* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 137 FX_BOOL CFFL_FormFiller::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Anno t* pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
138 { | 138 { |
139 » if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, TRUE)) | 139 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, TRUE)) |
140 » { | 140 { |
141 » » m_bValid = TRUE; | 141 m_bValid = TRUE; |
142 » » FX_RECT rect = GetViewBBox(pPageView,pAnnot); | 142 FX_RECT rect = GetViewBBox(pPageView,pAnnot); |
143 » » InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); | 143 InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); |
144 | 144 |
145 » » if(!rect.Contains((int)point.x, (int)point.y)) | 145 if(!rect.Contains((int)point.x, (int)point.y)) |
146 » » » return FALSE; | 146 return FALSE; |
147 | 147 |
148 » » return pWnd->OnLButtonDown(WndtoPWL(pPageView, point),nFlags); | 148 return pWnd->OnLButtonDown(WndtoPWL(pPageView, point),nFlags); |
149 » } | 149 } |
150 | 150 |
151 » return FALSE; | 151 return FALSE; |
152 } | 152 } |
153 | 153 |
154 FX_BOOL»CFFL_FormFiller::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 154 FX_BOOL CFFL_FormFiller::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
155 { | 155 { |
156 » if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) | 156 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) |
157 » { | 157 { |
158 » » FX_RECT rcFFL = GetViewBBox(pPageView, pAnnot); | 158 FX_RECT rcFFL = GetViewBBox(pPageView, pAnnot); |
159 » » InvalidateRect(rcFFL.left, rcFFL.top, rcFFL.right, rcFFL.bottom) ; | 159 InvalidateRect(rcFFL.left, rcFFL.top, rcFFL.right, rcFFL.bottom); |
160 » » pWnd->OnLButtonUp(WndtoPWL(pPageView, point),nFlags); | 160 pWnd->OnLButtonUp(WndtoPWL(pPageView, point),nFlags); |
161 » » return TRUE; | 161 return TRUE; |
162 » } | 162 } |
163 | 163 |
164 » return FALSE; | 164 return FALSE; |
165 } | 165 } |
166 | 166 |
167 FX_BOOL»CFFL_FormFiller::OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_An not* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 167 FX_BOOL CFFL_FormFiller::OnLButtonDblClk(CPDFSDK_PageView *pPageView, CPDFSDK_An not* pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
168 { | 168 { |
169 » if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) | 169 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) |
170 » { | 170 { |
171 » » pWnd->OnLButtonDblClk(WndtoPWL(pPageView, point),nFlags); | 171 pWnd->OnLButtonDblClk(WndtoPWL(pPageView, point),nFlags); |
172 » » return TRUE; | 172 return TRUE; |
173 » } | 173 } |
174 | 174 |
175 » return FALSE; | 175 return FALSE; |
176 } | 176 } |
177 | 177 |
178 FX_BOOL CFFL_FormFiller::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 178 FX_BOOL CFFL_FormFiller::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
179 { | 179 { |
180 » if ((m_ptOldPos.x != point.x) || (m_ptOldPos.y != point.y)) | 180 if ((m_ptOldPos.x != point.x) || (m_ptOldPos.y != point.y)) |
181 » { | 181 { |
182 » » m_ptOldPos = point; | 182 m_ptOldPos = point; |
183 » } | 183 } |
184 | 184 |
185 » if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) | 185 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) |
186 » { | 186 { |
187 » » pWnd->OnMouseMove(WndtoPWL(pPageView, point),nFlags); | 187 pWnd->OnMouseMove(WndtoPWL(pPageView, point),nFlags); |
188 » » return TRUE; | 188 return TRUE; |
189 » } | 189 } |
190 | 190 |
191 » return FALSE; | 191 return FALSE; |
192 } | 192 } |
193 | 193 |
194 FX_BOOL CFFL_FormFiller::OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot * pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point) | 194 FX_BOOL CFFL_FormFiller::OnMouseWheel(CPDFSDK_PageView *pPageView, CPDFSDK_Annot * pAnnot, FX_UINT nFlags, short zDelta, const CPDF_Point& point) |
195 { | 195 { |
196 » if (!IsValid()) return FALSE; | 196 if (!IsValid()) return FALSE; |
197 | 197 |
198 » if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, TRUE)) | 198 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, TRUE)) |
199 » { | 199 { |
200 » » return pWnd->OnMouseWheel(zDelta, WndtoPWL(pPageView, point),nFl ags); | 200 return pWnd->OnMouseWheel(zDelta, WndtoPWL(pPageView, point),nFlags); |
201 » } | 201 } |
202 | 202 |
203 » return FALSE; | 203 return FALSE; |
204 } | 204 } |
205 | 205 |
206 FX_BOOL CFFL_FormFiller::OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Anno t* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 206 FX_BOOL CFFL_FormFiller::OnRButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Anno t* pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
207 { | 207 { |
208 » if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, TRUE)) | 208 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, TRUE)) |
209 » { | 209 { |
210 » » pWnd->OnRButtonDown(WndtoPWL(pPageView, point),nFlags); | 210 pWnd->OnRButtonDown(WndtoPWL(pPageView, point),nFlags); |
211 » » return TRUE; | 211 return TRUE; |
212 » } | 212 } |
213 | 213 |
214 » return FALSE; | 214 return FALSE; |
215 } | 215 } |
216 | 216 |
217 FX_BOOL»CFFL_FormFiller::OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) | 217 FX_BOOL CFFL_FormFiller::OnRButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot, FX_UINT nFlags, const CPDF_Point& point) |
218 { | 218 { |
219 » if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) | 219 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) |
220 » { | 220 { |
221 » » pWnd->OnRButtonUp(WndtoPWL(pPageView, point),nFlags); | 221 pWnd->OnRButtonUp(WndtoPWL(pPageView, point),nFlags); |
222 » » return TRUE; | 222 return TRUE; |
223 » } | 223 } |
224 | 224 |
225 » return FALSE; | 225 return FALSE; |
226 } | 226 } |
227 | 227 |
228 FX_BOOL CFFL_FormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_U INT nFlags) | 228 FX_BOOL CFFL_FormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, FX_UINT nKeyCode, FX_U INT nFlags) |
229 { | 229 { |
230 » if (IsValid()) | 230 if (IsValid()) |
231 » { | 231 { |
232 » » CPDFSDK_PageView* pPageView = GetCurPageView(); | 232 CPDFSDK_PageView* pPageView = GetCurPageView(); |
233 » » ASSERT(pPageView != NULL); | 233 ASSERT(pPageView != NULL); |
234 | 234 |
235 » » if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) | 235 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) |
236 » » { | 236 { |
237 » » » return pWnd->OnKeyDown(nKeyCode,nFlags); | 237 return pWnd->OnKeyDown(nKeyCode,nFlags); |
238 » » } | 238 } |
239 » } | 239 } |
240 | 240 |
241 » return FALSE; | 241 return FALSE; |
242 } | 242 } |
243 | 243 |
244 FX_BOOL»CFFL_FormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nF lags) | 244 FX_BOOL CFFL_FormFiller::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nF lags) |
245 { | 245 { |
246 » if (IsValid()) | 246 if (IsValid()) |
247 » { | 247 { |
248 » » CPDFSDK_PageView* pPageView = GetCurPageView(); | 248 CPDFSDK_PageView* pPageView = GetCurPageView(); |
249 » » ASSERT(pPageView != NULL); | 249 ASSERT(pPageView != NULL); |
250 | 250 |
251 » » if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) | 251 if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) |
252 » » { | 252 { |
253 » » » return pWnd->OnChar(nChar,nFlags); | 253 return pWnd->OnChar(nChar,nFlags); |
254 » » } | 254 } |
255 » } | 255 } |
256 | 256 |
257 » return FALSE; | 257 return FALSE; |
258 } | 258 } |
259 | 259 |
260 FX_BOOL»CFFL_FormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) | 260 FX_BOOL CFFL_FormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) |
261 { | 261 { |
262 » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 262 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
263 | 263 CPDF_Page* pPage = pWidget->GetPDFPage(); |
264 » CPDF_Page * pPage = pWidget->GetPDFPage(); | 264 CPDFSDK_Document* pDoc = m_pApp->GetSDKDocument(); |
265 » CPDFSDK_Document * pDoc = m_pApp->GetCurrentDoc(); | 265 CPDFSDK_PageView* pPageView = pDoc->GetPageView(pPage); |
266 » CPDFSDK_PageView* pPageView = pDoc->GetPageView(pPage); | 266 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, TRUE)) |
267 » ASSERT(pPageView != NULL); | 267 pWnd->SetFocus(); |
268 | 268 |
269 » CPWL_Wnd * pWnd = NULL; | 269 m_bValid = TRUE; |
270 » if ( (pWnd = GetPDFWindow(pPageView, TRUE))) | 270 FX_RECT rcRect = GetViewBBox(pPageView,pAnnot); |
271 » { | 271 InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); |
272 » » pWnd->SetFocus(); | 272 return TRUE; |
273 » } | 273 } |
274 | 274 |
275 » m_bValid = TRUE; | 275 FX_BOOL CFFL_FormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) |
276 » FX_RECT rcRect = GetViewBBox(pPageView,pAnnot); | 276 { |
277 » InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); | 277 if (!IsValid()) |
278 | 278 return TRUE; |
279 » return TRUE; | 279 |
280 } | 280 CPDFSDK_PageView* pPageView = GetCurPageView(); |
281 | 281 CommitData(pPageView, nFlag); |
282 FX_BOOL»CFFL_FormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) | 282 |
283 { | 283 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) |
284 » if (IsValid()) | 284 pWnd->KillFocus(); |
285 » { | 285 |
286 » » CPDFSDK_PageView* pPageView = GetCurPageView(); | 286 switch (m_pWidget->GetFieldType()) |
287 » » ASSERT(pPageView != NULL); | 287 { |
288 | 288 case FIELDTYPE_PUSHBUTTON: |
289 » » CommitData(pPageView, nFlag); | 289 case FIELDTYPE_CHECKBOX: |
290 | 290 case FIELDTYPE_RADIOBUTTON: |
291 » » if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) | 291 EscapeFiller(pPageView, TRUE); |
292 » » { | 292 break; |
293 » » » pWnd->KillFocus(); | 293 default: |
294 » » } | 294 EscapeFiller(pPageView, FALSE); |
295 | 295 break; |
296 » » switch (m_pWidget->GetFieldType()) | 296 } |
297 » » { | 297 return TRUE; |
298 » » case FIELDTYPE_PUSHBUTTON: | 298 } |
299 » » case FIELDTYPE_CHECKBOX: | 299 |
300 » » case FIELDTYPE_RADIOBUTTON: | 300 FX_BOOL CFFL_FormFiller::IsValid() const |
301 » » » EscapeFiller(pPageView, TRUE); | 301 { |
302 » » » break; | 302 return m_bValid; |
303 » » default: | 303 } |
304 » » » EscapeFiller(pPageView, FALSE); | 304 |
305 » » » break; | 305 PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() |
306 » » } | 306 { |
307 » } | 307 ASSERT(m_pApp != NULL); |
308 | 308 |
309 » return TRUE; | 309 PWL_CREATEPARAM cp; |
310 } | 310 |
311 | 311 cp.pParentWnd = NULL; |
312 FX_BOOL»CFFL_FormFiller::IsValid() const | 312 cp.pProvider = this; |
313 { | 313 cp.rcRectWnd = GetPDFWindowRect(); |
314 » return m_bValid; | 314 |
315 } | 315 FX_DWORD dwCreateFlags = PWS_BORDER | PWS_BACKGROUND | PWS_VISIBLE; |
316 | 316 |
317 PWL_CREATEPARAM»CFFL_FormFiller::GetCreateParam() | 317 ASSERT(m_pWidget != NULL); |
Lei Zhang
2015/07/16 17:05:06
remove
| |
318 { | 318 |
319 » ASSERT(m_pApp != NULL); | 319 |
320 | 320 FX_DWORD dwFieldFlag = m_pWidget->GetFieldFlags(); |
321 » PWL_CREATEPARAM cp; | 321 |
322 | 322 if (dwFieldFlag & FIELDFLAG_READONLY) |
323 » cp.pParentWnd = NULL; | 323 { |
324 » cp.pProvider = this; | 324 dwCreateFlags |= PWS_READONLY; |
325 » cp.rcRectWnd = GetPDFWindowRect(); | 325 } |
326 | 326 |
327 » FX_DWORD dwCreateFlags = PWS_BORDER | PWS_BACKGROUND | PWS_VISIBLE; | 327 FX_COLORREF color; |
328 | 328 if (m_pWidget->GetFillColor(color)) |
329 » ASSERT(m_pWidget != NULL); | 329 { |
330 | 330 cp.sBackgroundColor = CPWL_Color(GetRed(color), GetGreen(color), GetBlue (color)); |
331 | 331 } |
332 » FX_DWORD dwFieldFlag = m_pWidget->GetFieldFlags(); | 332 |
333 | 333 if (m_pWidget->GetBorderColor(color)) |
334 » if (dwFieldFlag & FIELDFLAG_READONLY) | 334 { |
335 » { | 335 cp.sBorderColor = CPWL_Color(GetRed(color), GetGreen(color), GetBlue(col or)); |
336 » » dwCreateFlags |= PWS_READONLY; | 336 } |
337 » } | 337 |
338 | 338 cp.sTextColor = CPWL_Color(COLORTYPE_GRAY,0); |
339 » FX_COLORREF color; | 339 |
340 » if (m_pWidget->GetFillColor(color)) | 340 if (m_pWidget->GetTextColor(color)) |
341 » { | 341 { |
342 » » cp.sBackgroundColor = CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color)); | 342 cp.sTextColor = CPWL_Color(GetRed(color), GetGreen(color), GetBlue(color )); |
343 » } | 343 } |
344 | 344 |
345 » if (m_pWidget->GetBorderColor(color)) | 345 cp.fFontSize = m_pWidget->GetFontSize(); |
346 » { | 346 cp.dwBorderWidth = m_pWidget->GetBorderWidth(); |
347 » » cp.sBorderColor = CPWL_Color(GetRed(color), GetGreen(color), Get Blue(color)); | 347 |
348 » } | 348 int nBorderStyle = m_pWidget->GetBorderStyle(); |
349 | 349 |
350 » cp.sTextColor = CPWL_Color(COLORTYPE_GRAY,0); | 350 switch (nBorderStyle) |
351 | 351 { |
352 » if (m_pWidget->GetTextColor(color)) | 352 case BBS_SOLID: |
353 » { | 353 cp.nBorderStyle = PBS_SOLID; |
354 » » cp.sTextColor = CPWL_Color(GetRed(color), GetGreen(color), GetBl ue(color)); | 354 break; |
355 » } | 355 case BBS_DASH: |
356 | 356 cp.nBorderStyle = PBS_DASH; |
357 » cp.fFontSize = m_pWidget->GetFontSize(); | 357 cp.sDash = CPWL_Dash(3,3,0); |
358 » cp.dwBorderWidth = m_pWidget->GetBorderWidth(); | 358 break; |
359 | 359 case BBS_BEVELED: |
360 » int nBorderStyle = m_pWidget->GetBorderStyle(); | 360 cp.nBorderStyle = PBS_BEVELED; |
361 | 361 cp.dwBorderWidth *= 2; |
362 » switch (nBorderStyle) | 362 break; |
363 » { | 363 case BBS_INSET: |
364 » case BBS_SOLID: | 364 cp.nBorderStyle = PBS_INSET; |
365 » » cp.nBorderStyle = PBS_SOLID; | 365 cp.dwBorderWidth *= 2; |
366 » » break; | 366 break; |
367 » case BBS_DASH: | 367 case BBS_UNDERLINE: |
368 » » cp.nBorderStyle = PBS_DASH; | 368 cp.nBorderStyle = PBS_UNDERLINED; |
369 » » cp.sDash = CPWL_Dash(3,3,0); | 369 break; |
370 » » break; | 370 } |
371 » case BBS_BEVELED: | 371 |
372 » » cp.nBorderStyle = PBS_BEVELED; | 372 if (cp.fFontSize <= 0) |
373 » » cp.dwBorderWidth *= 2; | 373 { |
374 » » break; | 374 dwCreateFlags |= PWS_AUTOFONTSIZE; |
375 » case BBS_INSET: | 375 } |
376 » » cp.nBorderStyle = PBS_INSET; | 376 |
377 » » cp.dwBorderWidth *= 2; | 377 cp.dwFlags = dwCreateFlags; |
378 » » break; | 378 cp.pSystemHandler = m_pApp->GetSysHandler(); |
379 » case BBS_UNDERLINE: | 379 return cp; |
380 » » cp.nBorderStyle = PBS_UNDERLINED; | |
381 » » break; | |
382 » } | |
383 | |
384 » if (cp.fFontSize <= 0) | |
385 » { | |
386 » » dwCreateFlags |= PWS_AUTOFONTSIZE; | |
387 » } | |
388 | |
389 » cp.dwFlags = dwCreateFlags; | |
390 » cp.pSystemHandler = m_pApp->GetSysHandler(); | |
391 » return cp; | |
392 } | 380 } |
393 | 381 |
394 CPWL_Wnd* CFFL_FormFiller::GetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bNe w) | 382 CPWL_Wnd* CFFL_FormFiller::GetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bNe w) |
395 { | 383 { |
396 ASSERT(pPageView); | 384 ASSERT(pPageView); |
397 | 385 |
398 auto it = m_Maps.find(pPageView); | 386 auto it = m_Maps.find(pPageView); |
399 const bool found = it != m_Maps.end(); | 387 const bool found = it != m_Maps.end(); |
400 CPWL_Wnd* pWnd = found ? it->second : nullptr; | 388 CPWL_Wnd* pWnd = found ? it->second : nullptr; |
401 if (!bNew) | 389 if (!bNew) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
435 | 423 |
436 CPWL_Wnd* pWnd = it->second; | 424 CPWL_Wnd* pWnd = it->second; |
437 CFFL_PrivateData* pData = (CFFL_PrivateData*)pWnd->GetAttachedData(); | 425 CFFL_PrivateData* pData = (CFFL_PrivateData*)pWnd->GetAttachedData(); |
438 pWnd->Destroy(); | 426 pWnd->Destroy(); |
439 delete pWnd; | 427 delete pWnd; |
440 delete pData; | 428 delete pData; |
441 | 429 |
442 m_Maps.erase(it); | 430 m_Maps.erase(it); |
443 } | 431 } |
444 | 432 |
445 CPDF_Matrix» CFFL_FormFiller::GetWindowMatrix(void* pAttachedData) | 433 CPDF_Matrix CFFL_FormFiller::GetWindowMatrix(void* pAttachedData) |
446 { | 434 { |
447 » if (CFFL_PrivateData* pPrivateData = (CFFL_PrivateData*)pAttachedData) | 435 if (CFFL_PrivateData* pPrivateData = (CFFL_PrivateData*)pAttachedData) |
448 » { | 436 { |
449 » » if (pPrivateData->pPageView) | 437 if (pPrivateData->pPageView) |
450 » » { | 438 { |
451 » » » CPDF_Matrix mtPageView; | 439 CPDF_Matrix mtPageView; |
452 » » » pPrivateData->pPageView->GetCurrentMatrix(mtPageView); | 440 pPrivateData->pPageView->GetCurrentMatrix(mtPageView); |
453 » » » CPDF_Matrix mt = GetCurMatrix(); | 441 CPDF_Matrix mt = GetCurMatrix(); |
454 » » » mt.Concat(mtPageView); | 442 mt.Concat(mtPageView); |
455 | 443 |
456 » » » return mt; | 444 return mt; |
457 » » } | 445 } |
458 » } | 446 } |
459 » return CPDF_Matrix(1,0,0,1,0,0); | 447 return CPDF_Matrix(1,0,0,1,0,0); |
460 } | 448 } |
461 | 449 |
462 CPDF_Matrix» CFFL_FormFiller::GetCurMatrix() | 450 CPDF_Matrix CFFL_FormFiller::GetCurMatrix() |
463 { | 451 { |
464 » CPDF_Matrix mt; | 452 CPDF_Matrix mt; |
465 | 453 |
466 » ASSERT(m_pWidget != NULL); | 454 ASSERT(m_pWidget != NULL); |
467 | 455 |
468 » CPDF_Rect rcDA ; | 456 CPDF_Rect rcDA ; |
469 » m_pWidget->GetPDFAnnot()->GetRect(rcDA); | 457 m_pWidget->GetPDFAnnot()->GetRect(rcDA); |
470 | 458 |
471 | 459 |
472 » switch (m_pWidget->GetRotate()) | 460 switch (m_pWidget->GetRotate()) |
473 » { | 461 { |
474 » default: | 462 default: |
475 » case 0: | 463 case 0: |
476 » » mt = CPDF_Matrix(1,0,0,1,0,0); | 464 mt = CPDF_Matrix(1,0,0,1,0,0); |
477 » » break; | 465 break; |
478 » case 90: | 466 case 90: |
479 » » mt = CPDF_Matrix(0,1,-1,0,rcDA.right - rcDA.left,0); | 467 mt = CPDF_Matrix(0,1,-1,0,rcDA.right - rcDA.left,0); |
480 » » break; | 468 break; |
481 » case 180: | 469 case 180: |
482 » » mt = CPDF_Matrix(-1,0,0,-1,rcDA.right - rcDA.left,rcDA.top - rcD A.bottom); | 470 mt = CPDF_Matrix(-1,0,0,-1,rcDA.right - rcDA.left,rcDA.top - rcDA.bottom ); |
483 » » break; | 471 break; |
484 » case 270: | 472 case 270: |
485 » » mt = CPDF_Matrix(0,-1,1,0,0,rcDA.top - rcDA.bottom); | 473 mt = CPDF_Matrix(0,-1,1,0,0,rcDA.top - rcDA.bottom); |
486 » » break; | 474 break; |
487 » } | 475 } |
488 » mt.e += rcDA.left; | 476 mt.e += rcDA.left; |
489 » mt.f += rcDA.bottom; | 477 mt.f += rcDA.bottom; |
490 | 478 |
491 » return mt; | 479 return mt; |
492 } | 480 } |
493 | 481 |
494 CFX_WideString CFFL_FormFiller::LoadPopupMenuString(int nIndex) | 482 CFX_WideString CFFL_FormFiller::LoadPopupMenuString(int nIndex) |
495 { | 483 { |
496 » ASSERT(m_pApp != NULL); | 484 ASSERT(m_pApp != NULL); |
497 | 485 |
498 » return L""; | 486 return L""; |
499 } | 487 } |
500 | 488 |
501 CPDF_Rect CFFL_FormFiller::GetPDFWindowRect() const | 489 CPDF_Rect CFFL_FormFiller::GetPDFWindowRect() const |
502 { | 490 { |
503 » ASSERT(m_pWidget != NULL); | 491 ASSERT(m_pWidget != NULL); |
Lei Zhang
2015/07/16 17:05:05
remove
| |
504 | 492 |
505 » CPDF_Rect rectAnnot; | 493 CPDF_Rect rectAnnot; |
506 » m_pWidget->GetPDFAnnot()->GetRect(rectAnnot); | 494 m_pWidget->GetPDFAnnot()->GetRect(rectAnnot); |
507 | 495 |
508 » FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left; | 496 FX_FLOAT fWidth = rectAnnot.right - rectAnnot.left; |
509 » FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom; | 497 FX_FLOAT fHeight = rectAnnot.top - rectAnnot.bottom; |
510 | 498 |
511 | 499 |
512 » if ((m_pWidget->GetRotate() / 90) & 0x01) | 500 if ((m_pWidget->GetRotate() / 90) & 0x01) |
513 » » return CPDF_Rect(0,0,fHeight,fWidth); | 501 return CPDF_Rect(0,0,fHeight,fWidth); |
514 » else | 502 else |
Tom Sepez
2015/07/16 18:01:28
note: else after return removed here too.
| |
515 » » return CPDF_Rect(0,0,fWidth,fHeight); | 503 return CPDF_Rect(0,0,fWidth,fHeight); |
516 } | 504 } |
517 | 505 |
518 CPDFSDK_PageView* CFFL_FormFiller::GetCurPageView() | 506 CPDFSDK_PageView* CFFL_FormFiller::GetCurPageView() |
519 { | 507 { |
520 | 508 CPDF_Page* pPage = m_pAnnot->GetPDFPage(); |
521 » CPDF_Page* pPage = m_pAnnot->GetPDFPage(); | 509 CPDFSDK_Document* pSDKDoc = m_pApp->GetSDKDocument(); |
522 » CPDFSDK_Document* pSDKDoc = m_pApp->GetCurrentDoc(); | 510 return pSDKDoc ? pSDKDoc->GetPageView(pPage) : nullptr; |
523 » if(pSDKDoc) | |
524 » { | |
525 » » return pSDKDoc->GetPageView(pPage); | |
526 » } | |
527 » return NULL; | |
528 } | 511 } |
529 | 512 |
530 CPDF_Rect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView) | 513 CPDF_Rect CFFL_FormFiller::GetFocusBox(CPDFSDK_PageView* pPageView) |
531 { | 514 { |
532 » if (CPWL_Wnd * pWnd = GetPDFWindow(pPageView, FALSE)) | 515 if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) |
533 » { | 516 { |
534 » » CPDF_Rect rcFocus = FFLtoWnd(pPageView, PWLtoFFL(pWnd->GetFocus Rect())); | 517 CPDF_Rect rcFocus = FFLtoWnd(pPageView, PWLtoFFL(pWnd->GetFocusRect())); |
535 » » ASSERT(pPageView); | 518 CPDF_Rect rcPage = pPageView->GetPDFPage()->GetPageBBox(); |
536 » » CPDF_Rect rcPage = pPageView->GetPDFPage()->GetPageBBox(); | 519 if (rcPage.Contains(rcFocus)) |
537 » » if(rcPage.Contains(rcFocus)) | 520 return rcFocus; |
538 » » » return rcFocus; | 521 } |
539 » » else | 522 return CPDF_Rect(0,0,0,0); |
540 » » » return CPDF_Rect(0,0,0,0); | |
541 » } | |
542 » return CPDF_Rect(0,0,0,0); | |
543 } | 523 } |
544 | 524 |
545 CPDF_Rect CFFL_FormFiller::FFLtoPWL(const CPDF_Rect& rect) | 525 CPDF_Rect CFFL_FormFiller::FFLtoPWL(const CPDF_Rect& rect) |
546 { | 526 { |
547 » CPDF_Matrix mt; | 527 CPDF_Matrix mt; |
548 » mt.SetReverse(GetCurMatrix()); | 528 mt.SetReverse(GetCurMatrix()); |
549 | 529 |
550 » CPDF_Rect temp = rect; | 530 CPDF_Rect temp = rect; |
551 » mt.TransformRect(temp); | 531 mt.TransformRect(temp); |
552 | 532 |
553 » return temp; | 533 return temp; |
554 } | 534 } |
555 | 535 |
556 CPDF_Rect CFFL_FormFiller::PWLtoFFL(const CPDF_Rect& rect) | 536 CPDF_Rect CFFL_FormFiller::PWLtoFFL(const CPDF_Rect& rect) |
557 { | 537 { |
558 » CPDF_Matrix mt = GetCurMatrix(); | 538 CPDF_Matrix mt = GetCurMatrix(); |
559 | 539 |
560 » CPDF_Rect temp = rect; | 540 CPDF_Rect temp = rect; |
561 » mt.TransformRect(temp); | 541 mt.TransformRect(temp); |
562 | 542 |
563 » return temp; | 543 return temp; |
564 } | 544 } |
565 | 545 |
566 CPDF_Point CFFL_FormFiller::FFLtoPWL(const CPDF_Point& point) | 546 CPDF_Point CFFL_FormFiller::FFLtoPWL(const CPDF_Point& point) |
567 { | 547 { |
568 » CPDF_Matrix mt; | 548 CPDF_Matrix mt; |
569 » mt.SetReverse(GetCurMatrix()); | 549 mt.SetReverse(GetCurMatrix()); |
570 | 550 |
571 » CPDF_Point pt = point; | 551 CPDF_Point pt = point; |
572 » mt.Transform(pt.x,pt.y); | 552 mt.Transform(pt.x,pt.y); |
573 | 553 |
574 » return pt; | 554 return pt; |
575 } | 555 } |
576 | 556 |
577 CPDF_Point CFFL_FormFiller::PWLtoFFL(const CPDF_Point & point) | 557 CPDF_Point CFFL_FormFiller::PWLtoFFL(const CPDF_Point & point) |
578 { | 558 { |
579 » CPDF_Matrix mt = GetCurMatrix(); | 559 CPDF_Matrix mt = GetCurMatrix(); |
580 | 560 |
581 » CPDF_Point pt = point; | 561 CPDF_Point pt = point; |
582 » mt.Transform(pt.x,pt.y); | 562 mt.Transform(pt.x,pt.y); |
583 | 563 |
584 » return pt; | 564 return pt; |
585 } | 565 } |
586 | 566 |
587 CPDF_Point CFFL_FormFiller::WndtoPWL(CPDFSDK_PageView* pPageView, const CPDF_Poi nt& pt) | 567 CPDF_Point CFFL_FormFiller::WndtoPWL(CPDFSDK_PageView* pPageView, const CPDF_Poi nt& pt) |
588 { | 568 { |
589 // » ASSERT(pPageView != NULL); | 569 // ASSERT(pPageView != NULL); |
Lei Zhang
2015/07/16 17:05:06
remove commented out code
Tom Sepez
2015/07/16 18:01:27
Done.
| |
590 // | 570 // |
591 // » CPDF_Point point(0.0f, 0.0f); | 571 // CPDF_Point point(0.0f, 0.0f); |
592 // » pPageView->WindowToDoc(pt.x, pt.y, point.x, point.y); | 572 // pPageView->WindowToDoc(pt.x, pt.y, point.x, point.y); |
593 // | 573 // |
594 » return FFLtoPWL(pt); | 574 return FFLtoPWL(pt); |
595 //» return CPDF_Point(0, 0); | 575 // return CPDF_Point(0, 0); |
596 } | 576 } |
597 | 577 |
598 CPDF_Rect CFFL_FormFiller::FFLtoWnd(CPDFSDK_PageView* pPageView, const CPDF_Rect & rect) | 578 CPDF_Rect CFFL_FormFiller::FFLtoWnd(CPDFSDK_PageView* pPageView, const CPDF_Rect & rect) |
599 { | 579 { |
600 // » FX_RECT rcRet(0,0,0,0); | 580 // FX_RECT rcRet(0,0,0,0); |
Lei Zhang
2015/07/16 17:05:05
remove commented out code
Tom Sepez
2015/07/16 18:01:28
Done.
| |
601 // | 581 // |
602 // » ASSERT(pPageView != NULL); | 582 // ASSERT(pPageView != NULL); |
603 // » pPageView->DocToWindow(rect, rcRet); | 583 // pPageView->DocToWindow(rect, rcRet); |
604 // | 584 // |
605 » return rect; | 585 return rect; |
606 | 586 |
607 } | 587 } |
608 | 588 |
609 void CFFL_FormFiller::FFL_FreeData(void* pData) | 589 void CFFL_FormFiller::FFL_FreeData(void* pData) |
Lei Zhang
2015/07/16 17:05:05
This is dead code.
Tom Sepez
2015/07/16 18:01:27
removed and also in header.
| |
610 { | 590 { |
611 » ASSERT(pData != NULL); | 591 ASSERT(pData != NULL); |
612 | 592 |
613 » delete (CFFL_PrivateData*)pData; | 593 delete (CFFL_PrivateData*)pData; |
614 } | 594 } |
615 | 595 |
616 FX_BOOL CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, FX_UINT nFlag) | 596 FX_BOOL CFFL_FormFiller::CommitData(CPDFSDK_PageView* pPageView, FX_UINT nFlag) |
617 { | 597 { |
618 » if (IsDataChanged(pPageView)) | 598 if (IsDataChanged(pPageView)) |
619 » { | 599 { |
620 » » //CFFL_IFormFiller* pIFormFiller = CFFL_Module::GetFormFiller(m_ pApp); | 600 //CFFL_IFormFiller* pIFormFiller = CFFL_Module::GetFormFiller(m_pApp); |
Lei Zhang
2015/07/16 17:05:06
remove
| |
621 » » CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller();//NULL ; | 601 CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller();//NULL; |
622 » » ASSERT(pIFormFiller != NULL); | 602 ASSERT(pIFormFiller != NULL); |
Lei Zhang
2015/07/16 17:05:05
remove
| |
623 | 603 |
624 » » FX_BOOL bRC = TRUE; | 604 FX_BOOL bRC = TRUE; |
625 » » FX_BOOL bExit = FALSE; | 605 FX_BOOL bExit = FALSE; |
626 | 606 |
627 » » pIFormFiller->OnKeyStrokeCommit(m_pWidget, pPageView, bRC, bExit , nFlag); | 607 pIFormFiller->OnKeyStrokeCommit(m_pWidget, pPageView, bRC, bExit, nFlag) ; |
628 » » if (bExit) return TRUE; | 608 if (bExit) return TRUE; |
629 » » if (!bRC) | 609 if (!bRC) |
630 » » { | 610 { |
631 » » » ResetPDFWindow(pPageView, FALSE); | 611 ResetPDFWindow(pPageView, FALSE); |
632 » » » return TRUE; | 612 return TRUE; |
633 » » } | 613 } |
634 | 614 |
635 » » pIFormFiller->OnValidate(m_pWidget, pPageView, bRC, bExit, nFlag ); | 615 pIFormFiller->OnValidate(m_pWidget, pPageView, bRC, bExit, nFlag); |
636 » » if (bExit) return TRUE; | 616 if (bExit) return TRUE; |
637 » » if (!bRC) | 617 if (!bRC) |
638 » » { | 618 { |
639 » » » ResetPDFWindow(pPageView, FALSE); | 619 ResetPDFWindow(pPageView, FALSE); |
640 » » » return TRUE; | 620 return TRUE; |
641 » » } | 621 } |
642 | 622 |
643 » » SaveData(pPageView); | 623 SaveData(pPageView); |
644 | 624 |
645 » » pIFormFiller->OnCalculate(m_pWidget, pPageView, bExit,nFlag); | 625 pIFormFiller->OnCalculate(m_pWidget, pPageView, bExit,nFlag); |
646 » » if (bExit) return TRUE; | 626 if (bExit) return TRUE; |
647 | 627 |
648 » » pIFormFiller->OnFormat(m_pWidget, pPageView, bExit,nFlag); | 628 pIFormFiller->OnFormat(m_pWidget, pPageView, bExit,nFlag); |
649 » } | 629 } |
650 | 630 |
651 » return TRUE; | 631 return TRUE; |
652 } | 632 } |
653 | 633 |
654 FX_BOOL»CFFL_FormFiller::IsDataChanged(CPDFSDK_PageView* pPageView) | 634 FX_BOOL CFFL_FormFiller::IsDataChanged(CPDFSDK_PageView* pPageView) |
655 { | 635 { |
656 » return FALSE; | 636 return FALSE; |
657 } | 637 } |
658 | 638 |
659 void CFFL_FormFiller::SaveData(CPDFSDK_PageView* pPageView) | 639 void CFFL_FormFiller::SaveData(CPDFSDK_PageView* pPageView) |
660 { | 640 { |
661 } | 641 } |
662 | 642 |
663 void CFFL_FormFiller::GetKeyStrokeData(CPDFSDK_PageView* pPageView, FFL_KeyStrok eData& data) | 643 void CFFL_FormFiller::GetKeyStrokeData(CPDFSDK_PageView* pPageView, FFL_KeyStrok eData& data) |
664 { | 644 { |
665 } | 645 } |
666 | 646 |
667 void CFFL_FormFiller::SetChangeMark() | 647 void CFFL_FormFiller::SetChangeMark() |
668 { | 648 { |
669 » m_pApp->FFI_OnChange(); | 649 m_pApp->FFI_OnChange(); |
670 } | 650 } |
671 | 651 |
672 void CFFL_FormFiller::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::A ActionType type, | 652 void CFFL_FormFiller::GetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::A ActionType type, |
673 » » » » » » » PDFSDK_FieldAction& fa) | 653 PDFSDK_FieldAction& fa) |
674 { | 654 { |
675 » fa.sValue = m_pWidget->GetValue(); | 655 fa.sValue = m_pWidget->GetValue(); |
676 } | 656 } |
677 | 657 |
678 void CFFL_FormFiller::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::A ActionType type, | 658 void CFFL_FormFiller::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::A ActionType type, |
679 » » » » » » » » » const PD FSDK_FieldAction& fa) | 659 const PDFSDK_FieldAction& fa) |
680 { | 660 { |
681 } | 661 } |
682 | 662 |
683 FX_BOOL»CFFL_FormFiller::IsActionDataChanged(CPDF_AAction::AActionType type, con st PDFSDK_FieldAction& faOld, | 663 FX_BOOL CFFL_FormFiller::IsActionDataChanged(CPDF_AAction::AActionType type, con st PDFSDK_FieldAction& faOld, |
684 » » » » » » » » » const PD FSDK_FieldAction& faNew) | 664 const PDFSDK_FieldAction& faNew) |
685 { | 665 { |
686 » return FALSE; | 666 return FALSE; |
687 } | 667 } |
688 | 668 |
689 void CFFL_FormFiller::SaveState(CPDFSDK_PageView* pPageView) | 669 void CFFL_FormFiller::SaveState(CPDFSDK_PageView* pPageView) |
690 { | 670 { |
691 } | 671 } |
692 | 672 |
693 void CFFL_FormFiller::RestoreState(CPDFSDK_PageView* pPageView) | 673 void CFFL_FormFiller::RestoreState(CPDFSDK_PageView* pPageView) |
694 { | 674 { |
695 } | 675 } |
696 | 676 |
697 CPWL_Wnd* CFFL_FormFiller::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue) | 677 CPWL_Wnd* CFFL_FormFiller::ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue) |
698 { | 678 { |
699 » return GetPDFWindow(pPageView, FALSE); | 679 return GetPDFWindow(pPageView, FALSE); |
700 } | 680 } |
701 | 681 |
702 void CFFL_FormFiller::TimerProc() | 682 void CFFL_FormFiller::TimerProc() |
703 { | 683 { |
704 | 684 |
705 } | 685 } |
706 | 686 |
707 IFX_SystemHandler* CFFL_FormFiller::GetSystemHandler() const | 687 IFX_SystemHandler* CFFL_FormFiller::GetSystemHandler() const |
708 { | 688 { |
709 » return m_pApp->GetSysHandler(); | 689 return m_pApp->GetSysHandler(); |
710 //» return NULL; | 690 // return NULL; |
Lei Zhang
2015/07/16 17:05:05
remove
Tom Sepez
2015/07/16 18:01:28
Done.
| |
711 } | 691 } |
712 | 692 |
713 void CFFL_FormFiller::OnKeyStroke(FX_BOOL bKeyDown) | 693 void CFFL_FormFiller::OnKeyStroke(FX_BOOL bKeyDown) |
714 { | 694 { |
715 } | 695 } |
716 | 696 |
717 void CFFL_FormFiller::EscapeFiller(CPDFSDK_PageView* pPageView, FX_BOOL bDestroy PDFWindow) | 697 void CFFL_FormFiller::EscapeFiller(CPDFSDK_PageView* pPageView, FX_BOOL bDestroy PDFWindow) |
718 { | 698 { |
719 » m_bValid = FALSE; | 699 m_bValid = FALSE; |
720 | 700 |
721 » FX_RECT rcRect = GetViewBBox(pPageView, m_pWidget); | 701 FX_RECT rcRect = GetViewBBox(pPageView, m_pWidget); |
722 » InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); | 702 InvalidateRect(rcRect.left, rcRect.top, rcRect.right, rcRect.bottom); |
723 | 703 |
724 » if(bDestroyPDFWindow) | 704 if(bDestroyPDFWindow) |
725 » » DestroyPDFWindow(pPageView); | 705 DestroyPDFWindow(pPageView); |
726 } | 706 } |
727 | 707 |
728 FX_BOOL CFFL_FormFiller::CanCopy(CPDFSDK_Document* pDocument) | 708 FX_BOOL CFFL_FormFiller::CanCopy(CPDFSDK_Document* pDocument) |
729 { | 709 { |
730 » return FALSE; | 710 return FALSE; |
731 } | 711 } |
732 | 712 |
733 FX_BOOL CFFL_FormFiller::CanCut(CPDFSDK_Document* pDocument) | 713 FX_BOOL CFFL_FormFiller::CanCut(CPDFSDK_Document* pDocument) |
734 { | 714 { |
735 » return FALSE; | 715 return FALSE; |
736 } | 716 } |
737 | 717 |
738 FX_BOOL»CFFL_FormFiller::CanPaste(CPDFSDK_Document* pDocument) | 718 FX_BOOL CFFL_FormFiller::CanPaste(CPDFSDK_Document* pDocument) |
739 { | 719 { |
740 » return FALSE; | 720 return FALSE; |
741 } | 721 } |
742 | 722 |
743 void CFFL_FormFiller::DoCopy(CPDFSDK_Document* pDocument) | 723 void CFFL_FormFiller::DoCopy(CPDFSDK_Document* pDocument) |
744 { | 724 { |
745 } | 725 } |
746 | 726 |
747 void CFFL_FormFiller::DoCut(CPDFSDK_Document* pDocument) | 727 void CFFL_FormFiller::DoCut(CPDFSDK_Document* pDocument) |
748 { | 728 { |
749 } | 729 } |
750 | 730 |
751 void CFFL_FormFiller::DoPaste(CPDFSDK_Document* pDocument) | 731 void CFFL_FormFiller::DoPaste(CPDFSDK_Document* pDocument) |
752 { | 732 { |
753 } | 733 } |
754 | 734 |
755 void CFFL_FormFiller::InvalidateRect(double left, double top, double right, doub le bottom) | 735 void CFFL_FormFiller::InvalidateRect(double left, double top, double right, doub le bottom) |
756 { | 736 { |
757 » CPDF_Page * pPage = m_pWidget->GetPDFPage(); | 737 CPDF_Page * pPage = m_pWidget->GetPDFPage(); |
758 » m_pApp->FFI_Invalidate(pPage, left, top, right, bottom); | 738 m_pApp->FFI_Invalidate(pPage, left, top, right, bottom); |
759 } | 739 } |
760 | 740 |
761 /* ------------------------- CFFL_Button ------------------------- */ | 741 /* ------------------------- CFFL_Button ------------------------- */ |
762 | 742 |
763 CFFL_Button::CFFL_Button(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget) : | 743 CFFL_Button::CFFL_Button(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget) : |
764 » CFFL_FormFiller(pApp, pWidget), | 744 CFFL_FormFiller(pApp, pWidget), |
765 » m_bMouseIn(FALSE), | 745 m_bMouseIn(FALSE), |
766 » m_bMouseDown(FALSE) | 746 m_bMouseDown(FALSE) |
767 { | 747 { |
768 } | 748 } |
769 | 749 |
770 CFFL_Button::~CFFL_Button() | 750 CFFL_Button::~CFFL_Button() |
771 { | 751 { |
772 } | 752 } |
773 | 753 |
774 void CFFL_Button::OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnno t) | 754 void CFFL_Button::OnMouseEnter(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnno t) |
775 { | 755 { |
776 » m_bMouseIn = TRUE; | 756 m_bMouseIn = TRUE; |
777 » FX_RECT rect = GetViewBBox(pPageView,pAnnot); | 757 FX_RECT rect = GetViewBBox(pPageView,pAnnot); |
778 » InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); | 758 InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); |
779 } | 759 } |
780 | 760 |
781 void CFFL_Button::OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot ) | 761 void CFFL_Button::OnMouseExit(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAnnot ) |
782 { | 762 { |
783 » m_bMouseIn = FALSE; | 763 m_bMouseIn = FALSE; |
784 | 764 |
785 » FX_RECT rect = GetViewBBox(pPageView,pAnnot); | 765 FX_RECT rect = GetViewBBox(pPageView,pAnnot); |
786 » InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); | 766 InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); |
787 » EndTimer(); | 767 EndTimer(); |
788 » ASSERT(m_pWidget != NULL); | 768 ASSERT(m_pWidget != NULL); |
789 } | 769 } |
790 | 770 |
791 FX_BOOL CFFL_Button::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* p Annot, FX_UINT nFlags, const CPDF_Point& point) | 771 FX_BOOL CFFL_Button::OnLButtonDown(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* p Annot, FX_UINT nFlags, const CPDF_Point& point) |
792 { | 772 { |
793 » CPDF_Rect rcAnnot = pAnnot->GetRect(); | 773 CPDF_Rect rcAnnot = pAnnot->GetRect(); |
794 » if(!rcAnnot.Contains(point.x, point.y)) | 774 if(!rcAnnot.Contains(point.x, point.y)) |
795 » » return FALSE; | 775 return FALSE; |
796 | 776 |
797 » m_bMouseDown = TRUE; | 777 m_bMouseDown = TRUE; |
798 » m_bValid = TRUE; | 778 m_bValid = TRUE; |
799 » FX_RECT rect = GetViewBBox(pPageView, pAnnot); | 779 FX_RECT rect = GetViewBBox(pPageView, pAnnot); |
800 » InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); | 780 InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); |
801 » return TRUE; | 781 return TRUE; |
802 } | 782 } |
803 | 783 |
804 FX_BOOL»CFFL_Button::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAn not, FX_UINT nFlags, const CPDF_Point& point) | 784 FX_BOOL CFFL_Button::OnLButtonUp(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAn not, FX_UINT nFlags, const CPDF_Point& point) |
805 { | 785 { |
806 » CPDF_Rect rcAnnot = pAnnot->GetRect(); | 786 CPDF_Rect rcAnnot = pAnnot->GetRect(); |
807 » if(!rcAnnot.Contains(point.x, point.y)) | 787 if(!rcAnnot.Contains(point.x, point.y)) |
808 » » return FALSE; | 788 return FALSE; |
809 | 789 |
810 » m_bMouseDown = FALSE; | 790 m_bMouseDown = FALSE; |
811 » m_pWidget->GetPDFPage(); | 791 m_pWidget->GetPDFPage(); |
812 | 792 |
813 | 793 |
814 » FX_RECT rect = GetViewBBox(pPageView, pAnnot); | 794 FX_RECT rect = GetViewBBox(pPageView, pAnnot); |
815 » InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); | 795 InvalidateRect(rect.left, rect.top, rect.right, rect.bottom); |
816 » return TRUE; | 796 return TRUE; |
817 } | 797 } |
818 | 798 |
819 FX_BOOL»CFFL_Button::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAn not, FX_UINT nFlags, const CPDF_Point& point) | 799 FX_BOOL CFFL_Button::OnMouseMove(CPDFSDK_PageView *pPageView, CPDFSDK_Annot* pAn not, FX_UINT nFlags, const CPDF_Point& point) |
820 { | 800 { |
821 » ASSERT(m_pApp != NULL); | 801 ASSERT(m_pApp != NULL); |
822 | 802 |
823 » return TRUE; | 803 return TRUE; |
824 } | 804 } |
825 | 805 |
826 void CFFL_Button::OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot * pAnnot, | 806 void CFFL_Button::OnDraw(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFSDK_Annot * pAnnot, |
827 » » » » » » » CFX_RenderDevice* pDevic e, CPDF_Matrix* pUser2Device, | 807 CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2Device , |
Tom Sepez
2015/07/16 18:01:27
note: killed commented params.
| |
828 » » » » » » » /*const CRect& rcWindow, */ FX_DWORD dwFlags) | 808 /*const CRect& rcWindow,*/ FX_DWORD dwFlags) |
829 { | 809 { |
830 » ASSERT(pPageView != NULL); | 810 ASSERT(pPageView != NULL); |
Lei Zhang
2015/07/16 17:05:05
remove
| |
831 » ASSERT(pAnnot != NULL); | 811 ASSERT(pAnnot != NULL); |
832 | 812 |
833 » CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 813 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; |
834 | 814 |
835 » CPDF_FormControl* pCtrl = pWidget->GetFormControl(); | 815 CPDF_FormControl* pCtrl = pWidget->GetFormControl(); |
836 » ASSERT(pCtrl != NULL); | 816 ASSERT(pCtrl != NULL); |
837 | 817 |
838 » CPDF_FormControl::HighlightingMode eHM = pCtrl->GetHighlightingMode(); | 818 CPDF_FormControl::HighlightingMode eHM = pCtrl->GetHighlightingMode(); |
839 | 819 |
840 » if (eHM == CPDF_FormControl::Push) | 820 if (eHM == CPDF_FormControl::Push) |
841 » { | 821 { |
842 » » if (m_bMouseDown) | 822 if (m_bMouseDown) |
843 » » { | 823 { |
844 » » » if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Down)) | 824 if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Down)) |
845 » » » » pWidget->DrawAppearance(pDevice, pUser2Device, C PDF_Annot::Down, NULL); | 825 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Down, NULL); |
846 » » » else | 826 else |
847 » » » » pWidget->DrawAppearance(pDevice, pUser2Device, C PDF_Annot::Normal, NULL); | 827 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Norma l, NULL); |
848 » » } | 828 } |
849 » » else if (m_bMouseIn) | 829 else if (m_bMouseIn) |
850 » » { | 830 { |
851 » » » if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Rollove r)) | 831 if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Rollover)) |
852 » » » » pWidget->DrawAppearance(pDevice, pUser2Device, C PDF_Annot::Rollover, NULL); | 832 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Rollo ver, NULL); |
853 » » » else | 833 else |
854 » » » » pWidget->DrawAppearance(pDevice, pUser2Device, C PDF_Annot::Normal, NULL); | 834 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Norma l, NULL); |
855 » » } | 835 } |
856 » » else | 836 else |
857 » » { | 837 { |
858 » » » pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Anno t::Normal, NULL); | 838 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, N ULL); |
859 » » } | 839 } |
860 » } | 840 } |
861 » else | 841 else |
862 » » pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Norma l, NULL); | 842 pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL) ; |
863 } | 843 } |
864 | 844 |
865 | 845 |
866 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFS DK_Annot* pAnnot, | 846 void CFFL_Button::OnDrawDeactive(CPDFSDK_PageView *pPageView, /*HDC hDC,*/ CPDFS DK_Annot* pAnnot, |
867 » » » » » » » » CFX_RenderDevic e* pDevice, CPDF_Matrix* pUser2Device, | 847 CFX_RenderDevice* pDevice, CPDF_Matrix* pUser2D evice, |
868 » » » » » » » » /*const CRect& rcWindow, */FX_DWORD dwFlags) | 848 /*const CRect& rcWindow, */FX_DWORD dwFlags) |
869 { | 849 { |
870 » OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); | 850 OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); |
871 } | 851 } |
OLD | NEW |