summaryrefslogtreecommitdiff
path: root/fpdfsdk/formfiller/cffl_textobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/formfiller/cffl_textobject.cpp')
-rw-r--r--fpdfsdk/formfiller/cffl_textobject.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/fpdfsdk/formfiller/cffl_textobject.cpp b/fpdfsdk/formfiller/cffl_textobject.cpp
new file mode 100644
index 0000000000..d84557eb88
--- /dev/null
+++ b/fpdfsdk/formfiller/cffl_textobject.cpp
@@ -0,0 +1,35 @@
+// 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 "fpdfsdk/formfiller/cffl_textobject.h"
+
+CPWL_Wnd* CFFL_TextObject::ResetPDFWindow(CPDFSDK_PageView* pPageView,
+ bool bRestoreValue) {
+ if (bRestoreValue)
+ SaveState(pPageView);
+
+ DestroyPDFWindow(pPageView);
+ if (bRestoreValue)
+ RestoreState(pPageView);
+
+ CPWL_Wnd::ObservedPtr pRet(GetPDFWindow(pPageView, !bRestoreValue));
+ m_pWidget->UpdateField(); // May invoke JS, invalidating |pRet|.
+ return pRet.Get();
+}
+
+CFFL_TextObject::CFFL_TextObject(CPDFSDK_FormFillEnvironment* pApp,
+ CPDFSDK_Widget* pWidget)
+ : CFFL_FormFiller(pApp, pWidget) {}
+
+CFFL_TextObject::~CFFL_TextObject() {}
+
+CBA_FontMap* CFFL_TextObject::MaybeCreateFontMap() {
+ if (!m_pFontMap) {
+ m_pFontMap =
+ pdfium::MakeUnique<CBA_FontMap>(m_pWidget.Get(), GetSystemHandler());
+ }
+ return m_pFontMap.get();
+}