OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fxfa/app/xfa_fffield.h" | 7 #include "xfa/fxfa/app/xfa_fffield.h" |
8 | 8 |
9 #include "xfa/fwl/core/cfwl_edit.h" | 9 #include "xfa/fwl/core/cfwl_edit.h" |
10 #include "xfa/fwl/core/cfwl_message.h" | 10 #include "xfa/fwl/core/cfwl_message.h" |
11 #include "xfa/fwl/core/cfwl_picturebox.h" | 11 #include "xfa/fwl/core/cfwl_picturebox.h" |
12 #include "xfa/fwl/core/cfwl_widgetmgr.h" | 12 #include "xfa/fwl/core/cfwl_widgetmgr.h" |
13 #include "xfa/fwl/core/ifwl_edit.h" | 13 #include "xfa/fwl/core/ifwl_edit.h" |
14 #include "xfa/fxfa/app/xfa_fwltheme.h" | 14 #include "xfa/fxfa/app/xfa_fwltheme.h" |
15 #include "xfa/fxfa/app/xfa_textlayout.h" | 15 #include "xfa/fxfa/app/xfa_textlayout.h" |
16 #include "xfa/fxfa/xfa_ffapp.h" | 16 #include "xfa/fxfa/xfa_ffapp.h" |
17 #include "xfa/fxfa/xfa_ffdoc.h" | 17 #include "xfa/fxfa/xfa_ffdoc.h" |
18 #include "xfa/fxfa/xfa_ffdocview.h" | 18 #include "xfa/fxfa/xfa_ffdocview.h" |
19 #include "xfa/fxfa/xfa_ffpageview.h" | 19 #include "xfa/fxfa/xfa_ffpageview.h" |
20 #include "xfa/fxfa/xfa_ffwidget.h" | 20 #include "xfa/fxfa/xfa_ffwidget.h" |
21 #include "xfa/fxgraphics/cfx_color.h" | 21 #include "xfa/fxgraphics/cfx_color.h" |
22 #include "xfa/fxgraphics/cfx_path.h" | 22 #include "xfa/fxgraphics/cfx_path.h" |
23 | 23 |
24 CXFA_FFField::CXFA_FFField(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) | 24 CXFA_FFField::CXFA_FFField(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) |
25 : CXFA_FFWidget(pPageView, pDataAcc), m_pNormalWidget(nullptr) { | 25 : CXFA_FFWidget(pPageView, pDataAcc), m_pNormalWidget(nullptr) { |
26 m_rtUI.Set(0, 0, 0, 0); | 26 m_rtUI.Set(0, 0, 0, 0); |
27 m_rtCaption.Set(0, 0, 0, 0); | 27 m_rtCaption.Set(0, 0, 0, 0); |
28 } | 28 } |
| 29 |
29 CXFA_FFField::~CXFA_FFField() { | 30 CXFA_FFField::~CXFA_FFField() { |
30 CXFA_FFField::UnloadWidget(); | 31 CXFA_FFField::UnloadWidget(); |
31 } | 32 } |
32 | 33 |
33 FX_BOOL CXFA_FFField::GetBBox(CFX_RectF& rtBox, | 34 FX_BOOL CXFA_FFField::GetBBox(CFX_RectF& rtBox, |
34 uint32_t dwStatus, | 35 uint32_t dwStatus, |
35 FX_BOOL bDrawFocus) { | 36 FX_BOOL bDrawFocus) { |
36 if (!bDrawFocus) | 37 if (!bDrawFocus) |
37 return CXFA_FFWidget::GetBBox(rtBox, dwStatus); | 38 return CXFA_FFWidget::GetBBox(rtBox, dwStatus); |
38 | 39 |
(...skipping 27 matching lines...) Expand all Loading... |
66 RenderCaption(pGS, &mtRotate); | 67 RenderCaption(pGS, &mtRotate); |
67 DrawHighlight(pGS, &mtRotate, dwStatus, FALSE); | 68 DrawHighlight(pGS, &mtRotate, dwStatus, FALSE); |
68 CFX_RectF rtWidget; | 69 CFX_RectF rtWidget; |
69 m_pNormalWidget->GetWidgetRect(rtWidget); | 70 m_pNormalWidget->GetWidgetRect(rtWidget); |
70 CFX_Matrix mt; | 71 CFX_Matrix mt; |
71 mt.Set(1, 0, 0, 1, rtWidget.left, rtWidget.top); | 72 mt.Set(1, 0, 0, 1, rtWidget.left, rtWidget.top); |
72 mt.Concat(mtRotate); | 73 mt.Concat(mtRotate); |
73 GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget->GetWidget(), | 74 GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget->GetWidget(), |
74 pGS, &mt); | 75 pGS, &mt); |
75 } | 76 } |
| 77 |
76 void CXFA_FFField::DrawHighlight(CFX_Graphics* pGS, | 78 void CXFA_FFField::DrawHighlight(CFX_Graphics* pGS, |
77 CFX_Matrix* pMatrix, | 79 CFX_Matrix* pMatrix, |
78 uint32_t dwStatus, | 80 uint32_t dwStatus, |
79 FX_BOOL bEllipse) { | 81 FX_BOOL bEllipse) { |
80 if (m_rtUI.IsEmpty() || !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { | 82 if (m_rtUI.IsEmpty() || !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { |
81 return; | 83 return; |
82 } | 84 } |
83 if ((dwStatus & XFA_WidgetStatus_Highlight) && | 85 if ((dwStatus & XFA_WidgetStatus_Highlight) && |
84 m_pDataAcc->GetAccess() == XFA_ATTRIBUTEENUM_Open) { | 86 m_pDataAcc->GetAccess() == XFA_ATTRIBUTEENUM_Open) { |
85 CXFA_FFDoc* pDoc = GetDoc(); | 87 CXFA_FFDoc* pDoc = GetDoc(); |
86 CFX_Color crHighlight(pDoc->GetDocEnvironment()->GetHighlightColor(pDoc)); | 88 CFX_Color crHighlight(pDoc->GetDocEnvironment()->GetHighlightColor(pDoc)); |
87 pGS->SetFillColor(&crHighlight); | 89 pGS->SetFillColor(&crHighlight); |
88 CFX_Path path; | 90 CFX_Path path; |
89 path.Create(); | 91 path.Create(); |
90 if (bEllipse) { | 92 if (bEllipse) { |
91 path.AddEllipse(m_rtUI); | 93 path.AddEllipse(m_rtUI); |
92 } else { | 94 } else { |
93 path.AddRectangle(m_rtUI.left, m_rtUI.top, m_rtUI.width, m_rtUI.height); | 95 path.AddRectangle(m_rtUI.left, m_rtUI.top, m_rtUI.width, m_rtUI.height); |
94 } | 96 } |
95 pGS->FillPath(&path, FXFILL_WINDING, pMatrix); | 97 pGS->FillPath(&path, FXFILL_WINDING, pMatrix); |
96 } | 98 } |
97 } | 99 } |
| 100 |
98 void CXFA_FFField::DrawFocus(CFX_Graphics* pGS, CFX_Matrix* pMatrix) { | 101 void CXFA_FFField::DrawFocus(CFX_Graphics* pGS, CFX_Matrix* pMatrix) { |
99 if (m_dwStatus & XFA_WidgetStatus_Focused) { | 102 if (m_dwStatus & XFA_WidgetStatus_Focused) { |
100 CFX_Color cr(0xFF000000); | 103 CFX_Color cr(0xFF000000); |
101 pGS->SetStrokeColor(&cr); | 104 pGS->SetStrokeColor(&cr); |
102 FX_FLOAT DashPattern[2] = {1, 1}; | 105 FX_FLOAT DashPattern[2] = {1, 1}; |
103 pGS->SetLineDash(0.0f, DashPattern, 2); | 106 pGS->SetLineDash(0.0f, DashPattern, 2); |
104 pGS->SetLineWidth(0, FALSE); | 107 pGS->SetLineWidth(0, FALSE); |
105 CFX_Path path; | 108 CFX_Path path; |
106 path.Create(); | 109 path.Create(); |
107 path.AddRectangle(m_rtUI.left, m_rtUI.top, m_rtUI.width, m_rtUI.height); | 110 path.AddRectangle(m_rtUI.left, m_rtUI.top, m_rtUI.width, m_rtUI.height); |
108 pGS->StrokePath(&path, pMatrix); | 111 pGS->StrokePath(&path, pMatrix); |
109 } | 112 } |
110 } | 113 } |
| 114 |
111 void CXFA_FFField::SetFWLThemeProvider() { | 115 void CXFA_FFField::SetFWLThemeProvider() { |
112 if (m_pNormalWidget) { | 116 if (m_pNormalWidget) { |
113 m_pNormalWidget->GetWidget()->SetThemeProvider(GetApp()->GetFWLTheme()); | 117 m_pNormalWidget->GetWidget()->SetThemeProvider(GetApp()->GetFWLTheme()); |
114 } | 118 } |
115 } | 119 } |
| 120 |
116 FX_BOOL CXFA_FFField::IsLoaded() { | 121 FX_BOOL CXFA_FFField::IsLoaded() { |
117 return m_pNormalWidget && CXFA_FFWidget::IsLoaded(); | 122 return m_pNormalWidget && CXFA_FFWidget::IsLoaded(); |
118 } | 123 } |
| 124 |
119 FX_BOOL CXFA_FFField::LoadWidget() { | 125 FX_BOOL CXFA_FFField::LoadWidget() { |
120 SetFWLThemeProvider(); | 126 SetFWLThemeProvider(); |
121 m_pDataAcc->LoadCaption(); | 127 m_pDataAcc->LoadCaption(); |
122 PerformLayout(); | 128 PerformLayout(); |
123 return TRUE; | 129 return TRUE; |
124 } | 130 } |
| 131 |
125 void CXFA_FFField::UnloadWidget() { | 132 void CXFA_FFField::UnloadWidget() { |
126 delete m_pNormalWidget; | 133 delete m_pNormalWidget; |
127 m_pNormalWidget = nullptr; | 134 m_pNormalWidget = nullptr; |
128 } | 135 } |
| 136 |
129 void CXFA_FFField::SetEditScrollOffset() { | 137 void CXFA_FFField::SetEditScrollOffset() { |
130 XFA_Element eType = m_pDataAcc->GetUIType(); | 138 XFA_Element eType = m_pDataAcc->GetUIType(); |
131 if (eType == XFA_Element::TextEdit || eType == XFA_Element::NumericEdit || | 139 if (eType == XFA_Element::TextEdit || eType == XFA_Element::NumericEdit || |
132 eType == XFA_Element::PasswordEdit) { | 140 eType == XFA_Element::PasswordEdit) { |
133 FX_FLOAT fScrollOffset = 0; | 141 FX_FLOAT fScrollOffset = 0; |
134 CXFA_FFField* pPrev = static_cast<CXFA_FFField*>(GetPrev()); | 142 CXFA_FFField* pPrev = static_cast<CXFA_FFField*>(GetPrev()); |
135 if (pPrev) { | 143 if (pPrev) { |
136 CFX_RectF rtMargin; | 144 CFX_RectF rtMargin; |
137 m_pDataAcc->GetUIMargin(rtMargin); | 145 m_pDataAcc->GetUIMargin(rtMargin); |
138 fScrollOffset = -rtMargin.top; | 146 fScrollOffset = -rtMargin.top; |
139 } | 147 } |
140 while (pPrev) { | 148 while (pPrev) { |
141 fScrollOffset += pPrev->m_rtUI.height; | 149 fScrollOffset += pPrev->m_rtUI.height; |
142 pPrev = static_cast<CXFA_FFField*>(pPrev->GetPrev()); | 150 pPrev = static_cast<CXFA_FFField*>(pPrev->GetPrev()); |
143 } | 151 } |
144 ((CFWL_Edit*)m_pNormalWidget)->SetScrollOffset(fScrollOffset); | 152 ((CFWL_Edit*)m_pNormalWidget)->SetScrollOffset(fScrollOffset); |
145 } | 153 } |
146 } | 154 } |
| 155 |
147 FX_BOOL CXFA_FFField::PerformLayout() { | 156 FX_BOOL CXFA_FFField::PerformLayout() { |
148 CXFA_FFWidget::PerformLayout(); | 157 CXFA_FFWidget::PerformLayout(); |
149 CapPlacement(); | 158 CapPlacement(); |
150 LayoutCaption(); | 159 LayoutCaption(); |
151 SetFWLRect(); | 160 SetFWLRect(); |
152 SetEditScrollOffset(); | 161 SetEditScrollOffset(); |
153 if (m_pNormalWidget) { | 162 if (m_pNormalWidget) { |
154 m_pNormalWidget->Update(); | 163 m_pNormalWidget->Update(); |
155 } | 164 } |
156 return TRUE; | 165 return TRUE; |
157 } | 166 } |
| 167 |
158 void CXFA_FFField::CapPlacement() { | 168 void CXFA_FFField::CapPlacement() { |
159 CFX_RectF rtWidget; | 169 CFX_RectF rtWidget; |
160 GetRectWithoutRotate(rtWidget); | 170 GetRectWithoutRotate(rtWidget); |
161 CXFA_Margin mgWidget = m_pDataAcc->GetMargin(); | 171 CXFA_Margin mgWidget = m_pDataAcc->GetMargin(); |
162 if (mgWidget) { | 172 if (mgWidget) { |
163 CXFA_LayoutItem* pItem = this; | 173 CXFA_LayoutItem* pItem = this; |
164 FX_FLOAT fLeftInset = 0, fRightInset = 0, fTopInset = 0, fBottomInset = 0; | 174 FX_FLOAT fLeftInset = 0, fRightInset = 0, fTopInset = 0, fBottomInset = 0; |
165 mgWidget.GetLeftInset(fLeftInset); | 175 mgWidget.GetLeftInset(fLeftInset); |
166 mgWidget.GetRightInset(fRightInset); | 176 mgWidget.GetRightInset(fRightInset); |
167 mgWidget.GetTopInset(fTopInset); | 177 mgWidget.GetTopInset(fTopInset); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 } | 263 } |
254 CXFA_Border borderUI = m_pDataAcc->GetUIBorder(); | 264 CXFA_Border borderUI = m_pDataAcc->GetUIBorder(); |
255 if (borderUI) { | 265 if (borderUI) { |
256 CXFA_Margin margin = borderUI.GetMargin(); | 266 CXFA_Margin margin = borderUI.GetMargin(); |
257 if (margin) { | 267 if (margin) { |
258 XFA_RectWidthoutMargin(m_rtUI, margin); | 268 XFA_RectWidthoutMargin(m_rtUI, margin); |
259 } | 269 } |
260 } | 270 } |
261 m_rtUI.Normalize(); | 271 m_rtUI.Normalize(); |
262 } | 272 } |
| 273 |
263 void CXFA_FFField::CapTopBottomPlacement(CXFA_Caption caption, | 274 void CXFA_FFField::CapTopBottomPlacement(CXFA_Caption caption, |
264 const CFX_RectF& rtWidget, | 275 const CFX_RectF& rtWidget, |
265 int32_t iCapPlacement) { | 276 int32_t iCapPlacement) { |
266 CFX_RectF rtUIMargin; | 277 CFX_RectF rtUIMargin; |
267 m_pDataAcc->GetUIMargin(rtUIMargin); | 278 m_pDataAcc->GetUIMargin(rtUIMargin); |
268 m_rtCaption.left += rtUIMargin.left; | 279 m_rtCaption.left += rtUIMargin.left; |
269 if (CXFA_Margin mgCap = caption.GetMargin()) { | 280 if (CXFA_Margin mgCap = caption.GetMargin()) { |
270 XFA_RectWidthoutMargin(m_rtCaption, mgCap); | 281 XFA_RectWidthoutMargin(m_rtCaption, mgCap); |
271 if (m_rtCaption.height < 0) { | 282 if (m_rtCaption.height < 0) { |
272 m_rtCaption.top += m_rtCaption.height; | 283 m_rtCaption.top += m_rtCaption.height; |
273 } | 284 } |
274 } | 285 } |
275 FX_FLOAT fWidth = rtUIMargin.left + rtUIMargin.width; | 286 FX_FLOAT fWidth = rtUIMargin.left + rtUIMargin.width; |
276 FX_FLOAT fHeight = m_rtCaption.height + rtUIMargin.top + rtUIMargin.height; | 287 FX_FLOAT fHeight = m_rtCaption.height + rtUIMargin.top + rtUIMargin.height; |
277 if (fWidth > rtWidget.width) { | 288 if (fWidth > rtWidget.width) { |
278 m_rtUI.width += fWidth - rtWidget.width; | 289 m_rtUI.width += fWidth - rtWidget.width; |
279 } | 290 } |
280 if (fHeight == XFA_DEFAULTUI_HEIGHT && m_rtUI.height < XFA_MINUI_HEIGHT) { | 291 if (fHeight == XFA_DEFAULTUI_HEIGHT && m_rtUI.height < XFA_MINUI_HEIGHT) { |
281 m_rtUI.height = XFA_MINUI_HEIGHT; | 292 m_rtUI.height = XFA_MINUI_HEIGHT; |
282 m_rtCaption.top += rtUIMargin.top + rtUIMargin.height; | 293 m_rtCaption.top += rtUIMargin.top + rtUIMargin.height; |
283 } else if (fHeight > rtWidget.height) { | 294 } else if (fHeight > rtWidget.height) { |
284 m_rtUI.height += fHeight - rtWidget.height; | 295 m_rtUI.height += fHeight - rtWidget.height; |
285 if (iCapPlacement == XFA_ATTRIBUTEENUM_Bottom) { | 296 if (iCapPlacement == XFA_ATTRIBUTEENUM_Bottom) { |
286 m_rtCaption.top += fHeight - rtWidget.height; | 297 m_rtCaption.top += fHeight - rtWidget.height; |
287 } | 298 } |
288 } | 299 } |
289 } | 300 } |
| 301 |
290 void CXFA_FFField::CapLeftRightPlacement(CXFA_Caption caption, | 302 void CXFA_FFField::CapLeftRightPlacement(CXFA_Caption caption, |
291 const CFX_RectF& rtWidget, | 303 const CFX_RectF& rtWidget, |
292 int32_t iCapPlacement) { | 304 int32_t iCapPlacement) { |
293 CFX_RectF rtUIMargin; | 305 CFX_RectF rtUIMargin; |
294 m_pDataAcc->GetUIMargin(rtUIMargin); | 306 m_pDataAcc->GetUIMargin(rtUIMargin); |
295 m_rtCaption.top += rtUIMargin.top; | 307 m_rtCaption.top += rtUIMargin.top; |
296 m_rtCaption.height -= rtUIMargin.top; | 308 m_rtCaption.height -= rtUIMargin.top; |
297 if (CXFA_Margin mgCap = caption.GetMargin()) { | 309 if (CXFA_Margin mgCap = caption.GetMargin()) { |
298 XFA_RectWidthoutMargin(m_rtCaption, mgCap); | 310 XFA_RectWidthoutMargin(m_rtCaption, mgCap); |
299 if (m_rtCaption.height < 0) { | 311 if (m_rtCaption.height < 0) { |
300 m_rtCaption.top += m_rtCaption.height; | 312 m_rtCaption.top += m_rtCaption.height; |
301 } | 313 } |
302 } | 314 } |
303 FX_FLOAT fWidth = m_rtCaption.width + rtUIMargin.left + rtUIMargin.width; | 315 FX_FLOAT fWidth = m_rtCaption.width + rtUIMargin.left + rtUIMargin.width; |
304 FX_FLOAT fHeight = rtUIMargin.top + rtUIMargin.height; | 316 FX_FLOAT fHeight = rtUIMargin.top + rtUIMargin.height; |
305 if (fWidth > rtWidget.width) { | 317 if (fWidth > rtWidget.width) { |
306 m_rtUI.width += fWidth - rtWidget.width; | 318 m_rtUI.width += fWidth - rtWidget.width; |
307 if (iCapPlacement == XFA_ATTRIBUTEENUM_Right) { | 319 if (iCapPlacement == XFA_ATTRIBUTEENUM_Right) { |
308 m_rtCaption.left += fWidth - rtWidget.width; | 320 m_rtCaption.left += fWidth - rtWidget.width; |
309 } | 321 } |
310 } | 322 } |
311 if (fHeight == XFA_DEFAULTUI_HEIGHT && m_rtUI.height < XFA_MINUI_HEIGHT) { | 323 if (fHeight == XFA_DEFAULTUI_HEIGHT && m_rtUI.height < XFA_MINUI_HEIGHT) { |
312 m_rtUI.height = XFA_MINUI_HEIGHT; | 324 m_rtUI.height = XFA_MINUI_HEIGHT; |
313 m_rtCaption.top += rtUIMargin.top + rtUIMargin.height; | 325 m_rtCaption.top += rtUIMargin.top + rtUIMargin.height; |
314 } else if (fHeight > rtWidget.height) { | 326 } else if (fHeight > rtWidget.height) { |
315 m_rtUI.height += fHeight - rtWidget.height; | 327 m_rtUI.height += fHeight - rtWidget.height; |
316 } | 328 } |
317 } | 329 } |
| 330 |
318 void CXFA_FFField::UpdateFWL() { | 331 void CXFA_FFField::UpdateFWL() { |
319 if (m_pNormalWidget) { | 332 if (m_pNormalWidget) { |
320 m_pNormalWidget->Update(); | 333 m_pNormalWidget->Update(); |
321 } | 334 } |
322 } | 335 } |
| 336 |
323 uint32_t CXFA_FFField::UpdateUIProperty() { | 337 uint32_t CXFA_FFField::UpdateUIProperty() { |
324 CXFA_Node* pUiNode = m_pDataAcc->GetUIChild(); | 338 CXFA_Node* pUiNode = m_pDataAcc->GetUIChild(); |
325 uint32_t dwStyle = 0; | 339 uint32_t dwStyle = 0; |
326 if (pUiNode && pUiNode->GetElementType() == XFA_Element::DefaultUi) { | 340 if (pUiNode && pUiNode->GetElementType() == XFA_Element::DefaultUi) { |
327 dwStyle = FWL_STYLEEXT_EDT_ReadOnly; | 341 dwStyle = FWL_STYLEEXT_EDT_ReadOnly; |
328 } | 342 } |
329 return dwStyle; | 343 return dwStyle; |
330 } | 344 } |
| 345 |
331 void CXFA_FFField::SetFWLRect() { | 346 void CXFA_FFField::SetFWLRect() { |
332 if (!m_pNormalWidget) { | 347 if (!m_pNormalWidget) { |
333 return; | 348 return; |
334 } | 349 } |
335 CFX_RectF rtUi = m_rtUI; | 350 CFX_RectF rtUi = m_rtUI; |
336 if (rtUi.width < 1.0) | 351 if (rtUi.width < 1.0) |
337 rtUi.width = 1.0; | 352 rtUi.width = 1.0; |
338 if (!m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { | 353 if (!m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { |
339 FX_FLOAT fFontSize = m_pDataAcc->GetFontSize(); | 354 FX_FLOAT fFontSize = m_pDataAcc->GetFontSize(); |
340 if (rtUi.height < fFontSize) { | 355 if (rtUi.height < fFontSize) { |
341 rtUi.height = fFontSize; | 356 rtUi.height = fFontSize; |
342 } | 357 } |
343 } | 358 } |
344 m_pNormalWidget->SetWidgetRect(rtUi); | 359 m_pNormalWidget->SetWidgetRect(rtUi); |
345 } | 360 } |
| 361 |
346 FX_BOOL CXFA_FFField::OnMouseEnter() { | 362 FX_BOOL CXFA_FFField::OnMouseEnter() { |
347 if (!m_pNormalWidget) { | 363 if (!m_pNormalWidget) { |
348 return FALSE; | 364 return FALSE; |
349 } | 365 } |
350 CFWL_MsgMouse ms; | 366 CFWL_MsgMouse ms; |
351 ms.m_dwCmd = FWL_MouseCommand::Enter; | 367 ms.m_dwCmd = FWL_MouseCommand::Enter; |
352 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); | 368 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); |
353 ms.m_pSrcTarget = nullptr; | 369 ms.m_pSrcTarget = nullptr; |
354 TranslateFWLMessage(&ms); | 370 TranslateFWLMessage(&ms); |
355 return TRUE; | 371 return TRUE; |
356 } | 372 } |
| 373 |
357 FX_BOOL CXFA_FFField::OnMouseExit() { | 374 FX_BOOL CXFA_FFField::OnMouseExit() { |
358 if (!m_pNormalWidget) { | 375 if (!m_pNormalWidget) { |
359 return FALSE; | 376 return FALSE; |
360 } | 377 } |
361 CFWL_MsgMouse ms; | 378 CFWL_MsgMouse ms; |
362 ms.m_dwCmd = FWL_MouseCommand::Leave; | 379 ms.m_dwCmd = FWL_MouseCommand::Leave; |
363 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); | 380 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); |
364 TranslateFWLMessage(&ms); | 381 TranslateFWLMessage(&ms); |
365 return TRUE; | 382 return TRUE; |
366 } | 383 } |
| 384 |
367 void CXFA_FFField::FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy) { | 385 void CXFA_FFField::FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy) { |
368 if (!m_pNormalWidget) { | 386 if (!m_pNormalWidget) { |
369 return; | 387 return; |
370 } | 388 } |
371 CFX_RectF rtWidget; | 389 CFX_RectF rtWidget; |
372 m_pNormalWidget->GetWidgetRect(rtWidget); | 390 m_pNormalWidget->GetWidgetRect(rtWidget); |
373 fx -= rtWidget.left; | 391 fx -= rtWidget.left; |
374 fy -= rtWidget.top; | 392 fy -= rtWidget.top; |
375 } | 393 } |
| 394 |
376 FX_BOOL CXFA_FFField::OnLButtonDown(uint32_t dwFlags, | 395 FX_BOOL CXFA_FFField::OnLButtonDown(uint32_t dwFlags, |
377 FX_FLOAT fx, | 396 FX_FLOAT fx, |
378 FX_FLOAT fy) { | 397 FX_FLOAT fy) { |
379 if (!m_pNormalWidget) { | 398 if (!m_pNormalWidget) { |
380 return FALSE; | 399 return FALSE; |
381 } | 400 } |
382 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open || | 401 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open || |
383 !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { | 402 !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { |
384 return FALSE; | 403 return FALSE; |
385 } | 404 } |
386 if (!PtInActiveRect(fx, fy)) { | 405 if (!PtInActiveRect(fx, fy)) { |
387 return FALSE; | 406 return FALSE; |
388 } | 407 } |
389 SetButtonDown(TRUE); | 408 SetButtonDown(TRUE); |
390 CFWL_MsgMouse ms; | 409 CFWL_MsgMouse ms; |
391 ms.m_dwCmd = FWL_MouseCommand::LeftButtonDown; | 410 ms.m_dwCmd = FWL_MouseCommand::LeftButtonDown; |
392 ms.m_dwFlags = dwFlags; | 411 ms.m_dwFlags = dwFlags; |
393 ms.m_fx = fx; | 412 ms.m_fx = fx; |
394 ms.m_fy = fy; | 413 ms.m_fy = fy; |
395 FWLToClient(ms.m_fx, ms.m_fy); | 414 FWLToClient(ms.m_fx, ms.m_fy); |
396 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); | 415 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); |
397 TranslateFWLMessage(&ms); | 416 TranslateFWLMessage(&ms); |
398 return TRUE; | 417 return TRUE; |
399 } | 418 } |
| 419 |
400 FX_BOOL CXFA_FFField::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { | 420 FX_BOOL CXFA_FFField::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { |
401 if (!m_pNormalWidget) { | 421 if (!m_pNormalWidget) { |
402 return FALSE; | 422 return FALSE; |
403 } | 423 } |
404 if (!IsButtonDown()) { | 424 if (!IsButtonDown()) { |
405 return FALSE; | 425 return FALSE; |
406 } | 426 } |
407 SetButtonDown(FALSE); | 427 SetButtonDown(FALSE); |
408 CFWL_MsgMouse ms; | 428 CFWL_MsgMouse ms; |
409 ms.m_dwCmd = FWL_MouseCommand::LeftButtonUp; | 429 ms.m_dwCmd = FWL_MouseCommand::LeftButtonUp; |
410 ms.m_dwFlags = dwFlags; | 430 ms.m_dwFlags = dwFlags; |
411 ms.m_fx = fx; | 431 ms.m_fx = fx; |
412 ms.m_fy = fy; | 432 ms.m_fy = fy; |
413 FWLToClient(ms.m_fx, ms.m_fy); | 433 FWLToClient(ms.m_fx, ms.m_fy); |
414 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); | 434 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); |
415 TranslateFWLMessage(&ms); | 435 TranslateFWLMessage(&ms); |
416 return TRUE; | 436 return TRUE; |
417 } | 437 } |
| 438 |
418 FX_BOOL CXFA_FFField::OnLButtonDblClk(uint32_t dwFlags, | 439 FX_BOOL CXFA_FFField::OnLButtonDblClk(uint32_t dwFlags, |
419 FX_FLOAT fx, | 440 FX_FLOAT fx, |
420 FX_FLOAT fy) { | 441 FX_FLOAT fy) { |
421 if (!m_pNormalWidget) { | 442 if (!m_pNormalWidget) { |
422 return FALSE; | 443 return FALSE; |
423 } | 444 } |
424 CFWL_MsgMouse ms; | 445 CFWL_MsgMouse ms; |
425 ms.m_dwCmd = FWL_MouseCommand::LeftButtonDblClk; | 446 ms.m_dwCmd = FWL_MouseCommand::LeftButtonDblClk; |
426 ms.m_dwFlags = dwFlags; | 447 ms.m_dwFlags = dwFlags; |
427 ms.m_fx = fx; | 448 ms.m_fx = fx; |
428 ms.m_fy = fy; | 449 ms.m_fy = fy; |
429 FWLToClient(ms.m_fx, ms.m_fy); | 450 FWLToClient(ms.m_fx, ms.m_fy); |
430 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); | 451 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); |
431 TranslateFWLMessage(&ms); | 452 TranslateFWLMessage(&ms); |
432 return TRUE; | 453 return TRUE; |
433 } | 454 } |
| 455 |
434 FX_BOOL CXFA_FFField::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { | 456 FX_BOOL CXFA_FFField::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { |
435 if (!m_pNormalWidget) { | 457 if (!m_pNormalWidget) { |
436 return FALSE; | 458 return FALSE; |
437 } | 459 } |
438 CFWL_MsgMouse ms; | 460 CFWL_MsgMouse ms; |
439 ms.m_dwCmd = FWL_MouseCommand::Move; | 461 ms.m_dwCmd = FWL_MouseCommand::Move; |
440 ms.m_dwFlags = dwFlags; | 462 ms.m_dwFlags = dwFlags; |
441 ms.m_fx = fx; | 463 ms.m_fx = fx; |
442 ms.m_fy = fy; | 464 ms.m_fy = fy; |
443 FWLToClient(ms.m_fx, ms.m_fy); | 465 FWLToClient(ms.m_fx, ms.m_fy); |
444 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); | 466 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); |
445 TranslateFWLMessage(&ms); | 467 TranslateFWLMessage(&ms); |
446 return TRUE; | 468 return TRUE; |
447 } | 469 } |
| 470 |
448 FX_BOOL CXFA_FFField::OnMouseWheel(uint32_t dwFlags, | 471 FX_BOOL CXFA_FFField::OnMouseWheel(uint32_t dwFlags, |
449 int16_t zDelta, | 472 int16_t zDelta, |
450 FX_FLOAT fx, | 473 FX_FLOAT fx, |
451 FX_FLOAT fy) { | 474 FX_FLOAT fy) { |
452 if (!m_pNormalWidget) { | 475 if (!m_pNormalWidget) { |
453 return FALSE; | 476 return FALSE; |
454 } | 477 } |
455 CFWL_MsgMouseWheel ms; | 478 CFWL_MsgMouseWheel ms; |
456 ms.m_dwFlags = dwFlags; | 479 ms.m_dwFlags = dwFlags; |
457 ms.m_fx = fx; | 480 ms.m_fx = fx; |
458 ms.m_fy = fy; | 481 ms.m_fy = fy; |
459 FWLToClient(ms.m_fx, ms.m_fy); | 482 FWLToClient(ms.m_fx, ms.m_fy); |
460 ms.m_fDeltaX = zDelta; | 483 ms.m_fDeltaX = zDelta; |
461 ms.m_fDeltaY = 0; | 484 ms.m_fDeltaY = 0; |
462 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); | 485 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); |
463 TranslateFWLMessage(&ms); | 486 TranslateFWLMessage(&ms); |
464 return TRUE; | 487 return TRUE; |
465 } | 488 } |
| 489 |
466 FX_BOOL CXFA_FFField::OnRButtonDown(uint32_t dwFlags, | 490 FX_BOOL CXFA_FFField::OnRButtonDown(uint32_t dwFlags, |
467 FX_FLOAT fx, | 491 FX_FLOAT fx, |
468 FX_FLOAT fy) { | 492 FX_FLOAT fy) { |
469 if (!m_pNormalWidget) { | 493 if (!m_pNormalWidget) { |
470 return FALSE; | 494 return FALSE; |
471 } | 495 } |
472 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open || | 496 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open || |
473 !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { | 497 !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { |
474 return FALSE; | 498 return FALSE; |
475 } | 499 } |
476 if (!PtInActiveRect(fx, fy)) { | 500 if (!PtInActiveRect(fx, fy)) { |
477 return FALSE; | 501 return FALSE; |
478 } | 502 } |
479 SetButtonDown(TRUE); | 503 SetButtonDown(TRUE); |
480 CFWL_MsgMouse ms; | 504 CFWL_MsgMouse ms; |
481 ms.m_dwCmd = FWL_MouseCommand::RightButtonDown; | 505 ms.m_dwCmd = FWL_MouseCommand::RightButtonDown; |
482 ms.m_dwFlags = dwFlags; | 506 ms.m_dwFlags = dwFlags; |
483 ms.m_fx = fx; | 507 ms.m_fx = fx; |
484 ms.m_fy = fy; | 508 ms.m_fy = fy; |
485 FWLToClient(ms.m_fx, ms.m_fy); | 509 FWLToClient(ms.m_fx, ms.m_fy); |
486 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); | 510 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); |
487 TranslateFWLMessage(&ms); | 511 TranslateFWLMessage(&ms); |
488 return TRUE; | 512 return TRUE; |
489 } | 513 } |
| 514 |
490 FX_BOOL CXFA_FFField::OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { | 515 FX_BOOL CXFA_FFField::OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { |
491 if (!m_pNormalWidget) { | 516 if (!m_pNormalWidget) { |
492 return FALSE; | 517 return FALSE; |
493 } | 518 } |
494 if (!IsButtonDown()) { | 519 if (!IsButtonDown()) { |
495 return FALSE; | 520 return FALSE; |
496 } | 521 } |
497 SetButtonDown(FALSE); | 522 SetButtonDown(FALSE); |
498 CFWL_MsgMouse ms; | 523 CFWL_MsgMouse ms; |
499 ms.m_dwCmd = FWL_MouseCommand::RightButtonUp; | 524 ms.m_dwCmd = FWL_MouseCommand::RightButtonUp; |
500 ms.m_dwFlags = dwFlags; | 525 ms.m_dwFlags = dwFlags; |
501 ms.m_fx = fx; | 526 ms.m_fx = fx; |
502 ms.m_fy = fy; | 527 ms.m_fy = fy; |
503 FWLToClient(ms.m_fx, ms.m_fy); | 528 FWLToClient(ms.m_fx, ms.m_fy); |
504 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); | 529 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); |
505 TranslateFWLMessage(&ms); | 530 TranslateFWLMessage(&ms); |
506 return TRUE; | 531 return TRUE; |
507 } | 532 } |
| 533 |
508 FX_BOOL CXFA_FFField::OnRButtonDblClk(uint32_t dwFlags, | 534 FX_BOOL CXFA_FFField::OnRButtonDblClk(uint32_t dwFlags, |
509 FX_FLOAT fx, | 535 FX_FLOAT fx, |
510 FX_FLOAT fy) { | 536 FX_FLOAT fy) { |
511 if (!m_pNormalWidget) { | 537 if (!m_pNormalWidget) { |
512 return FALSE; | 538 return FALSE; |
513 } | 539 } |
514 CFWL_MsgMouse ms; | 540 CFWL_MsgMouse ms; |
515 ms.m_dwCmd = FWL_MouseCommand::RightButtonDblClk; | 541 ms.m_dwCmd = FWL_MouseCommand::RightButtonDblClk; |
516 ms.m_dwFlags = dwFlags; | 542 ms.m_dwFlags = dwFlags; |
517 ms.m_fx = fx; | 543 ms.m_fx = fx; |
(...skipping 10 matching lines...) Expand all Loading... |
528 return FALSE; | 554 return FALSE; |
529 } | 555 } |
530 CFWL_MsgSetFocus ms; | 556 CFWL_MsgSetFocus ms; |
531 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); | 557 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); |
532 ms.m_pSrcTarget = nullptr; | 558 ms.m_pSrcTarget = nullptr; |
533 TranslateFWLMessage(&ms); | 559 TranslateFWLMessage(&ms); |
534 m_dwStatus |= XFA_WidgetStatus_Focused; | 560 m_dwStatus |= XFA_WidgetStatus_Focused; |
535 AddInvalidateRect(); | 561 AddInvalidateRect(); |
536 return TRUE; | 562 return TRUE; |
537 } | 563 } |
| 564 |
538 FX_BOOL CXFA_FFField::OnKillFocus(CXFA_FFWidget* pNewWidget) { | 565 FX_BOOL CXFA_FFField::OnKillFocus(CXFA_FFWidget* pNewWidget) { |
539 if (!m_pNormalWidget) { | 566 if (!m_pNormalWidget) { |
540 return CXFA_FFWidget::OnKillFocus(pNewWidget); | 567 return CXFA_FFWidget::OnKillFocus(pNewWidget); |
541 } | 568 } |
542 CFWL_MsgKillFocus ms; | 569 CFWL_MsgKillFocus ms; |
543 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); | 570 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); |
544 ms.m_pSrcTarget = nullptr; | 571 ms.m_pSrcTarget = nullptr; |
545 TranslateFWLMessage(&ms); | 572 TranslateFWLMessage(&ms); |
546 m_dwStatus &= ~XFA_WidgetStatus_Focused; | 573 m_dwStatus &= ~XFA_WidgetStatus_Focused; |
547 AddInvalidateRect(); | 574 AddInvalidateRect(); |
548 CXFA_FFWidget::OnKillFocus(pNewWidget); | 575 CXFA_FFWidget::OnKillFocus(pNewWidget); |
549 return TRUE; | 576 return TRUE; |
550 } | 577 } |
| 578 |
551 FX_BOOL CXFA_FFField::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) { | 579 FX_BOOL CXFA_FFField::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) { |
552 if (!m_pNormalWidget || !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { | 580 if (!m_pNormalWidget || !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { |
553 return FALSE; | 581 return FALSE; |
554 } | 582 } |
555 CFWL_MsgKey ms; | 583 CFWL_MsgKey ms; |
556 ms.m_dwCmd = FWL_KeyCommand::KeyDown; | 584 ms.m_dwCmd = FWL_KeyCommand::KeyDown; |
557 ms.m_dwFlags = dwFlags; | 585 ms.m_dwFlags = dwFlags; |
558 ms.m_dwKeyCode = dwKeyCode; | 586 ms.m_dwKeyCode = dwKeyCode; |
559 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); | 587 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); |
560 ms.m_pSrcTarget = nullptr; | 588 ms.m_pSrcTarget = nullptr; |
561 TranslateFWLMessage(&ms); | 589 TranslateFWLMessage(&ms); |
562 return TRUE; | 590 return TRUE; |
563 } | 591 } |
| 592 |
564 FX_BOOL CXFA_FFField::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) { | 593 FX_BOOL CXFA_FFField::OnKeyUp(uint32_t dwKeyCode, uint32_t dwFlags) { |
565 if (!m_pNormalWidget || !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { | 594 if (!m_pNormalWidget || !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { |
566 return FALSE; | 595 return FALSE; |
567 } | 596 } |
568 CFWL_MsgKey ms; | 597 CFWL_MsgKey ms; |
569 ms.m_dwCmd = FWL_KeyCommand::KeyUp; | 598 ms.m_dwCmd = FWL_KeyCommand::KeyUp; |
570 ms.m_dwFlags = dwFlags; | 599 ms.m_dwFlags = dwFlags; |
571 ms.m_dwKeyCode = dwKeyCode; | 600 ms.m_dwKeyCode = dwKeyCode; |
572 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); | 601 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); |
573 ms.m_pSrcTarget = nullptr; | 602 ms.m_pSrcTarget = nullptr; |
574 TranslateFWLMessage(&ms); | 603 TranslateFWLMessage(&ms); |
575 return TRUE; | 604 return TRUE; |
576 } | 605 } |
| 606 |
577 FX_BOOL CXFA_FFField::OnChar(uint32_t dwChar, uint32_t dwFlags) { | 607 FX_BOOL CXFA_FFField::OnChar(uint32_t dwChar, uint32_t dwFlags) { |
578 if (!m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { | 608 if (!m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { |
579 return FALSE; | 609 return FALSE; |
580 } | 610 } |
581 if (dwChar == FWL_VKEY_Tab) { | 611 if (dwChar == FWL_VKEY_Tab) { |
582 return TRUE; | 612 return TRUE; |
583 } | 613 } |
584 if (!m_pNormalWidget) { | 614 if (!m_pNormalWidget) { |
585 return FALSE; | 615 return FALSE; |
586 } | 616 } |
587 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) { | 617 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) { |
588 return FALSE; | 618 return FALSE; |
589 } | 619 } |
590 CFWL_MsgKey ms; | 620 CFWL_MsgKey ms; |
591 ms.m_dwCmd = FWL_KeyCommand::Char; | 621 ms.m_dwCmd = FWL_KeyCommand::Char; |
592 ms.m_dwFlags = dwFlags; | 622 ms.m_dwFlags = dwFlags; |
593 ms.m_dwKeyCode = dwChar; | 623 ms.m_dwKeyCode = dwChar; |
594 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); | 624 ms.m_pDstTarget = m_pNormalWidget->GetWidget(); |
595 ms.m_pSrcTarget = nullptr; | 625 ms.m_pSrcTarget = nullptr; |
596 TranslateFWLMessage(&ms); | 626 TranslateFWLMessage(&ms); |
597 return TRUE; | 627 return TRUE; |
598 } | 628 } |
| 629 |
599 FWL_WidgetHit CXFA_FFField::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { | 630 FWL_WidgetHit CXFA_FFField::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { |
600 if (m_pNormalWidget) { | 631 if (m_pNormalWidget) { |
601 FX_FLOAT ffx = fx, ffy = fy; | 632 FX_FLOAT ffx = fx, ffy = fy; |
602 FWLToClient(ffx, ffy); | 633 FWLToClient(ffx, ffy); |
603 if (m_pNormalWidget->HitTest(ffx, ffy) != FWL_WidgetHit::Unknown) | 634 if (m_pNormalWidget->HitTest(ffx, ffy) != FWL_WidgetHit::Unknown) |
604 return FWL_WidgetHit::Client; | 635 return FWL_WidgetHit::Client; |
605 } | 636 } |
606 CFX_RectF rtBox; | 637 CFX_RectF rtBox; |
607 GetRectWithoutRotate(rtBox); | 638 GetRectWithoutRotate(rtBox); |
608 if (!rtBox.Contains(fx, fy)) | 639 if (!rtBox.Contains(fx, fy)) |
609 return FWL_WidgetHit::Unknown; | 640 return FWL_WidgetHit::Unknown; |
610 if (m_rtCaption.Contains(fx, fy)) | 641 if (m_rtCaption.Contains(fx, fy)) |
611 return FWL_WidgetHit::Titlebar; | 642 return FWL_WidgetHit::Titlebar; |
612 return FWL_WidgetHit::Border; | 643 return FWL_WidgetHit::Border; |
613 } | 644 } |
| 645 |
614 FX_BOOL CXFA_FFField::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) { | 646 FX_BOOL CXFA_FFField::OnSetCursor(FX_FLOAT fx, FX_FLOAT fy) { |
615 return TRUE; | 647 return TRUE; |
616 } | 648 } |
| 649 |
617 FX_BOOL CXFA_FFField::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) { | 650 FX_BOOL CXFA_FFField::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) { |
618 if (!m_pNormalWidget) { | 651 if (!m_pNormalWidget) { |
619 return FALSE; | 652 return FALSE; |
620 } | 653 } |
621 CFX_RectF rtWidget; | 654 CFX_RectF rtWidget; |
622 m_pNormalWidget->GetWidgetRect(rtWidget); | 655 m_pNormalWidget->GetWidgetRect(rtWidget); |
623 if (rtWidget.Contains(fx, fy)) { | 656 if (rtWidget.Contains(fx, fy)) { |
624 return TRUE; | 657 return TRUE; |
625 } | 658 } |
626 return FALSE; | 659 return FALSE; |
627 } | 660 } |
| 661 |
628 void CXFA_FFField::LayoutCaption() { | 662 void CXFA_FFField::LayoutCaption() { |
629 CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout(); | 663 CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout(); |
630 if (!pCapTextLayout) | 664 if (!pCapTextLayout) |
631 return; | 665 return; |
632 | 666 |
633 FX_FLOAT fHeight = 0; | 667 FX_FLOAT fHeight = 0; |
634 pCapTextLayout->Layout(CFX_SizeF(m_rtCaption.width, m_rtCaption.height), | 668 pCapTextLayout->Layout(CFX_SizeF(m_rtCaption.width, m_rtCaption.height), |
635 &fHeight); | 669 &fHeight); |
636 if (m_rtCaption.height < fHeight) | 670 if (m_rtCaption.height < fHeight) |
637 m_rtCaption.height = fHeight; | 671 m_rtCaption.height = fHeight; |
638 } | 672 } |
| 673 |
639 void CXFA_FFField::RenderCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix) { | 674 void CXFA_FFField::RenderCaption(CFX_Graphics* pGS, CFX_Matrix* pMatrix) { |
640 CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout(); | 675 CXFA_TextLayout* pCapTextLayout = m_pDataAcc->GetCaptionTextLayout(); |
641 if (!pCapTextLayout) { | 676 if (!pCapTextLayout) { |
642 return; | 677 return; |
643 } | 678 } |
644 CXFA_Caption caption = m_pDataAcc->GetCaption(); | 679 CXFA_Caption caption = m_pDataAcc->GetCaption(); |
645 if (caption && caption.GetPresence() == XFA_ATTRIBUTEENUM_Visible) { | 680 if (caption && caption.GetPresence() == XFA_ATTRIBUTEENUM_Visible) { |
646 if (!pCapTextLayout->IsLoaded()) { | 681 if (!pCapTextLayout->IsLoaded()) { |
647 pCapTextLayout->Layout(CFX_SizeF(m_rtCaption.width, m_rtCaption.height)); | 682 pCapTextLayout->Layout(CFX_SizeF(m_rtCaption.width, m_rtCaption.height)); |
648 } | 683 } |
649 CFX_RectF rtWidget; | 684 CFX_RectF rtWidget; |
650 GetRectWithoutRotate(rtWidget); | 685 GetRectWithoutRotate(rtWidget); |
651 CFX_RectF rtClip = m_rtCaption; | 686 CFX_RectF rtClip = m_rtCaption; |
652 rtClip.Intersect(rtWidget); | 687 rtClip.Intersect(rtWidget); |
653 CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice(); | 688 CFX_RenderDevice* pRenderDevice = pGS->GetRenderDevice(); |
654 CFX_Matrix mt; | 689 CFX_Matrix mt; |
655 mt.Set(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top); | 690 mt.Set(1, 0, 0, 1, m_rtCaption.left, m_rtCaption.top); |
656 if (pMatrix) { | 691 if (pMatrix) { |
657 pMatrix->TransformRect(rtClip); | 692 pMatrix->TransformRect(rtClip); |
658 mt.Concat(*pMatrix); | 693 mt.Concat(*pMatrix); |
659 } | 694 } |
660 pCapTextLayout->DrawString(pRenderDevice, mt, rtClip); | 695 pCapTextLayout->DrawString(pRenderDevice, mt, rtClip); |
661 } | 696 } |
662 } | 697 } |
| 698 |
663 FX_BOOL CXFA_FFField::ProcessCommittedData() { | 699 FX_BOOL CXFA_FFField::ProcessCommittedData() { |
664 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) { | 700 if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) { |
665 return FALSE; | 701 return FALSE; |
666 } | 702 } |
667 if (!IsDataChanged()) { | 703 if (!IsDataChanged()) { |
668 return FALSE; | 704 return FALSE; |
669 } | 705 } |
670 if (CalculateOverride() != 1) { | 706 if (CalculateOverride() != 1) { |
671 return FALSE; | 707 return FALSE; |
672 } | 708 } |
673 if (!CommitData()) { | 709 if (!CommitData()) { |
674 return FALSE; | 710 return FALSE; |
675 } | 711 } |
676 m_pDocView->SetChangeMark(); | 712 m_pDocView->SetChangeMark(); |
677 m_pDocView->AddValidateWidget(m_pDataAcc); | 713 m_pDocView->AddValidateWidget(m_pDataAcc); |
678 return TRUE; | 714 return TRUE; |
679 } | 715 } |
| 716 |
680 int32_t CXFA_FFField::CalculateOverride() { | 717 int32_t CXFA_FFField::CalculateOverride() { |
681 CXFA_WidgetAcc* pAcc = m_pDataAcc->GetExclGroup(); | 718 CXFA_WidgetAcc* pAcc = m_pDataAcc->GetExclGroup(); |
682 if (!pAcc) { | 719 if (!pAcc) { |
683 return CalculateWidgetAcc(m_pDataAcc); | 720 return CalculateWidgetAcc(m_pDataAcc); |
684 } | 721 } |
685 if (CalculateWidgetAcc(pAcc) == 0) { | 722 if (CalculateWidgetAcc(pAcc) == 0) { |
686 return 0; | 723 return 0; |
687 } | 724 } |
688 CXFA_Node* pNode = pAcc->GetExclGroupFirstMember(); | 725 CXFA_Node* pNode = pAcc->GetExclGroupFirstMember(); |
689 if (!pNode) { | 726 if (!pNode) { |
690 return 1; | 727 return 1; |
691 } | 728 } |
692 CXFA_WidgetAcc* pWidgetAcc = nullptr; | 729 CXFA_WidgetAcc* pWidgetAcc = nullptr; |
693 while (pNode) { | 730 while (pNode) { |
694 pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()); | 731 pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()); |
695 if (!pWidgetAcc) { | 732 if (!pWidgetAcc) { |
696 return 1; | 733 return 1; |
697 } | 734 } |
698 if (CalculateWidgetAcc(pWidgetAcc) == 0) { | 735 if (CalculateWidgetAcc(pWidgetAcc) == 0) { |
699 return 0; | 736 return 0; |
700 } | 737 } |
701 pNode = pWidgetAcc->GetExclGroupNextMember(pNode); | 738 pNode = pWidgetAcc->GetExclGroupNextMember(pNode); |
702 } | 739 } |
703 return 1; | 740 return 1; |
704 } | 741 } |
| 742 |
705 int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) { | 743 int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) { |
706 CXFA_Calculate calc = pAcc->GetCalculate(); | 744 CXFA_Calculate calc = pAcc->GetCalculate(); |
707 if (!calc) { | 745 if (!calc) { |
708 return 1; | 746 return 1; |
709 } | 747 } |
710 XFA_VERSION version = pAcc->GetDoc()->GetXFADoc()->GetCurVersionMode(); | 748 XFA_VERSION version = pAcc->GetDoc()->GetXFADoc()->GetCurVersionMode(); |
711 if (calc) { | 749 if (calc) { |
712 int32_t iOverride = calc.GetOverride(); | 750 int32_t iOverride = calc.GetOverride(); |
713 switch (iOverride) { | 751 switch (iOverride) { |
714 case XFA_ATTRIBUTEENUM_Error: { | 752 case XFA_ATTRIBUTEENUM_Error: { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 case XFA_ATTRIBUTEENUM_Ignore: | 804 case XFA_ATTRIBUTEENUM_Ignore: |
767 return 0; | 805 return 0; |
768 case XFA_ATTRIBUTEENUM_Disabled: | 806 case XFA_ATTRIBUTEENUM_Disabled: |
769 pAcc->GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false); | 807 pAcc->GetNode()->SetFlag(XFA_NodeFlag_UserInteractive, false); |
770 default: | 808 default: |
771 return 1; | 809 return 1; |
772 } | 810 } |
773 } | 811 } |
774 return 1; | 812 return 1; |
775 } | 813 } |
| 814 |
776 FX_BOOL CXFA_FFField::CommitData() { | 815 FX_BOOL CXFA_FFField::CommitData() { |
777 return FALSE; | 816 return FALSE; |
778 } | 817 } |
| 818 |
779 FX_BOOL CXFA_FFField::IsDataChanged() { | 819 FX_BOOL CXFA_FFField::IsDataChanged() { |
780 return FALSE; | 820 return FALSE; |
781 } | 821 } |
| 822 |
782 void CXFA_FFField::TranslateFWLMessage(CFWL_Message* pMessage) { | 823 void CXFA_FFField::TranslateFWLMessage(CFWL_Message* pMessage) { |
783 GetApp()->GetWidgetMgrDelegate()->OnProcessMessageToForm(pMessage); | 824 GetApp()->GetWidgetMgrDelegate()->OnProcessMessageToForm(pMessage); |
784 } | 825 } |
785 void CXFA_FFField::OnProcessMessage(CFWL_Message* pMessage) {} | |
786 | |
787 void CXFA_FFField::OnProcessEvent(CFWL_Event* pEvent) { | |
788 switch (pEvent->GetClassID()) { | |
789 case CFWL_EventType::Mouse: { | |
790 CFWL_EvtMouse* event = (CFWL_EvtMouse*)pEvent; | |
791 if (event->m_dwCmd == FWL_MouseCommand::Enter) { | |
792 CXFA_EventParam eParam; | |
793 eParam.m_eType = XFA_EVENT_MouseEnter; | |
794 eParam.m_pTarget = m_pDataAcc; | |
795 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_MouseEnter, &eParam); | |
796 } else if (event->m_dwCmd == FWL_MouseCommand::Leave) { | |
797 CXFA_EventParam eParam; | |
798 eParam.m_eType = XFA_EVENT_MouseExit; | |
799 eParam.m_pTarget = m_pDataAcc; | |
800 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_MouseExit, &eParam); | |
801 } else if (event->m_dwCmd == FWL_MouseCommand::LeftButtonDown) { | |
802 CXFA_EventParam eParam; | |
803 eParam.m_eType = XFA_EVENT_MouseDown; | |
804 eParam.m_pTarget = m_pDataAcc; | |
805 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_MouseDown, &eParam); | |
806 } else if (event->m_dwCmd == FWL_MouseCommand::LeftButtonUp) { | |
807 CXFA_EventParam eParam; | |
808 eParam.m_eType = XFA_EVENT_MouseUp; | |
809 eParam.m_pTarget = m_pDataAcc; | |
810 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_MouseUp, &eParam); | |
811 } | |
812 break; | |
813 } | |
814 case CFWL_EventType::Click: { | |
815 CXFA_EventParam eParam; | |
816 eParam.m_eType = XFA_EVENT_Click; | |
817 eParam.m_pTarget = m_pDataAcc; | |
818 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Click, &eParam); | |
819 break; | |
820 } | |
821 default: | |
822 break; | |
823 } | |
824 } | |
825 | |
826 void CXFA_FFField::OnDrawWidget(CFX_Graphics* pGraphics, | |
827 const CFX_Matrix* pMatrix) {} | |
OLD | NEW |