summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/doc_utils.h
blob: ed687943da8f788226ed71cbeee8d5189246db8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// 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_FPDFDOC_DOC_UTILS_H_
#define CORE_FPDFDOC_DOC_UTILS_H_

#include <vector>

#include "core/include/fpdfapi/cpdf_parser.h"
#include "core/include/fpdfapi/fpdf_resource.h"

class CPDF_Dictionary;
class CPDF_FormField;

class CPDF_NumberTree {
 public:
  CPDF_NumberTree(CPDF_Dictionary* pRoot) : m_pRoot(pRoot) {}
  CPDF_Object* LookupValue(int num) const;

 protected:
  CPDF_Dictionary* const m_pRoot;
};

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,
                                  uint8_t 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,
                                  uint8_t 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);
std::vector<bool> SaveCheckedFieldStatus(CPDF_FormField* pField);
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_FPDFDOC_DOC_UTILS_H_