jaepark | 611adb8 | 2016-08-17 11:34:36 -0700 | [diff] [blame] | 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 | |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 7 | #include "fpdfsdk/cpdfsdk_xfawidget.h" |
jaepark | 611adb8 | 2016-08-17 11:34:36 -0700 | [diff] [blame] | 8 | |
dsinclair | 114e46a | 2016-09-29 17:18:21 -0700 | [diff] [blame] | 9 | #include "fpdfsdk/ipdfsdk_annothandler.h" |
Dan Sinclair | 80c4878 | 2017-03-23 12:11:20 -0400 | [diff] [blame] | 10 | #include "xfa/fxfa/cxfa_ffwidget.h" |
jaepark | 611adb8 | 2016-08-17 11:34:36 -0700 | [diff] [blame] | 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 | |
Tom Sepez | d0409af | 2017-05-25 15:53:57 -0700 | [diff] [blame] | 19 | CPDFSDK_XFAWidget::~CPDFSDK_XFAWidget() {} |
| 20 | |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 21 | bool CPDFSDK_XFAWidget::IsXFAField() { |
| 22 | return true; |
jaepark | 611adb8 | 2016-08-17 11:34:36 -0700 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | CXFA_FFWidget* CPDFSDK_XFAWidget::GetXFAWidget() const { |
Tom Sepez | d0409af | 2017-05-25 15:53:57 -0700 | [diff] [blame] | 26 | return m_hXFAWidget.Get(); |
jaepark | 611adb8 | 2016-08-17 11:34:36 -0700 | [diff] [blame] | 27 | } |
| 28 | |
jaepark | 956553e | 2016-08-31 06:49:27 -0700 | [diff] [blame] | 29 | CPDF_Annot::Subtype CPDFSDK_XFAWidget::GetAnnotSubtype() const { |
| 30 | return CPDF_Annot::Subtype::XFAWIDGET; |
jaepark | 611adb8 | 2016-08-17 11:34:36 -0700 | [diff] [blame] | 31 | } |
| 32 | |
jaepark | 611adb8 | 2016-08-17 11:34:36 -0700 | [diff] [blame] | 33 | CFX_FloatRect CPDFSDK_XFAWidget::GetRect() const { |
Dan Sinclair | c222907 | 2017-02-07 09:04:28 -0500 | [diff] [blame] | 34 | CFX_RectF rcBBox = GetXFAWidget()->GetRect(false); |
jaepark | 611adb8 | 2016-08-17 11:34:36 -0700 | [diff] [blame] | 35 | return CFX_FloatRect(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width, |
| 36 | rcBBox.top + rcBBox.height); |
| 37 | } |