OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "../../include/formfiller/FormFiller.h" | 9 #include "../../include/formfiller/FormFiller.h" |
10 #include "../../include/formfiller/FFL_Utils.h" | 10 #include "../../include/formfiller/FFL_Utils.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 CPDF_Rect CFFL_Utils::DeflateRect(const CPDF_Rect & crRect,const FX_FLOAT & fSiz
e) | 34 CPDF_Rect CFFL_Utils::DeflateRect(const CPDF_Rect & crRect,const FX_FLOAT & fSiz
e) |
35 { | 35 { |
36 CPDF_Rect crNew(crRect.left + fSize, | 36 CPDF_Rect crNew(crRect.left + fSize, |
37 crRect.bottom + fSize, | 37 crRect.bottom + fSize, |
38 crRect.right - fSize, | 38 crRect.right - fSize, |
39 crRect.top - fSize); | 39 crRect.top - fSize); |
40 crNew.Normalize(); | 40 crNew.Normalize(); |
41 return crNew; | 41 return crNew; |
42 } | 42 } |
43 | 43 |
44 FX_BOOL CFFL_Utils::TraceObject(CPDF_Object* pObj) | 44 bool CFFL_Utils::TraceObject(CPDF_Object* pObj) |
45 { | 45 { |
46 » if (!pObj) return FALSE; | 46 » if (!pObj) return false; |
47 | 47 |
48 FX_DWORD dwObjNum = pObj->GetObjNum(); | 48 FX_DWORD dwObjNum = pObj->GetObjNum(); |
49 switch (pObj->GetType()) | 49 switch (pObj->GetType()) |
50 { | 50 { |
51 case PDFOBJ_ARRAY: | 51 case PDFOBJ_ARRAY: |
52 { | 52 { |
53 CPDF_Array* pArray = (CPDF_Array*)pObj; | 53 CPDF_Array* pArray = (CPDF_Array*)pObj; |
54 for (FX_DWORD i = 0; i < pArray->GetCount(); i ++) | 54 for (FX_DWORD i = 0; i < pArray->GetCount(); i ++) |
55 { | 55 { |
56 CPDF_Object* pElement = pArray->GetElementValue(
i); | 56 CPDF_Object* pElement = pArray->GetElementValue(
i); |
57 TraceObject(pElement); | 57 TraceObject(pElement); |
58 } | 58 } |
59 } | 59 } |
60 break; | 60 break; |
61 | 61 |
62 case PDFOBJ_DICTIONARY: | 62 case PDFOBJ_DICTIONARY: |
63 { | 63 { |
64 CPDF_Dictionary* pDict = (CPDF_Dictionary*)pObj; | 64 CPDF_Dictionary* pDict = (CPDF_Dictionary*)pObj; |
65 | 65 |
66 FX_POSITION fPos = pDict->GetStartPos(); | 66 FX_POSITION fPos = pDict->GetStartPos(); |
67 CFX_ByteString csKey; | 67 CFX_ByteString csKey; |
68 do | 68 do |
69 { | 69 { |
70 CPDF_Object* pElement = pDict->GetNextElement(fP
os, csKey); | 70 CPDF_Object* pElement = pDict->GetNextElement(fP
os, csKey); |
71 //TRACE(csKey + "\n"); | 71 //TRACE(csKey + "\n"); |
72 if (!pElement) break; | 72 if (!pElement) break; |
73 TraceObject(pElement); | 73 TraceObject(pElement); |
74 » » » }while (TRUE); | 74 » » » }while (true); |
75 } | 75 } |
76 break; | 76 break; |
77 | 77 |
78 case PDFOBJ_STREAM: | 78 case PDFOBJ_STREAM: |
79 { | 79 { |
80 CPDF_Stream* pStream = (CPDF_Stream*)pObj; | 80 CPDF_Stream* pStream = (CPDF_Stream*)pObj; |
81 CPDF_Dictionary* pDict = pStream->GetDict(); | 81 CPDF_Dictionary* pDict = pStream->GetDict(); |
82 TraceObject(pDict); | 82 TraceObject(pDict); |
83 } | 83 } |
84 break; | 84 break; |
(...skipping 15 matching lines...) Expand all Loading... |
100 break; | 100 break; |
101 case PDFOBJ_NAME: | 101 case PDFOBJ_NAME: |
102 //TRACE(((CPDF_Name*)pObj)->GetString() + "\n"); | 102 //TRACE(((CPDF_Name*)pObj)->GetString() + "\n"); |
103 break; | 103 break; |
104 case PDFOBJ_NULL: | 104 case PDFOBJ_NULL: |
105 // case PDFOBJ_KEYWORD: | 105 // case PDFOBJ_KEYWORD: |
106 // case PDFOBJ_EOF: | 106 // case PDFOBJ_EOF: |
107 default: | 107 default: |
108 break; | 108 break; |
109 } | 109 } |
110 » if (dwObjNum == 0) return FALSE; | 110 » if (dwObjNum == 0) return false; |
111 | 111 |
112 » return TRUE; | 112 » return true; |
113 } | 113 } |
114 | 114 |
OLD | NEW |