| 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/basewidget/fwl_editimp.h" | 7 #include "xfa/fwl/basewidget/fwl_editimp.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "xfa/fde/fde_render.h" | 12 #include "xfa/fde/fde_render.h" |
| 13 #include "xfa/fde/fde_renderdevice.h" | 13 #include "xfa/fde/fde_renderdevice.h" |
| 14 #include "xfa/fee/ifde_txtedtpage.h" | 14 #include "xfa/fee/ifde_txtedtpage.h" |
| 15 #include "xfa/fwl/basewidget/fwl_caretimp.h" | 15 #include "xfa/fwl/basewidget/fwl_caretimp.h" |
| 16 #include "xfa/fwl/basewidget/fwl_comboboximp.h" | 16 #include "xfa/fwl/basewidget/fwl_comboboximp.h" |
| 17 #include "xfa/fwl/basewidget/fwl_scrollbarimp.h" | 17 #include "xfa/fwl/basewidget/fwl_scrollbarimp.h" |
| 18 #include "xfa/fwl/basewidget/ifwl_caret.h" | 18 #include "xfa/fwl/basewidget/ifwl_caret.h" |
| 19 #include "xfa/fwl/basewidget/ifwl_datetimepicker.h" | 19 #include "xfa/fwl/basewidget/ifwl_datetimepicker.h" |
| 20 #include "xfa/fwl/core/cfwl_message.h" | 20 #include "xfa/fwl/core/cfwl_message.h" |
| 21 #include "xfa/fwl/core/cfwl_themebackground.h" | 21 #include "xfa/fwl/core/cfwl_themebackground.h" |
| 22 #include "xfa/fwl/core/cfwl_themepart.h" | 22 #include "xfa/fwl/core/cfwl_themepart.h" |
| 23 #include "xfa/fwl/core/fwl_appimp.h" | 23 #include "xfa/fwl/core/fwl_appimp.h" |
| 24 #include "xfa/fwl/core/fwl_noteimp.h" | 24 #include "xfa/fwl/core/fwl_noteimp.h" |
| 25 #include "xfa/fwl/core/fwl_targetimp.h" | 25 #include "xfa/fwl/core/fwl_targetimp.h" |
| 26 #include "xfa/fwl/core/fwl_threadimp.h" | 26 #include "xfa/fwl/core/fwl_threadimp.h" |
| 27 #include "xfa/fwl/core/fwl_widgetimp.h" | 27 #include "xfa/fwl/core/fwl_widgetimp.h" |
| 28 #include "xfa/fwl/core/fwl_widgetmgrimp.h" | 28 #include "xfa/fwl/core/fwl_widgetmgrimp.h" |
| 29 #include "xfa/fwl/core/ifwl_themeprovider.h" | 29 #include "xfa/fwl/core/ifwl_themeprovider.h" |
| 30 #include "xfa/fxfa/app/xfa_ffdoc.h" |
| 31 #include "xfa/fxfa/app/xfa_ffwidget.h" |
| 30 #include "xfa/fxgraphics/cfx_path.h" | 32 #include "xfa/fxgraphics/cfx_path.h" |
| 31 | 33 |
| 32 // static | 34 // static |
| 33 IFWL_Edit* IFWL_Edit::Create(const CFWL_WidgetImpProperties& properties, | 35 IFWL_Edit* IFWL_Edit::Create(const CFWL_WidgetImpProperties& properties, |
| 34 IFWL_Widget* pOuter) { | 36 IFWL_Widget* pOuter) { |
| 35 IFWL_Edit* pEdit = new IFWL_Edit; | 37 IFWL_Edit* pEdit = new IFWL_Edit; |
| 36 CFWL_EditImp* pEditImpl = new CFWL_EditImp(properties, pOuter); | 38 CFWL_EditImp* pEditImpl = new CFWL_EditImp(properties, pOuter); |
| 37 pEdit->SetImpl(pEditImpl); | 39 pEdit->SetImpl(pEditImpl); |
| 38 pEditImpl->SetInterface(pEdit); | 40 pEditImpl->SetInterface(pEdit); |
| 39 return pEdit; | 41 return pEdit; |
| (...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1612 IFWL_ScrollBar* pScrollBar = IFWL_ScrollBar::Create(prop, m_pInterface); | 1614 IFWL_ScrollBar* pScrollBar = IFWL_ScrollBar::Create(prop, m_pInterface); |
| 1613 pScrollBar->Initialize(); | 1615 pScrollBar->Initialize(); |
| 1614 (bVert ? &m_pVertScrollBar : &m_pHorzScrollBar)->reset(pScrollBar); | 1616 (bVert ? &m_pVertScrollBar : &m_pHorzScrollBar)->reset(pScrollBar); |
| 1615 } | 1617 } |
| 1616 void CFWL_EditImp::InitEngine() { | 1618 void CFWL_EditImp::InitEngine() { |
| 1617 if (m_pEdtEngine) { | 1619 if (m_pEdtEngine) { |
| 1618 return; | 1620 return; |
| 1619 } | 1621 } |
| 1620 m_pEdtEngine = IFDE_TxtEdtEngine::Create(); | 1622 m_pEdtEngine = IFDE_TxtEdtEngine::Create(); |
| 1621 } | 1623 } |
| 1622 extern FX_BOOL FWL_ShowCaret(IFWL_Widget* pWidget, | 1624 |
| 1623 FX_BOOL bVisible, | 1625 FX_BOOL FWL_ShowCaret(IFWL_Widget* pWidget, |
| 1624 const CFX_RectF* pRtAnchor); | 1626 FX_BOOL bVisible, |
| 1627 const CFX_RectF* pRtAnchor) { |
| 1628 CXFA_FFWidget* pXFAWidget = (CXFA_FFWidget*)pWidget->GetPrivateData(pWidget); |
| 1629 if (!pXFAWidget) { |
| 1630 return FALSE; |
| 1631 } |
| 1632 IXFA_DocProvider* pDocProvider = pXFAWidget->GetDoc()->GetDocProvider(); |
| 1633 if (!pDocProvider) { |
| 1634 return FALSE; |
| 1635 } |
| 1636 if (bVisible) { |
| 1637 CFX_Matrix mt; |
| 1638 pXFAWidget->GetRotateMatrix(mt); |
| 1639 CFX_RectF rt(*pRtAnchor); |
| 1640 mt.TransformRect(rt); |
| 1641 pDocProvider->DisplayCaret(pXFAWidget, bVisible, &rt); |
| 1642 return TRUE; |
| 1643 } |
| 1644 pDocProvider->DisplayCaret(pXFAWidget, bVisible, pRtAnchor); |
| 1645 return TRUE; |
| 1646 } |
| 1647 |
| 1625 void CFWL_EditImp::ShowCaret(FX_BOOL bVisible, CFX_RectF* pRect) { | 1648 void CFWL_EditImp::ShowCaret(FX_BOOL bVisible, CFX_RectF* pRect) { |
| 1626 if (m_pCaret) { | 1649 if (m_pCaret) { |
| 1627 m_pCaret->ShowCaret(bVisible); | 1650 m_pCaret->ShowCaret(bVisible); |
| 1628 if (bVisible && !pRect->IsEmpty()) { | 1651 if (bVisible && !pRect->IsEmpty()) { |
| 1629 m_pCaret->SetWidgetRect(*pRect); | 1652 m_pCaret->SetWidgetRect(*pRect); |
| 1630 } | 1653 } |
| 1631 Repaint(&m_rtEngine); | 1654 Repaint(&m_rtEngine); |
| 1632 } else { | 1655 } else { |
| 1633 IFWL_Widget* pOuter = m_pInterface; | 1656 IFWL_Widget* pOuter = m_pInterface; |
| 1634 if (bVisible) { | 1657 if (bVisible) { |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2147 } | 2170 } |
| 2148 CFX_RectF rect; | 2171 CFX_RectF rect; |
| 2149 m_pOwner->GetWidgetRect(rect); | 2172 m_pOwner->GetWidgetRect(rect); |
| 2150 CFX_RectF rtInvalidate; | 2173 CFX_RectF rtInvalidate; |
| 2151 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); | 2174 rtInvalidate.Set(0, 0, rect.width + 2, rect.height + 2); |
| 2152 m_pOwner->Repaint(&rtInvalidate); | 2175 m_pOwner->Repaint(&rtInvalidate); |
| 2153 } | 2176 } |
| 2154 return TRUE; | 2177 return TRUE; |
| 2155 } | 2178 } |
| 2156 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) {} | 2179 void CFWL_EditImpDelegate::DoCursor(CFWL_MsgMouse* pMsg) {} |
| OLD | NEW |