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/include/xfa_ffwidget.h" | 7 #include "xfa/fxfa/include/xfa_ffwidget.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 21 matching lines...) Expand all Loading... |
32 m_rtWidget.Set(0, 0, 0, 0); | 32 m_rtWidget.Set(0, 0, 0, 0); |
33 } | 33 } |
34 CXFA_FFWidget::~CXFA_FFWidget() {} | 34 CXFA_FFWidget::~CXFA_FFWidget() {} |
35 CXFA_FFPageView* CXFA_FFWidget::GetPageView() { | 35 CXFA_FFPageView* CXFA_FFWidget::GetPageView() { |
36 return m_pPageView; | 36 return m_pPageView; |
37 } | 37 } |
38 void CXFA_FFWidget::SetPageView(CXFA_FFPageView* pPageView) { | 38 void CXFA_FFWidget::SetPageView(CXFA_FFPageView* pPageView) { |
39 m_pPageView = pPageView; | 39 m_pPageView = pPageView; |
40 } | 40 } |
41 void CXFA_FFWidget::GetWidgetRect(CFX_RectF& rtWidget) { | 41 void CXFA_FFWidget::GetWidgetRect(CFX_RectF& rtWidget) { |
42 if ((m_dwStatus & XFA_WIDGETSTATUS_RectCached) == 0) { | 42 if ((m_dwStatus & XFA_WidgetStatus_RectCached) == 0) { |
43 m_dwStatus |= XFA_WIDGETSTATUS_RectCached; | 43 m_dwStatus |= XFA_WidgetStatus_RectCached; |
44 GetRect(m_rtWidget); | 44 GetRect(m_rtWidget); |
45 } | 45 } |
46 rtWidget = m_rtWidget; | 46 rtWidget = m_rtWidget; |
47 } | 47 } |
48 CFX_RectF CXFA_FFWidget::ReCacheWidgetRect() { | 48 CFX_RectF CXFA_FFWidget::ReCacheWidgetRect() { |
49 m_dwStatus |= XFA_WIDGETSTATUS_RectCached; | 49 m_dwStatus |= XFA_WidgetStatus_RectCached; |
50 GetRect(m_rtWidget); | 50 GetRect(m_rtWidget); |
51 return m_rtWidget; | 51 return m_rtWidget; |
52 } | 52 } |
53 void CXFA_FFWidget::GetRectWithoutRotate(CFX_RectF& rtWidget) { | 53 void CXFA_FFWidget::GetRectWithoutRotate(CFX_RectF& rtWidget) { |
54 GetWidgetRect(rtWidget); | 54 GetWidgetRect(rtWidget); |
55 FX_FLOAT fValue = 0; | 55 FX_FLOAT fValue = 0; |
56 switch (m_pDataAcc->GetRotate()) { | 56 switch (m_pDataAcc->GetRotate()) { |
57 case 90: | 57 case 90: |
58 rtWidget.top = rtWidget.bottom(); | 58 rtWidget.top = rtWidget.bottom(); |
59 fValue = rtWidget.width; | 59 fValue = rtWidget.width; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 void CXFA_FFWidget::DrawBorder(CFX_Graphics* pGS, | 139 void CXFA_FFWidget::DrawBorder(CFX_Graphics* pGS, |
140 CXFA_Box box, | 140 CXFA_Box box, |
141 const CFX_RectF& rtBorder, | 141 const CFX_RectF& rtBorder, |
142 CFX_Matrix* pMatrix, | 142 CFX_Matrix* pMatrix, |
143 uint32_t dwFlags) { | 143 uint32_t dwFlags) { |
144 XFA_DrawBox(box, pGS, rtBorder, pMatrix, dwFlags); | 144 XFA_DrawBox(box, pGS, rtBorder, pMatrix, dwFlags); |
145 } | 145 } |
146 void CXFA_FFWidget::InvalidateWidget(const CFX_RectF* pRect) { | 146 void CXFA_FFWidget::InvalidateWidget(const CFX_RectF* pRect) { |
147 if (!pRect) { | 147 if (!pRect) { |
148 CFX_RectF rtWidget; | 148 CFX_RectF rtWidget; |
149 GetBBox(rtWidget, XFA_WIDGETSTATUS_Focused); | 149 GetBBox(rtWidget, XFA_WidgetStatus_Focused); |
150 rtWidget.Inflate(2, 2); | 150 rtWidget.Inflate(2, 2); |
151 GetDoc()->GetDocProvider()->InvalidateRect(m_pPageView, rtWidget, | 151 GetDoc()->GetDocProvider()->InvalidateRect(m_pPageView, rtWidget, |
152 XFA_INVALIDATE_CurrentPage); | 152 XFA_INVALIDATE_CurrentPage); |
153 } else { | 153 } else { |
154 GetDoc()->GetDocProvider()->InvalidateRect(m_pPageView, *pRect, | 154 GetDoc()->GetDocProvider()->InvalidateRect(m_pPageView, *pRect, |
155 XFA_INVALIDATE_CurrentPage); | 155 XFA_INVALIDATE_CurrentPage); |
156 } | 156 } |
157 } | 157 } |
158 void CXFA_FFWidget::AddInvalidateRect(const CFX_RectF* pRect) { | 158 void CXFA_FFWidget::AddInvalidateRect(const CFX_RectF* pRect) { |
159 CFX_RectF rtWidget; | 159 CFX_RectF rtWidget; |
160 if (pRect) { | 160 if (pRect) { |
161 rtWidget = *pRect; | 161 rtWidget = *pRect; |
162 } else { | 162 } else { |
163 GetBBox(rtWidget, XFA_WIDGETSTATUS_Focused); | 163 GetBBox(rtWidget, XFA_WidgetStatus_Focused); |
164 rtWidget.Inflate(2, 2); | 164 rtWidget.Inflate(2, 2); |
165 } | 165 } |
166 m_pDocView->AddInvalidateRect(m_pPageView, rtWidget); | 166 m_pDocView->AddInvalidateRect(m_pPageView, rtWidget); |
167 } | 167 } |
168 FX_BOOL CXFA_FFWidget::GetCaptionText(CFX_WideString& wsCap) { | 168 FX_BOOL CXFA_FFWidget::GetCaptionText(CFX_WideString& wsCap) { |
169 CXFA_TextLayout* pCapTextlayout = m_pDataAcc->GetCaptionTextLayout(); | 169 CXFA_TextLayout* pCapTextlayout = m_pDataAcc->GetCaptionTextLayout(); |
170 if (!pCapTextlayout) { | 170 if (!pCapTextlayout) { |
171 return FALSE; | 171 return FALSE; |
172 } | 172 } |
173 pCapTextlayout->GetText(wsCap); | 173 pCapTextlayout->GetText(wsCap); |
174 return TRUE; | 174 return TRUE; |
175 } | 175 } |
176 | 176 |
177 bool CXFA_FFWidget::IsFocused() { | 177 bool CXFA_FFWidget::IsFocused() { |
178 return !!(m_dwStatus & XFA_WIDGETSTATUS_Focused); | 178 return !!(m_dwStatus & XFA_WidgetStatus_Focused); |
179 } | 179 } |
180 | 180 |
181 FX_BOOL CXFA_FFWidget::OnMouseEnter() { | 181 FX_BOOL CXFA_FFWidget::OnMouseEnter() { |
182 return FALSE; | 182 return FALSE; |
183 } | 183 } |
184 FX_BOOL CXFA_FFWidget::OnMouseExit() { | 184 FX_BOOL CXFA_FFWidget::OnMouseExit() { |
185 return FALSE; | 185 return FALSE; |
186 } | 186 } |
187 FX_BOOL CXFA_FFWidget::OnLButtonDown(uint32_t dwFlags, | 187 FX_BOOL CXFA_FFWidget::OnLButtonDown(uint32_t dwFlags, |
188 FX_FLOAT fx, | 188 FX_FLOAT fx, |
(...skipping 29 matching lines...) Expand all Loading... |
218 FX_FLOAT fx, | 218 FX_FLOAT fx, |
219 FX_FLOAT fy) { | 219 FX_FLOAT fy) { |
220 return FALSE; | 220 return FALSE; |
221 } | 221 } |
222 | 222 |
223 FX_BOOL CXFA_FFWidget::OnSetFocus(CXFA_FFWidget* pOldWidget) { | 223 FX_BOOL CXFA_FFWidget::OnSetFocus(CXFA_FFWidget* pOldWidget) { |
224 CXFA_FFWidget* pParent = GetParent(); | 224 CXFA_FFWidget* pParent = GetParent(); |
225 if (pParent && !pParent->IsAncestorOf(pOldWidget)) { | 225 if (pParent && !pParent->IsAncestorOf(pOldWidget)) { |
226 pParent->OnSetFocus(pOldWidget); | 226 pParent->OnSetFocus(pOldWidget); |
227 } | 227 } |
228 m_dwStatus |= XFA_WIDGETSTATUS_Focused; | 228 m_dwStatus |= XFA_WidgetStatus_Focused; |
229 CXFA_EventParam eParam; | 229 CXFA_EventParam eParam; |
230 eParam.m_eType = XFA_EVENT_Enter; | 230 eParam.m_eType = XFA_EVENT_Enter; |
231 eParam.m_pTarget = m_pDataAcc; | 231 eParam.m_pTarget = m_pDataAcc; |
232 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Enter, &eParam); | 232 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Enter, &eParam); |
233 return TRUE; | 233 return TRUE; |
234 } | 234 } |
235 FX_BOOL CXFA_FFWidget::OnKillFocus(CXFA_FFWidget* pNewWidget) { | 235 FX_BOOL CXFA_FFWidget::OnKillFocus(CXFA_FFWidget* pNewWidget) { |
236 m_dwStatus &= ~XFA_WIDGETSTATUS_Focused; | 236 m_dwStatus &= ~XFA_WidgetStatus_Focused; |
237 EventKillFocus(); | 237 EventKillFocus(); |
238 if (pNewWidget) { | 238 if (pNewWidget) { |
239 CXFA_FFWidget* pParent = GetParent(); | 239 CXFA_FFWidget* pParent = GetParent(); |
240 if (pParent && !pParent->IsAncestorOf(pNewWidget)) { | 240 if (pParent && !pParent->IsAncestorOf(pNewWidget)) { |
241 pParent->OnKillFocus(pNewWidget); | 241 pParent->OnKillFocus(pNewWidget); |
242 } | 242 } |
243 } | 243 } |
244 return TRUE; | 244 return TRUE; |
245 } | 245 } |
246 FX_BOOL CXFA_FFWidget::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) { | 246 FX_BOOL CXFA_FFWidget::OnKeyDown(uint32_t dwKeyCode, uint32_t dwFlags) { |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 FX_FLOAT fHeight = 0; | 398 FX_FLOAT fHeight = 0; |
399 if (m_pDataAcc->GetHeight(fHeight)) { | 399 if (m_pDataAcc->GetHeight(fHeight)) { |
400 fMinHeight = fMaxHeight = fHeight; | 400 fMinHeight = fMaxHeight = fHeight; |
401 } else { | 401 } else { |
402 m_pDataAcc->GetMinHeight(fMinHeight); | 402 m_pDataAcc->GetMinHeight(fMinHeight); |
403 m_pDataAcc->GetMaxHeight(fMaxHeight); | 403 m_pDataAcc->GetMaxHeight(fMaxHeight); |
404 } | 404 } |
405 } | 405 } |
406 | 406 |
407 bool CXFA_FFWidget::IsMatchVisibleStatus(uint32_t dwStatus) { | 407 bool CXFA_FFWidget::IsMatchVisibleStatus(uint32_t dwStatus) { |
408 return !!(m_dwStatus & XFA_WIDGETSTATUS_Visible); | 408 return !!(m_dwStatus & XFA_WidgetStatus_Visible); |
409 } | 409 } |
410 | 410 |
411 void CXFA_FFWidget::EventKillFocus() { | 411 void CXFA_FFWidget::EventKillFocus() { |
412 if (m_dwStatus & XFA_WIDGETSTATUS_Access) { | 412 if (m_dwStatus & XFA_WidgetStatus_Access) { |
413 m_dwStatus &= ~XFA_WIDGETSTATUS_Access; | 413 m_dwStatus &= ~XFA_WidgetStatus_Access; |
414 return; | 414 return; |
415 } | 415 } |
416 CXFA_EventParam eParam; | 416 CXFA_EventParam eParam; |
417 eParam.m_eType = XFA_EVENT_Exit; | 417 eParam.m_eType = XFA_EVENT_Exit; |
418 eParam.m_pTarget = m_pDataAcc; | 418 eParam.m_pTarget = m_pDataAcc; |
419 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Exit, &eParam); | 419 m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Exit, &eParam); |
420 } | 420 } |
421 FX_BOOL CXFA_FFWidget::IsButtonDown() { | 421 FX_BOOL CXFA_FFWidget::IsButtonDown() { |
422 return (m_dwStatus & XFA_WIDGETSTATUS_ButtonDown) != 0; | 422 return (m_dwStatus & XFA_WidgetStatus_ButtonDown) != 0; |
423 } | 423 } |
424 void CXFA_FFWidget::SetButtonDown(FX_BOOL bSet) { | 424 void CXFA_FFWidget::SetButtonDown(FX_BOOL bSet) { |
425 bSet ? m_dwStatus |= XFA_WIDGETSTATUS_ButtonDown | 425 bSet ? m_dwStatus |= XFA_WidgetStatus_ButtonDown |
426 : m_dwStatus &= ~XFA_WIDGETSTATUS_ButtonDown; | 426 : m_dwStatus &= ~XFA_WidgetStatus_ButtonDown; |
427 } | 427 } |
428 int32_t XFA_StrokeTypeSetLineDash(CFX_Graphics* pGraphics, | 428 int32_t XFA_StrokeTypeSetLineDash(CFX_Graphics* pGraphics, |
429 int32_t iStrokeType, | 429 int32_t iStrokeType, |
430 int32_t iCapType) { | 430 int32_t iCapType) { |
431 switch (iStrokeType) { | 431 switch (iStrokeType) { |
432 case XFA_ATTRIBUTEENUM_DashDot: { | 432 case XFA_ATTRIBUTEENUM_DashDot: { |
433 FX_FLOAT dashArray[] = {4, 1, 2, 1}; | 433 FX_FLOAT dashArray[] = {4, 1, 2, 1}; |
434 if (iCapType != XFA_ATTRIBUTEENUM_Butt) { | 434 if (iCapType != XFA_ATTRIBUTEENUM_Butt) { |
435 dashArray[1] = 2; | 435 dashArray[1] = 2; |
436 dashArray[3] = 2; | 436 dashArray[3] = 2; |
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1961 iType != XFA_ELEMENT_Rectangle) { | 1961 iType != XFA_ELEMENT_Rectangle) { |
1962 return; | 1962 return; |
1963 } | 1963 } |
1964 CXFA_StrokeArray strokes; | 1964 CXFA_StrokeArray strokes; |
1965 if (!(dwFlags & XFA_DRAWBOX_ForceRound) && iType != XFA_ELEMENT_Arc) { | 1965 if (!(dwFlags & XFA_DRAWBOX_ForceRound) && iType != XFA_ELEMENT_Arc) { |
1966 box.GetStrokes(strokes); | 1966 box.GetStrokes(strokes); |
1967 } | 1967 } |
1968 XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags); | 1968 XFA_BOX_Fill(box, strokes, pGS, rtWidget, pMatrix, dwFlags); |
1969 XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags); | 1969 XFA_BOX_Stroke(box, strokes, pGS, rtWidget, pMatrix, dwFlags); |
1970 } | 1970 } |
OLD | NEW |