Home | History | Annotate | Download | only in fpdfsdk
      1 // Copyright 2016 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 "fpdfsdk/cpdfsdk_xfawidget.h"
      8 
      9 #include "fpdfsdk/ipdfsdk_annothandler.h"
     10 #include "xfa/fxfa/cxfa_ffwidget.h"
     11 
     12 CPDFSDK_XFAWidget::CPDFSDK_XFAWidget(CXFA_FFWidget* pAnnot,
     13                                      CPDFSDK_PageView* pPageView,
     14                                      CPDFSDK_InterForm* pInterForm)
     15     : CPDFSDK_Annot(pPageView),
     16       m_pInterForm(pInterForm),
     17       m_hXFAWidget(pAnnot) {}
     18 
     19 CPDFSDK_XFAWidget::~CPDFSDK_XFAWidget() {}
     20 
     21 bool CPDFSDK_XFAWidget::IsXFAField() {
     22   return true;
     23 }
     24 
     25 CXFA_FFWidget* CPDFSDK_XFAWidget::GetXFAWidget() const {
     26   return m_hXFAWidget.Get();
     27 }
     28 
     29 CPDF_Annot::Subtype CPDFSDK_XFAWidget::GetAnnotSubtype() const {
     30   return CPDF_Annot::Subtype::XFAWIDGET;
     31 }
     32 
     33 CFX_FloatRect CPDFSDK_XFAWidget::GetRect() const {
     34   CFX_RectF rcBBox = GetXFAWidget()->GetRect(false);
     35   return CFX_FloatRect(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width,
     36                        rcBBox.top + rcBBox.height);
     37 }
     38