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/fwl/cfwl_edit.h" | 7 #include "xfa/fwl/cfwl_edit.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 params.dwAlignment |= FDE_TEXTEDITALIGN_Justified; | 655 params.dwAlignment |= FDE_TEXTEDITALIGN_Justified; |
656 break; | 656 break; |
657 } | 657 } |
658 default: { | 658 default: { |
659 params.dwAlignment |= FDE_TEXTEDITALIGN_Normal; | 659 params.dwAlignment |= FDE_TEXTEDITALIGN_Normal; |
660 break; | 660 break; |
661 } | 661 } |
662 } | 662 } |
663 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine) { | 663 if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine) { |
664 params.dwMode |= FDE_TEXTEDITMODE_MultiLines; | 664 params.dwMode |= FDE_TEXTEDITMODE_MultiLines; |
665 if ((m_pProperties->m_dwStyles & FWL_WGTSTYLE_HScroll) == 0 && | 665 if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_AutoHScroll) == 0) { |
666 (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_AutoHScroll) == 0) { | |
667 params.dwMode |= | 666 params.dwMode |= |
668 FDE_TEXTEDITMODE_AutoLineWrap | FDE_TEXTEDITMODE_LimitArea_Horz; | 667 FDE_TEXTEDITMODE_AutoLineWrap | FDE_TEXTEDITMODE_LimitArea_Horz; |
669 } | 668 } |
670 if ((m_pProperties->m_dwStyles & FWL_WGTSTYLE_VScroll) == 0 && | 669 if ((m_pProperties->m_dwStyles & FWL_WGTSTYLE_VScroll) == 0 && |
671 (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_AutoVScroll) == 0) { | 670 (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_AutoVScroll) == 0) { |
672 params.dwMode |= FDE_TEXTEDITMODE_LimitArea_Vert; | 671 params.dwMode |= FDE_TEXTEDITMODE_LimitArea_Vert; |
673 } else { | 672 } else { |
674 params.fPlateHeight = 0x00FFFFFF; | 673 params.fPlateHeight = 0x00FFFFFF; |
675 } | 674 } |
676 } else if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_AutoHScroll) == | 675 } else if ((m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_AutoHScroll) == |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
918 bool bShow = | 917 bool bShow = |
919 (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ShowScrollbarFocus) | 918 (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_ShowScrollbarFocus) |
920 ? (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == | 919 ? (m_pProperties->m_dwStates & FWL_WGTSTATE_Focused) == |
921 FWL_WGTSTATE_Focused | 920 FWL_WGTSTATE_Focused |
922 : true; | 921 : true; |
923 if (bVert) { | 922 if (bVert) { |
924 return bShow && (m_pProperties->m_dwStyles & FWL_WGTSTYLE_VScroll) && | 923 return bShow && (m_pProperties->m_dwStyles & FWL_WGTSTYLE_VScroll) && |
925 (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine) && | 924 (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine) && |
926 IsContentHeightOverflow(); | 925 IsContentHeightOverflow(); |
927 } | 926 } |
928 return bShow && (m_pProperties->m_dwStyles & FWL_WGTSTYLE_HScroll) && | 927 return false; |
929 (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_MultiLine); | |
930 } | 928 } |
931 | 929 |
932 bool CFWL_Edit::IsContentHeightOverflow() { | 930 bool CFWL_Edit::IsContentHeightOverflow() { |
933 IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); | 931 IFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(0); |
934 if (!pPage) | 932 if (!pPage) |
935 return false; | 933 return false; |
936 return pPage->GetContentsBox().height > m_rtEngine.height + 1.0f; | 934 return pPage->GetContentsBox().height > m_rtEngine.height + 1.0f; |
937 } | 935 } |
938 | 936 |
939 int32_t CFWL_Edit::AddDoRecord(std::unique_ptr<IFDE_TxtEdtDoRecord> pRecord) { | 937 int32_t CFWL_Edit::AddDoRecord(std::unique_ptr<IFDE_TxtEdtDoRecord> pRecord) { |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 pScrollBar->SetTrackPos(fPos); | 1586 pScrollBar->SetTrackPos(fPos); |
1589 UpdateOffset(pScrollBar, fPos - iCurPos); | 1587 UpdateOffset(pScrollBar, fPos - iCurPos); |
1590 UpdateCaret(); | 1588 UpdateCaret(); |
1591 | 1589 |
1592 CFX_RectF rect = GetWidgetRect(); | 1590 CFX_RectF rect = GetWidgetRect(); |
1593 CFX_RectF rtInvalidate; | 1591 CFX_RectF rtInvalidate; |
1594 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); | 1592 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); |
1595 RepaintRect(rtInvalidate); | 1593 RepaintRect(rtInvalidate); |
1596 return true; | 1594 return true; |
1597 } | 1595 } |
OLD | NEW |