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 "../../../foxitlib.h" | 7 #include "../../../foxitlib.h" |
8 #include "../common/xfa_common.h" | 8 #include "../common/xfa_common.h" |
9 #include "xfa_ffwidget.h" | 9 #include "xfa_ffwidget.h" |
10 #include "xfa_fffield.h" | 10 #include "xfa_fffield.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 if (m_pNormalWidget) { | 46 if (m_pNormalWidget) { |
47 CFX_RectF rtWidget; | 47 CFX_RectF rtWidget; |
48 m_pNormalWidget->GetWidgetRect(rtWidget); | 48 m_pNormalWidget->GetWidgetRect(rtWidget); |
49 rtBox.Union(rtWidget); | 49 rtBox.Union(rtWidget); |
50 } | 50 } |
51 CFX_Matrix mt; | 51 CFX_Matrix mt; |
52 GetRotateMatrix(mt); | 52 GetRotateMatrix(mt); |
53 mt.TransformRect(rtBox); | 53 mt.TransformRect(rtBox); |
54 return TRUE; | 54 return TRUE; |
55 } | 55 } |
56 void CXFA_FFField::RenderWidget(CFX_Graphics* pGS, CFX_Matrix* pMatrix , FX_DWOR
D dwStatus , FX_INT32 iRotate ) | 56 void CXFA_FFField::RenderWidget(CFX_Graphics* pGS, CFX_Matrix* pMatrix , FX_DWOR
D dwStatus , int32_t iRotate ) |
57 { | 57 { |
58 if (!IsMatchVisibleStatus(dwStatus)) { | 58 if (!IsMatchVisibleStatus(dwStatus)) { |
59 return; | 59 return; |
60 } | 60 } |
61 CFX_Matrix mtRotate; | 61 CFX_Matrix mtRotate; |
62 GetRotateMatrix(mtRotate); | 62 GetRotateMatrix(mtRotate); |
63 if (pMatrix) { | 63 if (pMatrix) { |
64 mtRotate.Concat(*pMatrix); | 64 mtRotate.Concat(*pMatrix); |
65 } | 65 } |
66 CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus); | 66 CXFA_FFWidget::RenderWidget(pGS, &mtRotate, dwStatus); |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } | 269 } |
270 CXFA_Border borderUI = m_pDataAcc->GetUIBorder(); | 270 CXFA_Border borderUI = m_pDataAcc->GetUIBorder(); |
271 if (borderUI) { | 271 if (borderUI) { |
272 CXFA_Margin margin = borderUI.GetMargin(); | 272 CXFA_Margin margin = borderUI.GetMargin(); |
273 if (margin.IsExistInXML()) { | 273 if (margin.IsExistInXML()) { |
274 XFA_RectWidthoutMargin(m_rtUI, margin); | 274 XFA_RectWidthoutMargin(m_rtUI, margin); |
275 } | 275 } |
276 } | 276 } |
277 m_rtUI.Normalize(); | 277 m_rtUI.Normalize(); |
278 } | 278 } |
279 void CXFA_FFField::CapTopBottomPlacement(CXFA_Caption caption, const CFX_RectF &
rtWidget, FX_INT32 iCapPlacement) | 279 void CXFA_FFField::CapTopBottomPlacement(CXFA_Caption caption, const CFX_RectF &
rtWidget, int32_t iCapPlacement) |
280 { | 280 { |
281 CFX_RectF rtUIMargin; | 281 CFX_RectF rtUIMargin; |
282 m_pDataAcc->GetUIMargin(rtUIMargin); | 282 m_pDataAcc->GetUIMargin(rtUIMargin); |
283 m_rtCaption.left += rtUIMargin.left; | 283 m_rtCaption.left += rtUIMargin.left; |
284 if (CXFA_Margin mgCap = caption.GetMargin()) { | 284 if (CXFA_Margin mgCap = caption.GetMargin()) { |
285 XFA_RectWidthoutMargin(m_rtCaption, mgCap); | 285 XFA_RectWidthoutMargin(m_rtCaption, mgCap); |
286 if (m_rtCaption.height < 0) { | 286 if (m_rtCaption.height < 0) { |
287 m_rtCaption.top += m_rtCaption.height; | 287 m_rtCaption.top += m_rtCaption.height; |
288 } | 288 } |
289 } | 289 } |
290 FX_FLOAT fWidth = rtUIMargin.left + rtUIMargin.width; | 290 FX_FLOAT fWidth = rtUIMargin.left + rtUIMargin.width; |
291 FX_FLOAT fHeight = m_rtCaption.height + rtUIMargin.top + rtUIMargin.height; | 291 FX_FLOAT fHeight = m_rtCaption.height + rtUIMargin.top + rtUIMargin.height; |
292 if (fWidth > rtWidget.width) { | 292 if (fWidth > rtWidget.width) { |
293 m_rtUI.width += fWidth - rtWidget.width; | 293 m_rtUI.width += fWidth - rtWidget.width; |
294 } | 294 } |
295 if (fHeight == XFA_DEFAULTUI_HEIGHT && m_rtUI.height < XFA_MINUI_HEIGHT) { | 295 if (fHeight == XFA_DEFAULTUI_HEIGHT && m_rtUI.height < XFA_MINUI_HEIGHT) { |
296 m_rtUI.height = XFA_MINUI_HEIGHT; | 296 m_rtUI.height = XFA_MINUI_HEIGHT; |
297 m_rtCaption.top += rtUIMargin.top + rtUIMargin.height; | 297 m_rtCaption.top += rtUIMargin.top + rtUIMargin.height; |
298 } else if (fHeight > rtWidget.height) { | 298 } else if (fHeight > rtWidget.height) { |
299 m_rtUI.height += fHeight - rtWidget.height; | 299 m_rtUI.height += fHeight - rtWidget.height; |
300 if (iCapPlacement == XFA_ATTRIBUTEENUM_Bottom) { | 300 if (iCapPlacement == XFA_ATTRIBUTEENUM_Bottom) { |
301 m_rtCaption.top += fHeight - rtWidget.height; | 301 m_rtCaption.top += fHeight - rtWidget.height; |
302 } | 302 } |
303 } | 303 } |
304 } | 304 } |
305 void CXFA_FFField::CapLeftRightPlacement(CXFA_Caption caption, const CFX_RectF &
rtWidget, FX_INT32 iCapPlacement) | 305 void CXFA_FFField::CapLeftRightPlacement(CXFA_Caption caption, const CFX_RectF &
rtWidget, int32_t iCapPlacement) |
306 { | 306 { |
307 CFX_RectF rtUIMargin; | 307 CFX_RectF rtUIMargin; |
308 m_pDataAcc->GetUIMargin(rtUIMargin); | 308 m_pDataAcc->GetUIMargin(rtUIMargin); |
309 m_rtCaption.top += rtUIMargin.top; | 309 m_rtCaption.top += rtUIMargin.top; |
310 m_rtCaption.height -= rtUIMargin.top; | 310 m_rtCaption.height -= rtUIMargin.top; |
311 if (CXFA_Margin mgCap = caption.GetMargin()) { | 311 if (CXFA_Margin mgCap = caption.GetMargin()) { |
312 XFA_RectWidthoutMargin(m_rtCaption, mgCap); | 312 XFA_RectWidthoutMargin(m_rtCaption, mgCap); |
313 if (m_rtCaption.height < 0) { | 313 if (m_rtCaption.height < 0) { |
314 m_rtCaption.top += m_rtCaption.height; | 314 m_rtCaption.top += m_rtCaption.height; |
315 } | 315 } |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 CFWL_MsgMouse ms; | 459 CFWL_MsgMouse ms; |
460 ms.m_dwCmd = FWL_MSGMOUSECMD_MouseMove; | 460 ms.m_dwCmd = FWL_MSGMOUSECMD_MouseMove; |
461 ms.m_dwFlags = dwFlags; | 461 ms.m_dwFlags = dwFlags; |
462 ms.m_fx = fx; | 462 ms.m_fx = fx; |
463 ms.m_fy = fy; | 463 ms.m_fy = fy; |
464 FWLToClient(ms.m_fx, ms.m_fy); | 464 FWLToClient(ms.m_fx, ms.m_fy); |
465 ms.m_pDstTarget = m_pNormalWidget->m_pImp; | 465 ms.m_pDstTarget = m_pNormalWidget->m_pImp; |
466 TranslateFWLMessage(&ms); | 466 TranslateFWLMessage(&ms); |
467 return TRUE; | 467 return TRUE; |
468 } | 468 } |
469 FX_BOOL»CXFA_FFField::OnMouseWheel(FX_DWORD dwFlags, FX_SHORT zDelta, FX_FLOAT f
x, FX_FLOAT fy) | 469 FX_BOOL»CXFA_FFField::OnMouseWheel(FX_DWORD dwFlags, int16_t zDelta, FX_FLOAT fx
, FX_FLOAT fy) |
470 { | 470 { |
471 return FALSE; | 471 return FALSE; |
472 if (!m_pNormalWidget) { | 472 if (!m_pNormalWidget) { |
473 return FALSE; | 473 return FALSE; |
474 } | 474 } |
475 CFWL_MsgMouseWheel ms; | 475 CFWL_MsgMouseWheel ms; |
476 ms.m_dwFlags = dwFlags; | 476 ms.m_dwFlags = dwFlags; |
477 ms.m_fx = fx; | 477 ms.m_fx = fx; |
478 ms.m_fy = fy; | 478 ms.m_fy = fy; |
479 FWLToClient(ms.m_fx, ms.m_fy); | 479 FWLToClient(ms.m_fx, ms.m_fy); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 if (CalculateOverride() != 1) { | 707 if (CalculateOverride() != 1) { |
708 return FALSE; | 708 return FALSE; |
709 } | 709 } |
710 if (!CommitData()) { | 710 if (!CommitData()) { |
711 return FALSE; | 711 return FALSE; |
712 } | 712 } |
713 m_pDocView->SetChangeMark(); | 713 m_pDocView->SetChangeMark(); |
714 m_pDocView->AddValidateWidget(m_pDataAcc); | 714 m_pDocView->AddValidateWidget(m_pDataAcc); |
715 return TRUE; | 715 return TRUE; |
716 } | 716 } |
717 FX_INT32 CXFA_FFField::CalculateOverride() | 717 int32_t CXFA_FFField::CalculateOverride() |
718 { | 718 { |
719 CXFA_WidgetAcc* pAcc = m_pDataAcc->GetExclGroup(); | 719 CXFA_WidgetAcc* pAcc = m_pDataAcc->GetExclGroup(); |
720 if (!pAcc) { | 720 if (!pAcc) { |
721 return CalculateWidgetAcc(m_pDataAcc); | 721 return CalculateWidgetAcc(m_pDataAcc); |
722 } | 722 } |
723 FX_INT32 iOverride = 0; | 723 int32_t iOverride = 0; |
724 if (CalculateWidgetAcc(pAcc) == 0) { | 724 if (CalculateWidgetAcc(pAcc) == 0) { |
725 return 0; | 725 return 0; |
726 } | 726 } |
727 CXFA_Node* pNode = pAcc->GetExclGroupFirstMember(); | 727 CXFA_Node* pNode = pAcc->GetExclGroupFirstMember(); |
728 if (!pNode) { | 728 if (!pNode) { |
729 return 1; | 729 return 1; |
730 } | 730 } |
731 CXFA_WidgetAcc* pWidgetAcc = NULL; | 731 CXFA_WidgetAcc* pWidgetAcc = NULL; |
732 while (pNode) { | 732 while (pNode) { |
733 pWidgetAcc = (CXFA_WidgetAcc*)pNode->GetWidgetData(); | 733 pWidgetAcc = (CXFA_WidgetAcc*)pNode->GetWidgetData(); |
734 if (!pWidgetAcc) { | 734 if (!pWidgetAcc) { |
735 return 1; | 735 return 1; |
736 } | 736 } |
737 if (CalculateWidgetAcc(pWidgetAcc) == 0) { | 737 if (CalculateWidgetAcc(pWidgetAcc) == 0) { |
738 return 0; | 738 return 0; |
739 } | 739 } |
740 pNode = pWidgetAcc->GetExclGroupNextMember(pNode); | 740 pNode = pWidgetAcc->GetExclGroupNextMember(pNode); |
741 } | 741 } |
742 return 1; | 742 return 1; |
743 } | 743 } |
744 FX_INT32 CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) | 744 int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) |
745 { | 745 { |
746 CXFA_Calculate calc = pAcc->GetCalculate(); | 746 CXFA_Calculate calc = pAcc->GetCalculate(); |
747 if (!calc) { | 747 if (!calc) { |
748 return 1; | 748 return 1; |
749 } | 749 } |
750 XFA_VERSION version = pAcc->GetDoc()->GetXFADoc()->GetCurVersionMode(); | 750 XFA_VERSION version = pAcc->GetDoc()->GetXFADoc()->GetCurVersionMode(); |
751 if (calc) { | 751 if (calc) { |
752 FX_INT32 iOverride = calc.GetOverride(); | 752 int32_t iOverride = calc.GetOverride(); |
753 switch (iOverride) { | 753 switch (iOverride) { |
754 case XFA_ATTRIBUTEENUM_Error: { | 754 case XFA_ATTRIBUTEENUM_Error: { |
755 if (version <= XFA_VERSION_204) { | 755 if (version <= XFA_VERSION_204) { |
756 return 1; | 756 return 1; |
757 } | 757 } |
758 IXFA_AppProvider* pAppProvider = GetApp()->GetAppProvider(); | 758 IXFA_AppProvider* pAppProvider = GetApp()->GetAppProvider(); |
759 if (pAppProvider) { | 759 if (pAppProvider) { |
760 CFX_WideString wsMessage; | 760 CFX_WideString wsMessage; |
761 CFX_WideString wsWarning; | 761 CFX_WideString wsWarning; |
762 pAppProvider->LoadString(XFA_IDS_NotModifyField, wsWarni
ng); | 762 pAppProvider->LoadString(XFA_IDS_NotModifyField, wsWarni
ng); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 return FALSE; | 816 return FALSE; |
817 } | 817 } |
818 FX_BOOL CXFA_FFField::IsDataChanged() | 818 FX_BOOL CXFA_FFField::IsDataChanged() |
819 { | 819 { |
820 return FALSE; | 820 return FALSE; |
821 } | 821 } |
822 void CXFA_FFField::TranslateFWLMessage(CFWL_Message* pMessage) | 822 void CXFA_FFField::TranslateFWLMessage(CFWL_Message* pMessage) |
823 { | 823 { |
824 GetApp()->GetWidgetMgrDelegate()->OnProcessMessageToForm(pMessage); | 824 GetApp()->GetWidgetMgrDelegate()->OnProcessMessageToForm(pMessage); |
825 } | 825 } |
826 FX_INT32 CXFA_FFField::OnProcessMessage(CFWL_Message *pMessage) | 826 int32_t CXFA_FFField::OnProcessMessage(CFWL_Message *pMessage) |
827 { | 827 { |
828 return FWL_ERR_Succeeded; | 828 return FWL_ERR_Succeeded; |
829 } | 829 } |
830 FWL_ERR CXFA_FFField::OnProcessEvent(CFWL_Event *pEvent) | 830 FWL_ERR CXFA_FFField::OnProcessEvent(CFWL_Event *pEvent) |
831 { | 831 { |
832 FX_DWORD dwEventID = pEvent->GetClassID(); | 832 FX_DWORD dwEventID = pEvent->GetClassID(); |
833 switch (dwEventID) { | 833 switch (dwEventID) { |
834 case FWL_EVTHASH_Mouse: { | 834 case FWL_EVTHASH_Mouse: { |
835 CFWL_EvtMouse *event = (CFWL_EvtMouse*)pEvent; | 835 CFWL_EvtMouse *event = (CFWL_EvtMouse*)pEvent; |
836 if (event->m_dwCmd == FWL_MSGMOUSECMD_MouseEnter) { | 836 if (event->m_dwCmd == FWL_MSGMOUSECMD_MouseEnter) { |
(...skipping 28 matching lines...) Expand all Loading... |
865 } | 865 } |
866 default: { | 866 default: { |
867 } | 867 } |
868 } | 868 } |
869 return FWL_ERR_Succeeded; | 869 return FWL_ERR_Succeeded; |
870 } | 870 } |
871 FWL_ERR CXFA_FFField::OnDrawWidget(CFX_Graphics *pGraphics, const CFX_Matrix *pM
atrix ) | 871 FWL_ERR CXFA_FFField::OnDrawWidget(CFX_Graphics *pGraphics, const CFX_Matrix *pM
atrix ) |
872 { | 872 { |
873 return FWL_ERR_Succeeded; | 873 return FWL_ERR_Succeeded; |
874 } | 874 } |
OLD | NEW |