diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-07-24 10:52:57 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-24 18:29:54 +0000 |
commit | 24ef63300f167ac63fb1f7fe8d3323ed6bce1695 (patch) | |
tree | f33867ff05da0f1ca16860721814da9400352599 /xfa/fxfa/cxfa_ffpasswordedit.cpp | |
parent | beef5e45e5431c04c09d8ac61093aca34e29f90c (diff) | |
download | pdfium-24ef63300f167ac63fb1f7fe8d3323ed6bce1695.tar.xz |
Move xfa/fxfa/app to xfa/fxfachromium/3166
There currently exists a weird split where some files exist in xfa/fxfa
and some files exist in xfa/fxfa/app. This CL removes the app/ folder
and moves all files up to the parent directory.
Change-Id: I00c87851a1ebc5a7a636eb9a17b58ba3f1708a84
Reviewed-on: https://pdfium-review.googlesource.com/8810
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_ffpasswordedit.cpp')
-rw-r--r-- | xfa/fxfa/cxfa_ffpasswordedit.cpp | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/xfa/fxfa/cxfa_ffpasswordedit.cpp b/xfa/fxfa/cxfa_ffpasswordedit.cpp new file mode 100644 index 0000000000..e0d9f33428 --- /dev/null +++ b/xfa/fxfa/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/cxfa_ffpasswordedit.h" + +#include <utility> + +#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<CFWL_Edit>( + GetFWLApp(), pdfium::MakeUnique<CFWL_WidgetProperties>(), 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<CFWL_Edit*>(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); +} |