1 // Copyright 2014 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #include "xfa/src/foxitlib.h" 8 #include "xfa/src/fxfa/src/common/xfa_common.h" 9 #include "xfa_fwladapter.h" 10 #include "xfa_ffwidget.h" 11 #include "xfa_fffield.h" 12 #include "xfa_ffdoc.h" 13 IFWL_AdapterNative* FWL_CreateFuelAdapterNative() { 14 return NULL; 15 } 16 void FWL_ReleaseFuelAdapterNative(IFWL_AdapterNative* native) {} 17 void FWL_PostMessageToMainRoop(CFWL_Message* pMessage) {} 18 FX_BOOL FWL_ShowCaret(IFWL_Widget* pWidget, 19 FX_BOOL bVisible, 20 const CFX_RectF* pRtAnchor) { 21 CXFA_FFWidget* pXFAWidget = (CXFA_FFWidget*)pWidget->GetPrivateData(pWidget); 22 if (!pXFAWidget) { 23 return FALSE; 24 } 25 IXFA_DocProvider* pDocProvider = pXFAWidget->GetDoc()->GetDocProvider(); 26 if (!pDocProvider) { 27 return FALSE; 28 } 29 if (bVisible) { 30 CFX_Matrix mt; 31 pXFAWidget->GetRotateMatrix(mt); 32 CFX_RectF rt(*pRtAnchor); 33 mt.TransformRect(rt); 34 pDocProvider->DisplayCaret(pXFAWidget, bVisible, &rt); 35 return TRUE; 36 } 37 pDocProvider->DisplayCaret(pXFAWidget, bVisible, pRtAnchor); 38 return TRUE; 39 } 40 FWL_ERR CXFA_FWLAdapterWidgetMgr::RepaintWidget(IFWL_Widget* pWidget, 41 const CFX_RectF* pRect) { 42 if (!pWidget) 43 return FWL_ERR_Indefinite; 44 CXFA_FFField* pField = (CXFA_FFField*)pWidget->GetPrivateData(pWidget); 45 if (!pField) 46 return FWL_ERR_Indefinite; 47 #ifdef _XFA_EMB 48 CFX_RectF rtInvalidate; 49 pWidget->GetWidgetRect(rtInvalidate); 50 if (pRect) { 51 rtInvalidate.left += pRect->left; 52 rtInvalidate.top += pRect->top; 53 rtInvalidate.width = pRect->width; 54 rtInvalidate.height = pRect->height; 55 } 56 CFX_Matrix mt; 57 pField->GetRotateMatrix(mt); 58 mt.TransformRect(rtInvalidate); 59 pField->AddInvalidateRect(&rtInvalidate); 60 #else 61 pField->AddInvalidateRect(NULL); 62 #endif 63 return FWL_ERR_Succeeded; 64 } 65 FX_BOOL CXFA_FWLAdapterWidgetMgr::GetPopupPos(IFWL_Widget* pWidget, 66 FX_FLOAT fMinHeight, 67 FX_FLOAT fMaxHeight, 68 const CFX_RectF& rtAnchor, 69 CFX_RectF& rtPopup) { 70 CXFA_FFWidget* pFFWidget = (CXFA_FFWidget*)(pWidget->GetPrivateData(pWidget)); 71 CFX_Matrix mt; 72 pFFWidget->GetRotateMatrix(mt); 73 CFX_RectF rtRotateAnchor(rtAnchor); 74 mt.TransformRect(rtRotateAnchor); 75 pFFWidget->GetDoc()->GetDocProvider()->GetPopupPos( 76 pFFWidget, fMinHeight, fMaxHeight, rtRotateAnchor, rtPopup); 77 return TRUE; 78 } 79