Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: fpdfsdk/src/formfiller/FFL_FormFiller.cpp

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

Powered by Google App Engine
This is Rietveld 408576698