OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 "fpdfsdk/include/cpdfsdk_widgethandler.h" | 7 #include "fpdfsdk/include/cpdfsdk_widgethandler.h" |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <vector> | 10 #include <vector> |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 234 |
235 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot); | 235 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot); |
236 if (!pWidget->IsAppearanceValid()) | 236 if (!pWidget->IsAppearanceValid()) |
237 pWidget->ResetAppearance(nullptr, FALSE); | 237 pWidget->ResetAppearance(nullptr, FALSE); |
238 | 238 |
239 int nFieldType = pWidget->GetFieldType(); | 239 int nFieldType = pWidget->GetFieldType(); |
240 if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) { | 240 if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) { |
241 FX_BOOL bFormatted = FALSE; | 241 FX_BOOL bFormatted = FALSE; |
242 CFX_WideString sValue = pWidget->OnFormat(bFormatted); | 242 CFX_WideString sValue = pWidget->OnFormat(bFormatted); |
243 if (bFormatted && nFieldType == FIELDTYPE_COMBOBOX) | 243 if (bFormatted && nFieldType == FIELDTYPE_COMBOBOX) |
244 pWidget->ResetAppearance(sValue.c_str(), FALSE); | 244 pWidget->ResetAppearance(&sValue, FALSE); |
245 } | 245 } |
246 | 246 |
247 #ifdef PDF_ENABLE_XFA | 247 #ifdef PDF_ENABLE_XFA |
248 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); | 248 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); |
249 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); | 249 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); |
250 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); | 250 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); |
251 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) { | 251 if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) { |
252 if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty()) | 252 if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty()) |
253 pWidget->ResetAppearance(FALSE); | 253 pWidget->ResetAppearance(FALSE); |
254 } | 254 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 290 |
291 FX_BOOL CPDFSDK_WidgetHandler::HitTest(CPDFSDK_PageView* pPageView, | 291 FX_BOOL CPDFSDK_WidgetHandler::HitTest(CPDFSDK_PageView* pPageView, |
292 CPDFSDK_Annot* pAnnot, | 292 CPDFSDK_Annot* pAnnot, |
293 const CFX_FloatPoint& point) { | 293 const CFX_FloatPoint& point) { |
294 ASSERT(pPageView); | 294 ASSERT(pPageView); |
295 ASSERT(pAnnot); | 295 ASSERT(pAnnot); |
296 | 296 |
297 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot); | 297 CFX_FloatRect rect = GetViewBBox(pPageView, pAnnot); |
298 return rect.Contains(point.x, point.y); | 298 return rect.Contains(point.x, point.y); |
299 } | 299 } |
OLD | NEW |