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