From 2eddb665763f3e089d4c210d2a011d112683f3ea Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 25 May 2017 16:49:51 -0400 Subject: Split apart remaining xfa/fxfa/app files This CL splits the remaining files in xfa/fxfa/app into individual files named after the classes. Change-Id: I84bd8938937641bb6897614ed15558a2682f456c Reviewed-on: https://pdfium-review.googlesource.com/6010 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- xfa/fxfa/app/cxfa_ffpasswordedit.cpp | 64 ++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 xfa/fxfa/app/cxfa_ffpasswordedit.cpp (limited to 'xfa/fxfa/app/cxfa_ffpasswordedit.cpp') diff --git a/xfa/fxfa/app/cxfa_ffpasswordedit.cpp b/xfa/fxfa/app/cxfa_ffpasswordedit.cpp new file mode 100644 index 0000000000..1b404fa046 --- /dev/null +++ b/xfa/fxfa/app/cxfa_ffpasswordedit.cpp @@ -0,0 +1,64 @@ +// Copyright 2017 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "xfa/fxfa/app/cxfa_ffpasswordedit.h" + +#include + +#include "xfa/fwl/cfwl_edit.h" +#include "xfa/fwl/cfwl_notedriver.h" + +CXFA_FFPasswordEdit::CXFA_FFPasswordEdit(CXFA_WidgetAcc* pDataAcc) + : CXFA_FFTextEdit(pDataAcc) {} + +CXFA_FFPasswordEdit::~CXFA_FFPasswordEdit() {} + +bool CXFA_FFPasswordEdit::LoadWidget() { + auto pNewEdit = pdfium::MakeUnique( + GetFWLApp(), pdfium::MakeUnique(), nullptr); + CFWL_Edit* pWidget = pNewEdit.get(); + m_pNormalWidget = std::move(pNewEdit); + m_pNormalWidget->SetLayoutItem(this); + + CFWL_NoteDriver* pNoteDriver = + m_pNormalWidget->GetOwnerApp()->GetNoteDriver(); + pNoteDriver->RegisterEventTarget(m_pNormalWidget.get(), + m_pNormalWidget.get()); + m_pOldDelegate = m_pNormalWidget->GetDelegate(); + m_pNormalWidget->SetDelegate(this); + m_pNormalWidget->LockUpdate(); + + CFX_WideString wsText; + m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); + pWidget->SetText(wsText); + UpdateWidgetProperty(); + m_pNormalWidget->UnlockUpdate(); + return CXFA_FFField::LoadWidget(); +} + +void CXFA_FFPasswordEdit::UpdateWidgetProperty() { + CFWL_Edit* pWidget = static_cast(m_pNormalWidget.get()); + if (!pWidget) + return; + + uint32_t dwExtendedStyle = + FWL_STYLEEXT_EDT_ShowScrollbarFocus | FWL_STYLEEXT_EDT_OuterScrollbar | + FWL_STYLEEXT_EDT_Password | FWL_STYLEEXT_EDT_LastLineHeight; + dwExtendedStyle |= UpdateUIProperty(); + + CFX_WideString wsPassWord; + m_pDataAcc->GetPasswordChar(wsPassWord); + if (!wsPassWord.IsEmpty()) + pWidget->SetAliasChar(wsPassWord.GetAt(0)); + if (m_pDataAcc->GetHorizontalScrollPolicy() != XFA_ATTRIBUTEENUM_Off) + dwExtendedStyle |= FWL_STYLEEXT_EDT_AutoHScroll; + if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open || + !m_pDataAcc->GetDoc()->GetXFADoc()->IsInteractive()) { + dwExtendedStyle |= FWL_STYLEEXT_EDT_ReadOnly; + } + dwExtendedStyle |= GetAlignment(); + m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); +} -- cgit v1.2.3