| 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_ffwidgetacc.h" | 7 #include "xfa/fxfa/app/xfa_ffwidgetacc.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 CXFA_FFWidget* pWidget = NULL; | 734 CXFA_FFWidget* pWidget = NULL; |
| 735 while ((pWidget = GetNextWidget(pWidget))) { | 735 while ((pWidget = GetNextWidget(pWidget))) { |
| 736 if (pWidget == pExcept || !pWidget->IsLoaded() || | 736 if (pWidget == pExcept || !pWidget->IsLoaded() || |
| 737 (GetUIType() != XFA_ELEMENT_CheckButton && pWidget->IsFocused())) { | 737 (GetUIType() != XFA_ELEMENT_CheckButton && pWidget->IsFocused())) { |
| 738 continue; | 738 continue; |
| 739 } | 739 } |
| 740 pWidget->UpdateFWLData(); | 740 pWidget->UpdateFWLData(); |
| 741 pWidget->AddInvalidateRect(); | 741 pWidget->AddInvalidateRect(); |
| 742 } | 742 } |
| 743 } | 743 } |
| 744 void CXFA_WidgetAcc::NotifyEvent(FX_DWORD dwEvent, | 744 void CXFA_WidgetAcc::NotifyEvent(uint32_t dwEvent, |
| 745 CXFA_FFWidget* pWidget, | 745 CXFA_FFWidget* pWidget, |
| 746 void* pParam, | 746 void* pParam, |
| 747 void* pAdditional) { | 747 void* pAdditional) { |
| 748 IXFA_DocProvider* pDocProvider = GetDoc()->GetDocProvider(); | 748 IXFA_DocProvider* pDocProvider = GetDoc()->GetDocProvider(); |
| 749 if (pWidget) { | 749 if (pWidget) { |
| 750 pDocProvider->WidgetEvent(pWidget, this, dwEvent, pParam, pAdditional); | 750 pDocProvider->WidgetEvent(pWidget, this, dwEvent, pParam, pAdditional); |
| 751 } else { | 751 } else { |
| 752 pWidget = GetNextWidget(pWidget); | 752 pWidget = GetNextWidget(pWidget); |
| 753 if (pWidget == NULL) { | 753 if (pWidget == NULL) { |
| 754 pDocProvider->WidgetEvent(NULL, this, dwEvent, pParam, pAdditional); | 754 pDocProvider->WidgetEvent(NULL, this, dwEvent, pParam, pAdditional); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 892 if (wsLast == wcEnter) { | 892 if (wsLast == wcEnter) { |
| 893 wsText = wsText + wcEnter; | 893 wsText = wsText + wcEnter; |
| 894 } | 894 } |
| 895 if (!((CXFA_FieldLayoutData*)m_pLayoutData)->m_pTextOut) { | 895 if (!((CXFA_FieldLayoutData*)m_pLayoutData)->m_pTextOut) { |
| 896 ((CXFA_FieldLayoutData*)m_pLayoutData)->m_pTextOut = IFDE_TextOut::Create(); | 896 ((CXFA_FieldLayoutData*)m_pLayoutData)->m_pTextOut = IFDE_TextOut::Create(); |
| 897 IFDE_TextOut* pTextOut = ((CXFA_FieldLayoutData*)m_pLayoutData)->m_pTextOut; | 897 IFDE_TextOut* pTextOut = ((CXFA_FieldLayoutData*)m_pLayoutData)->m_pTextOut; |
| 898 pTextOut->SetFont(GetFDEFont()); | 898 pTextOut->SetFont(GetFDEFont()); |
| 899 pTextOut->SetFontSize(fFontSize); | 899 pTextOut->SetFontSize(fFontSize); |
| 900 pTextOut->SetLineBreakTolerance(fFontSize * 0.2f); | 900 pTextOut->SetLineBreakTolerance(fFontSize * 0.2f); |
| 901 pTextOut->SetLineSpace(GetLineHeight()); | 901 pTextOut->SetLineSpace(GetLineHeight()); |
| 902 FX_DWORD dwStyles = FDE_TTOSTYLE_LastLineHeight; | 902 uint32_t dwStyles = FDE_TTOSTYLE_LastLineHeight; |
| 903 if (GetUIType() == XFA_ELEMENT_TextEdit && IsMultiLine()) { | 903 if (GetUIType() == XFA_ELEMENT_TextEdit && IsMultiLine()) { |
| 904 dwStyles |= FDE_TTOSTYLE_LineWrap; | 904 dwStyles |= FDE_TTOSTYLE_LineWrap; |
| 905 } | 905 } |
| 906 pTextOut->SetStyles(dwStyles); | 906 pTextOut->SetStyles(dwStyles); |
| 907 } | 907 } |
| 908 ((CXFA_FieldLayoutData*)m_pLayoutData) | 908 ((CXFA_FieldLayoutData*)m_pLayoutData) |
| 909 ->m_pTextOut->CalcLogicSize(wsText, wsText.GetLength(), size); | 909 ->m_pTextOut->CalcLogicSize(wsText, wsText.GetLength(), size); |
| 910 } | 910 } |
| 911 FX_BOOL CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) { | 911 FX_BOOL CXFA_WidgetAcc::CalculateTextEditAutoSize(CFX_SizeF& size) { |
| 912 if (size.x > 0) { | 912 if (size.x > 0) { |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1528 delete ((CXFA_ImageEditData*)m_pLayoutData)->m_pDIBitmap; | 1528 delete ((CXFA_ImageEditData*)m_pLayoutData)->m_pDIBitmap; |
| 1529 ((CXFA_ImageEditData*)m_pLayoutData)->m_pDIBitmap = NULL; | 1529 ((CXFA_ImageEditData*)m_pLayoutData)->m_pDIBitmap = NULL; |
| 1530 } | 1530 } |
| 1531 ((CXFA_ImageEditData*)m_pLayoutData)->m_pDIBitmap = newImage; | 1531 ((CXFA_ImageEditData*)m_pLayoutData)->m_pDIBitmap = newImage; |
| 1532 } | 1532 } |
| 1533 CXFA_WidgetLayoutData* CXFA_WidgetAcc::GetWidgetLayoutData() { | 1533 CXFA_WidgetLayoutData* CXFA_WidgetAcc::GetWidgetLayoutData() { |
| 1534 return m_pLayoutData; | 1534 return m_pLayoutData; |
| 1535 } | 1535 } |
| 1536 IFX_Font* CXFA_WidgetAcc::GetFDEFont() { | 1536 IFX_Font* CXFA_WidgetAcc::GetFDEFont() { |
| 1537 CFX_WideStringC wsFontName = FX_WSTRC(L"Courier"); | 1537 CFX_WideStringC wsFontName = FX_WSTRC(L"Courier"); |
| 1538 FX_DWORD dwFontStyle = 0; | 1538 uint32_t dwFontStyle = 0; |
| 1539 if (CXFA_Font font = GetFont()) { | 1539 if (CXFA_Font font = GetFont()) { |
| 1540 if (font.IsBold()) { | 1540 if (font.IsBold()) { |
| 1541 dwFontStyle |= FX_FONTSTYLE_Bold; | 1541 dwFontStyle |= FX_FONTSTYLE_Bold; |
| 1542 } | 1542 } |
| 1543 if (font.IsItalic()) { | 1543 if (font.IsItalic()) { |
| 1544 dwFontStyle |= FX_FONTSTYLE_Italic; | 1544 dwFontStyle |= FX_FONTSTYLE_Italic; |
| 1545 } | 1545 } |
| 1546 font.GetTypeface(wsFontName); | 1546 font.GetTypeface(wsFontName); |
| 1547 } | 1547 } |
| 1548 CXFA_FFDoc* pDoc = GetDoc(); | 1548 CXFA_FFDoc* pDoc = GetDoc(); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1705 if (pIDNode) { | 1705 if (pIDNode) { |
| 1706 pEmbAcc = (CXFA_WidgetAcc*)pIDNode->GetWidgetData(); | 1706 pEmbAcc = (CXFA_WidgetAcc*)pIDNode->GetWidgetData(); |
| 1707 } | 1707 } |
| 1708 if (pEmbAcc) { | 1708 if (pEmbAcc) { |
| 1709 pEmbAcc->GetValue(wsValue, XFA_VALUEPICTURE_Display); | 1709 pEmbAcc->GetValue(wsValue, XFA_VALUEPICTURE_Display); |
| 1710 return TRUE; | 1710 return TRUE; |
| 1711 } | 1711 } |
| 1712 } | 1712 } |
| 1713 return FALSE; | 1713 return FALSE; |
| 1714 } | 1714 } |
| OLD | NEW |