Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cffl_textobject.cpp
Go to the documentation of this file.
1// Copyright 2017 The PDFium Authors
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/formfiller/cffl_textobject.h"
8
9#include "core/fpdfapi/page/cpdf_page.h"
10#include "core/fpdfdoc/cpdf_bafontmap.h"
11#include "fpdfsdk/cpdfsdk_widget.h"
12
13CFFL_TextObject::CFFL_TextObject(CFFL_InteractiveFormFiller* pFormFiller,
14 CPDFSDK_Widget* pWidget)
15 : CFFL_FormField(pFormFiller, pWidget) {}
16
18 // Destroy view classes before this object's members are destroyed since
19 // the view classes have pointers to m_pFontMap that would be left dangling.
21}
22
23CPWL_Wnd* CFFL_TextObject::ResetPWLWindow(const CPDFSDK_PageView* pPageView) {
24 DestroyPWLWindow(pPageView);
25 ObservedPtr<CPWL_Wnd> pRet(CreateOrUpdatePWLWindow(pPageView));
26 m_pWidget->UpdateField(); // May invoke JS, invalidating |pRet|.
27 return pRet.Get();
28}
29
30CPWL_Wnd* CFFL_TextObject::RestorePWLWindow(const CPDFSDK_PageView* pPageView) {
31 SavePWLWindowState(pPageView);
32 DestroyPWLWindow(pPageView);
34 ObservedPtr<CPWL_Wnd> pRet(GetPWLWindow(pPageView));
35 m_pWidget->UpdateField(); // May invoke JS, invalidating |pRet|.
36 return pRet.Get();
37}
38
40 if (!m_pFontMap) {
41 m_pFontMap = std::make_unique<CPDF_BAFontMap>(
42 m_pWidget->GetPDFPage()->GetDocument(),
43 m_pWidget->GetPDFAnnot()->GetMutableAnnotDict(), "N");
44 }
45 return m_pFontMap.get();
46}
virtual void RecreatePWLWindowFromSavedState(const CPDFSDK_PageView *pPageView)
CFFL_FormField(CFFL_InteractiveFormFiller *pFormFiller, CPDFSDK_Widget *pWidget)
virtual void SavePWLWindowState(const CPDFSDK_PageView *pPageView)
void DestroyPWLWindow(const CPDFSDK_PageView *pPageView)
~CFFL_TextObject() override
CPDF_BAFontMap * GetOrCreateFontMap()
CFFL_TextObject(CFFL_InteractiveFormFiller *pFormFiller, CPDFSDK_Widget *pWidget)
CPWL_Wnd * ResetPWLWindow(const CPDFSDK_PageView *pPageView) override
CPWL_Wnd * RestorePWLWindow(const CPDFSDK_PageView *pPageView) override