1 // Copyright 2015 PDFium Authors. All rights reserved.
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 #ifndef CORE_SRC_FPDFDOC_DOC_UTILS_H_
8 #define CORE_SRC_FPDFDOC_DOC_UTILS_H_
9 
10 CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict);
11 void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument);
12 FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict);
13 CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict,
14                             CPDF_Document* pDocument,
15                             FX_DWORD index,
16                             CFX_ByteString& csNameTag);
17 CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict,
18                             CPDF_Document* pDocument,
19                             CFX_ByteString csNameTag);
20 CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict,
21                             CPDF_Document* pDocument,
22                             CFX_ByteString csFontName,
23                             CFX_ByteString& csNameTag);
24 CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict,
25                                   CPDF_Document* pDocument,
26                                   uint8_t charSet,
27                                   CFX_ByteString& csNameTag);
28 CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict,
29                                   CPDF_Document* pDocument,
30                                   CFX_ByteString& csNameTag);
31 FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict,
32                           const CPDF_Font* pFont,
33                           CFX_ByteString& csNameTag);
34 FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict,
35                           CPDF_Document* pDocument,
36                           CFX_ByteString csFontName,
37                           CPDF_Font*& pFont,
38                           CFX_ByteString& csNameTag);
39 void AddInterFormFont(CPDF_Dictionary*& pFormDict,
40                       CPDF_Document* pDocument,
41                       const CPDF_Font* pFont,
42                       CFX_ByteString& csNameTag);
43 CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict,
44                                   CPDF_Document* pDocument,
45                                   uint8_t charSet,
46                                   CFX_ByteString& csNameTag);
47 CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict,
48                                   CPDF_Document* pDocument,
49                                   CFX_ByteString& csNameTag);
50 void RemoveInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont);
51 void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag);
52 CPDF_Font* GetDefaultInterFormFont(CPDF_Dictionary* pFormDict,
53                                    CPDF_Document* pDocument);
54 void SetDefaultInterFormFont(CPDF_Dictionary*& pFormDict,
55                              CPDF_Document* pDocument,
56                              const CPDF_Font* pFont);
57 void SaveCheckedFieldStatus(CPDF_FormField* pField, CFX_ByteArray& statusArray);
58 FX_BOOL NeedPDFEncodeForFieldFullName(const CFX_WideString& csFieldName);
59 FX_BOOL NeedPDFEncodeForFieldTree(CPDF_Dictionary* pFieldDict, int nLevel = 0);
60 void EncodeFieldName(const CFX_WideString& csName, CFX_ByteString& csT);
61 void UpdateEncodeFieldName(CPDF_Dictionary* pFieldDict, int nLevel = 0);
62 
63 #endif  // CORE_SRC_FPDFDOC_DOC_UTILS_H_
64