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 "../include/fsdk_define.h" | 7 #include "../include/fsdk_define.h" |
8 #include "../include/fpdfdoc.h" | 8 #include "../include/fpdfdoc.h" |
9 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 9 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
10 #include "../include/fpdfxfa/fpdfxfa_page.h" | 10 #include "../include/fpdfxfa/fpdfxfa_page.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BO
OKMARK pDict) | 79 DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, FPDF_BO
OKMARK pDict) |
80 { | 80 { |
81 if (!document) | 81 if (!document) |
82 return NULL; | 82 return NULL; |
83 if (!pDict) | 83 if (!pDict) |
84 return NULL; | 84 return NULL; |
85 CPDF_Bookmark bookmark((CPDF_Dictionary*)pDict); | 85 CPDF_Bookmark bookmark((CPDF_Dictionary*)pDict); |
86 CPDF_Document* pDoc = ((CPDFXFA_Document*)document)->GetPDFDoc(); | 86 CPDF_Document* pDoc = ((CPDFXFA_Document*)document)->GetPDFDoc(); |
87 CPDF_Dest dest = bookmark.GetDest(pDoc); | 87 CPDF_Dest dest = bookmark.GetDest(pDoc); |
88 if (dest) | 88 if (dest) |
89 » » return dest; | 89 » » return dest.GetObject(); |
90 // If this bookmark is not directly associated with a dest, we try to ge
t action | 90 // If this bookmark is not directly associated with a dest, we try to ge
t action |
91 CPDF_Action action = bookmark.GetAction(); | 91 CPDF_Action action = bookmark.GetAction(); |
92 if (!action) | 92 if (!action) |
93 return NULL; | 93 return NULL; |
94 » return action.GetDest(pDoc); | 94 » return action.GetDest(pDoc).GetObject(); |
95 } | 95 } |
96 | 96 |
97 DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction(FPDF_BOOKMARK pDict) | 97 DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction(FPDF_BOOKMARK pDict) |
98 { | 98 { |
99 if (!pDict) | 99 if (!pDict) |
100 return NULL; | 100 return NULL; |
101 CPDF_Bookmark bookmark((CPDF_Dictionary*)pDict); | 101 CPDF_Bookmark bookmark((CPDF_Dictionary*)pDict); |
102 return bookmark.GetAction().GetDict(); | 102 return bookmark.GetAction().GetDict(); |
103 } | 103 } |
104 | 104 |
(...skipping 19 matching lines...) Expand all Loading... |
124 } | 124 } |
125 | 125 |
126 DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document, FPDF_ACTI
ON pDict) | 126 DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document, FPDF_ACTI
ON pDict) |
127 { | 127 { |
128 if (!document) | 128 if (!document) |
129 return NULL; | 129 return NULL; |
130 if (!pDict) | 130 if (!pDict) |
131 return NULL; | 131 return NULL; |
132 CPDF_Document* pDoc = ((CPDFXFA_Document*)document)->GetPDFDoc(); | 132 CPDF_Document* pDoc = ((CPDFXFA_Document*)document)->GetPDFDoc(); |
133 CPDF_Action action((CPDF_Dictionary*)pDict); | 133 CPDF_Action action((CPDF_Dictionary*)pDict); |
134 » return action.GetDest(pDoc); | 134 » return action.GetDest(pDoc).GetObject(); |
135 } | 135 } |
136 | 136 |
137 DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document, FP
DF_ACTION pDict, | 137 DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document, FP
DF_ACTION pDict, |
138
void* buffer, unsigned long buflen) | 138
void* buffer, unsigned long buflen) |
139 { | 139 { |
140 if (!document) | 140 if (!document) |
141 return 0; | 141 return 0; |
142 if (!pDict) | 142 if (!pDict) |
143 return 0; | 143 return 0; |
144 CPDF_Document* pDoc = ((CPDFXFA_Document*)document)->GetPDFDoc(); | 144 CPDF_Document* pDoc = ((CPDFXFA_Document*)document)->GetPDFDoc(); |
145 CPDF_Action action((CPDF_Dictionary*)pDict); | 145 CPDF_Action action((CPDF_Dictionary*)pDict); |
146 CFX_ByteString path = action.GetURI(pDoc); | 146 CFX_ByteString path = action.GetURI(pDoc); |
147 unsigned long len = path.GetLength() + 1; | 147 unsigned long len = path.GetLength() + 1; |
148 if (buffer != NULL && buflen >= len) | 148 if (buffer != NULL && buflen >= len) |
149 FXSYS_memcpy(buffer, path.c_str(), len); | 149 FXSYS_memcpy(buffer, path.c_str(), len); |
150 return len; | 150 return len; |
151 } | 151 } |
152 | 152 |
153 DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document, FP
DF_DEST pDict) | 153 DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document, FP
DF_DEST pDict) |
154 { | 154 { |
155 if (!document) | 155 if (!document) |
156 return 0; | 156 return 0; |
157 if (!pDict) | 157 if (!pDict) |
158 return 0; | 158 return 0; |
159 CPDF_Document* pDoc = ((CPDFXFA_Document*)document)->GetPDFDoc(); | 159 CPDF_Document* pDoc = ((CPDFXFA_Document*)document)->GetPDFDoc(); |
160 » CPDF_Dest dest = (CPDF_Array*)pDict; | 160 » CPDF_Dest dest((CPDF_Array*)pDict); |
161 return dest.GetPageIndex(pDoc); | 161 return dest.GetPageIndex(pDoc); |
162 } | 162 } |
163 | 163 |
164 static void ReleaseLinkList(FX_LPVOID data) | 164 static void ReleaseLinkList(FX_LPVOID data) |
165 { | 165 { |
166 delete (CPDF_LinkList*)data; | 166 delete (CPDF_LinkList*)data; |
167 } | 167 } |
168 | 168 |
169 DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page, double x, do
uble y) | 169 DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page, double x, do
uble y) |
170 { | 170 { |
(...skipping 14 matching lines...) Expand all Loading... |
185 | 185 |
186 DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document, FPDF_LINK p
Dict) | 186 DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document, FPDF_LINK p
Dict) |
187 { | 187 { |
188 if (!document) | 188 if (!document) |
189 return NULL; | 189 return NULL; |
190 CPDF_Document* pDoc = ((CPDFXFA_Document*)document)->GetPDFDoc(); | 190 CPDF_Document* pDoc = ((CPDFXFA_Document*)document)->GetPDFDoc(); |
191 if (!pDict) | 191 if (!pDict) |
192 return NULL; | 192 return NULL; |
193 CPDF_Link link = (CPDF_Dictionary*)pDict; | 193 CPDF_Link link = (CPDF_Dictionary*)pDict; |
194 | 194 |
195 » FPDF_DEST dest = link.GetDest(pDoc); | 195 » FPDF_DEST dest = link.GetDest(pDoc).GetObject(); |
196 if (dest) | 196 if (dest) |
197 return dest; | 197 return dest; |
198 // If this link is not directly associated with a dest, we try to get ac
tion | 198 // If this link is not directly associated with a dest, we try to get ac
tion |
199 CPDF_Action action = link.GetAction(); | 199 CPDF_Action action = link.GetAction(); |
200 if (!action) | 200 if (!action) |
201 return NULL; | 201 return NULL; |
202 » return action.GetDest(pDoc); | 202 » return action.GetDest(pDoc).GetObject(); |
203 } | 203 } |
204 | 204 |
205 DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction(FPDF_LINK pDict) | 205 DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction(FPDF_LINK pDict) |
206 { | 206 { |
207 if (!pDict) | 207 if (!pDict) |
208 return NULL; | 208 return NULL; |
209 CPDF_Link link = (CPDF_Dictionary*)pDict; | 209 CPDF_Link link = (CPDF_Dictionary*)pDict; |
210 return link.GetAction().GetDict(); | 210 return link.GetAction().GetDict(); |
211 } | 211 } |
212 | 212 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 return 0; | 292 return 0; |
293 CFX_WideString text = pInfo->GetUnicodeText(tag); | 293 CFX_WideString text = pInfo->GetUnicodeText(tag); |
294 // Use UTF-16LE encoding | 294 // Use UTF-16LE encoding |
295 CFX_ByteString encodedText = text.UTF16LE_Encode(); | 295 CFX_ByteString encodedText = text.UTF16LE_Encode(); |
296 unsigned long len = encodedText.GetLength(); | 296 unsigned long len = encodedText.GetLength(); |
297 if (buffer && buflen >= len) { | 297 if (buffer && buflen >= len) { |
298 FXSYS_memcpy(buffer, encodedText.c_str(), len); | 298 FXSYS_memcpy(buffer, encodedText.c_str(), len); |
299 } | 299 } |
300 return len; | 300 return len; |
301 } | 301 } |
OLD | NEW |