From eff208f03dc7ea7606a3dc03150291f264147d60 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 8 May 2015 13:45:01 -0700 Subject: Merge to XFA: Move function prototypes to new doc_utils.h file Original Review URL: https://codereview.chromium.org/1128193004 TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1137783002 --- BUILD.gn | 1 + core/src/fpdfdoc/doc_form.cpp | 25 +++---------------------- core/src/fpdfdoc/doc_formfield.cpp | 4 ++-- core/src/fpdfdoc/doc_utils.cpp | 25 +++---------------------- core/src/fpdfdoc/doc_utils.h | 33 +++++++++++++++++++++++++++++++++ pdfium.gyp | 1 + 6 files changed, 43 insertions(+), 46 deletions(-) create mode 100644 core/src/fpdfdoc/doc_utils.h diff --git a/BUILD.gn b/BUILD.gn index 7f6bcc1682..6a1b615db4 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -163,6 +163,7 @@ static_library("fpdfdoc") { "core/src/fpdfdoc/doc_ocg.cpp", "core/src/fpdfdoc/doc_tagged.cpp", "core/src/fpdfdoc/doc_utils.cpp", + "core/src/fpdfdoc/doc_utils.h", "core/src/fpdfdoc/doc_viewerPreferences.cpp", "core/src/fpdfdoc/doc_vt.cpp", "core/src/fpdfdoc/doc_vtmodule.cpp", diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp index 87887d7330..dff6039bc8 100644 --- a/core/src/fpdfdoc/doc_form.cpp +++ b/core/src/fpdfdoc/doc_form.cpp @@ -6,29 +6,10 @@ #include "../../include/fpdfdoc/fpdf_doc.h" #include "../../include/fxcrt/fx_xml.h" -CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict); -void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument); -FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict); -CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, FX_DWORD index, CFX_ByteString& csNameTag); -CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csNameTag); -CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csFontName, CFX_ByteString& csNameTag); -CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, FX_BYTE charSet, CFX_ByteString& csNameTag); -CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString& csNameTag); -FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont, CFX_ByteString& csNameTag); -FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag); -void AddInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, const CPDF_Font* pFont, CFX_ByteString& csNameTag); -CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, FX_BYTE charSet, CFX_ByteString& csNameTag); -CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, CFX_ByteString& csNameTag); -void RemoveInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont); -void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag); -CPDF_Font* GetDefaultInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument); -void SetDefaultInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, const CPDF_Font* pFont); -void SaveCheckedFieldStatus(CPDF_FormField* pField, CFX_ByteArray& statusArray); -FX_BOOL NeedPDFEncodeForFieldFullName(const CFX_WideString& csFieldName); -FX_BOOL NeedPDFEncodeForFieldTree(CPDF_Dictionary* pFieldDict, int nLevel = 0); -void EncodeFieldName(const CFX_WideString& csName, CFX_ByteString& csT); -void UpdateEncodeFieldName(CPDF_Dictionary* pFieldDict, int nLevel = 0); +#include "doc_utils.h" + const int nMaxRecursion = 32; + class _CFieldNameExtractor { public: diff --git a/core/src/fpdfdoc/doc_formfield.cpp b/core/src/fpdfdoc/doc_formfield.cpp index 9964c71cde..985139055c 100644 --- a/core/src/fpdfdoc/doc_formfield.cpp +++ b/core/src/fpdfdoc/doc_formfield.cpp @@ -5,8 +5,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/fpdfdoc/fpdf_doc.h" -CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict); -void SaveCheckedFieldStatus(CPDF_FormField* pField, CFX_ByteArray& statusArray); +#include "doc_utils.h" + FX_BOOL PDF_FormField_IsUnison(CPDF_FormField *pField) { FX_BOOL bUnison = FALSE; diff --git a/core/src/fpdfdoc/doc_utils.cpp b/core/src/fpdfdoc/doc_utils.cpp index ad958adbf2..35e001ea69 100644 --- a/core/src/fpdfdoc/doc_utils.cpp +++ b/core/src/fpdfdoc/doc_utils.cpp @@ -5,29 +5,10 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/fpdfdoc/fpdf_doc.h" +#include "doc_utils.h" + static const int FPDFDOC_UTILS_MAXRECURSION = 32; -CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict); -void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument); -FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict); -CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, FX_DWORD index, CFX_ByteString& csNameTag); -CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csNameTag); -CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csFontName, CFX_ByteString& csNameTag); -CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, FX_BYTE charSet, CFX_ByteString& csNameTag); -CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString& csNameTag); -FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont, CFX_ByteString& csNameTag); -FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag); -void AddInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, const CPDF_Font* pFont, CFX_ByteString& csNameTag); -CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, FX_BYTE charSet, CFX_ByteString& csNameTag); -CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, CFX_ByteString& csNameTag); -void RemoveInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont); -void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag); -CPDF_Font* GetDefaultInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument); -void SetDefaultInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, const CPDF_Font* pFont); -void SaveCheckedFieldStatus(CPDF_FormField* pField, CFX_ByteArray& statusArray); -FX_BOOL NeedPDFEncodeForFieldFullName(const CFX_WideString& csFieldName); -FX_BOOL NeedPDFEncodeForFieldTree(CPDF_Dictionary* pFieldDict, int nLevel = 0); -void EncodeFieldName(const CFX_WideString& csName, CFX_ByteString& csT); -void UpdateEncodeFieldName(CPDF_Dictionary* pFieldDict, int nLevel = 0); + CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict) { CFX_WideString full_name; diff --git a/core/src/fpdfdoc/doc_utils.h b/core/src/fpdfdoc/doc_utils.h new file mode 100644 index 0000000000..08c4e7e552 --- /dev/null +++ b/core/src/fpdfdoc/doc_utils.h @@ -0,0 +1,33 @@ +// Copyright 2015 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 + +#ifndef CORE_SRC_FPDFDOC_DOC_UTILS_H_ +#define CORE_SRC_FPDFDOC_DOC_UTILS_H_ + +CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict); +void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument); +FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict); +CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, FX_DWORD index, CFX_ByteString& csNameTag); +CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csNameTag); +CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csFontName, CFX_ByteString& csNameTag); +CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, FX_BYTE charSet, CFX_ByteString& csNameTag); +CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString& csNameTag); +FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont, CFX_ByteString& csNameTag); +FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag); +void AddInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, const CPDF_Font* pFont, CFX_ByteString& csNameTag); +CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, FX_BYTE charSet, CFX_ByteString& csNameTag); +CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, CFX_ByteString& csNameTag); +void RemoveInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont); +void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag); +CPDF_Font* GetDefaultInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument); +void SetDefaultInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, const CPDF_Font* pFont); +void SaveCheckedFieldStatus(CPDF_FormField* pField, CFX_ByteArray& statusArray); +FX_BOOL NeedPDFEncodeForFieldFullName(const CFX_WideString& csFieldName); +FX_BOOL NeedPDFEncodeForFieldTree(CPDF_Dictionary* pFieldDict, int nLevel = 0); +void EncodeFieldName(const CFX_WideString& csName, CFX_ByteString& csT); +void UpdateEncodeFieldName(CPDF_Dictionary* pFieldDict, int nLevel = 0); + +#endif // CORE_SRC_FPDFDOC_DOC_UTILS_H_ diff --git a/pdfium.gyp b/pdfium.gyp index b84647ce1b..f823d594e1 100644 --- a/pdfium.gyp +++ b/pdfium.gyp @@ -179,6 +179,7 @@ 'core/src/fpdfdoc/doc_ocg.cpp', 'core/src/fpdfdoc/doc_tagged.cpp', 'core/src/fpdfdoc/doc_utils.cpp', + 'core/src/fpdfdoc/doc_utils.h', 'core/src/fpdfdoc/doc_viewerPreferences.cpp', 'core/src/fpdfdoc/doc_vt.cpp', 'core/src/fpdfdoc/doc_vtmodule.cpp', -- cgit v1.2.3