| 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 "../../public/fpdf_doc.h" | 8 #include "../../public/fpdf_doc.h" |
| 9 | 9 |
| 10 static int THISMODULE = 0; | 10 static int THISMODULE = 0; |
| 11 | 11 |
| 12 static CPDF_Bookmark FindBookmark(const CPDF_BookmarkTree& tree, CPDF_Bookmark b
ookmark, const CFX_WideString& title) | 12 static CPDF_Bookmark FindBookmark(const CPDF_BookmarkTree& tree, CPDF_Bookmark b
ookmark, const CFX_WideString& title) |
| 13 { | 13 { |
| 14 » if (bookmark && bookmark.GetTitle().CompareNoCase(title.c_str()) == 0) { | 14 if (bookmark && bookmark.GetTitle().CompareNoCase(title.c_str()) == 0) { |
| 15 » » // First check this item | 15 // First check this item |
| 16 » » return bookmark; | 16 return bookmark; |
| 17 » } | 17 } |
| 18 » // go into children items | 18 // go into children items |
| 19 » CPDF_Bookmark child = tree.GetFirstChild(bookmark); | 19 CPDF_Bookmark child = tree.GetFirstChild(bookmark); |
| 20 » while (child) { | 20 while (child) { |
| 21 » » // check if this item | 21 // check if this item |
| 22 » » CPDF_Bookmark found = FindBookmark(tree, child, title); | 22 CPDF_Bookmark found = FindBookmark(tree, child, title); |
| 23 » » if (found) | 23 if (found) |
| 24 » » » return found; | 24 return found; |
| 25 » » child = tree.GetNextSibling(child); | 25 child = tree.GetNextSibling(child); |
| 26 » } | 26 } |
| 27 » return CPDF_Bookmark(); | 27 return CPDF_Bookmark(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_GetFirstChild(FPDF_DOCUMENT documen
t, FPDF_BOOKMARK pDict) | 30 DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_GetFirstChild(FPDF_DOCUMENT documen
t, FPDF_BOOKMARK pDict) |
| 31 { | 31 { |
| 32 if (!document) | 32 if (!document) |
| 33 return NULL; | 33 return NULL; |
| 34 CPDF_Document* pDoc = (CPDF_Document*)document; | 34 CPDF_Document* pDoc = (CPDF_Document*)document; |
| 35 CPDF_BookmarkTree tree(pDoc); | 35 CPDF_BookmarkTree tree(pDoc); |
| 36 CPDF_Bookmark bookmark = CPDF_Bookmark((CPDF_Dictionary*)pDict); | 36 CPDF_Bookmark bookmark = CPDF_Bookmark((CPDF_Dictionary*)pDict); |
| 37 return tree.GetFirstChild(bookmark).GetDict(); | 37 return tree.GetFirstChild(bookmark).GetDict(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 56 CFX_ByteString encodedTitle = title.UTF16LE_Encode(); | 56 CFX_ByteString encodedTitle = title.UTF16LE_Encode(); |
| 57 unsigned long len = encodedTitle.GetLength(); | 57 unsigned long len = encodedTitle.GetLength(); |
| 58 if (buffer && buflen >= len) { | 58 if (buffer && buflen >= len) { |
| 59 FXSYS_memcpy(buffer, encodedTitle.c_str(), len); | 59 FXSYS_memcpy(buffer, encodedTitle.c_str(), len); |
| 60 } | 60 } |
| 61 return len; | 61 return len; |
| 62 } | 62 } |
| 63 | 63 |
| 64 DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_W
IDESTRING title) | 64 DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document, FPDF_W
IDESTRING title) |
| 65 { | 65 { |
| 66 » if (!document) | 66 if (!document) |
| 67 » » return NULL; | 67 return NULL; |
| 68 » if (!title || title[0] == 0) | 68 if (!title || title[0] == 0) |
| 69 » » return NULL; | 69 return NULL; |
| 70 » CPDF_Document* pDoc = (CPDF_Document*)document; | 70 CPDF_Document* pDoc = (CPDF_Document*)document; |
| 71 » CPDF_BookmarkTree tree(pDoc); | 71 CPDF_BookmarkTree tree(pDoc); |
| 72 » FX_STRSIZE len = CFX_WideString::WStringLength(title); | 72 FX_STRSIZE len = CFX_WideString::WStringLength(title); |
| 73 » CFX_WideString encodedTitle = CFX_WideString::FromUTF16LE(title, len); | 73 CFX_WideString encodedTitle = CFX_WideString::FromUTF16LE(title, len); |
| 74 » return FindBookmark(tree, CPDF_Bookmark(), encodedTitle).GetDict(); | 74 return FindBookmark(tree, CPDF_Bookmark(), encodedTitle).GetDict(); |
| 75 } | 75 } |
| 76 | 76 |
| 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.GetObject(); | 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 get ac
tion |
| 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).GetObject(); | 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 |
| 103 DLLEXPORT unsigned long STDCALL FPDFAction_GetType(FPDF_ACTION pDict) | 103 DLLEXPORT unsigned long STDCALL FPDFAction_GetType(FPDF_ACTION pDict) |
| 104 { | 104 { |
| 105 » if (!pDict) | 105 if (!pDict) |
| 106 » » return 0; | 106 return 0; |
| 107 » CPDF_Action action((CPDF_Dictionary*)pDict); | 107 CPDF_Action action((CPDF_Dictionary*)pDict); |
| 108 » CPDF_Action::ActionType type = action.GetType(); | 108 CPDF_Action::ActionType type = action.GetType(); |
| 109 » switch (type) { | 109 switch (type) { |
| 110 » » case CPDF_Action::GoTo: | 110 case CPDF_Action::GoTo: |
| 111 » » » return PDFACTION_GOTO; | 111 return PDFACTION_GOTO; |
| 112 » » case CPDF_Action::GoToR: | 112 case CPDF_Action::GoToR: |
| 113 » » » return PDFACTION_REMOTEGOTO; | 113 return PDFACTION_REMOTEGOTO; |
| 114 » » case CPDF_Action::URI: | 114 case CPDF_Action::URI: |
| 115 » » » return PDFACTION_URI; | 115 return PDFACTION_URI; |
| 116 » » case CPDF_Action::Launch: | 116 case CPDF_Action::Launch: |
| 117 » » » return PDFACTION_LAUNCH; | 117 return PDFACTION_LAUNCH; |
| 118 » » default: | 118 default: |
| 119 » » » return PDFACTION_UNSUPPORTED; | 119 return PDFACTION_UNSUPPORTED; |
| 120 » } | 120 } |
| 121 » return PDFACTION_UNSUPPORTED; | 121 return PDFACTION_UNSUPPORTED; |
| 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).GetObject(); | 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(void* data) | 162 static void ReleaseLinkList(void* 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 { |
| 169 » if (!page) | 169 if (!page) |
| 170 » » return NULL; | 170 return NULL; |
| 171 » CPDF_Page* pPage = (CPDF_Page*)page; | 171 CPDF_Page* pPage = (CPDF_Page*)page; |
| 172 » // Link list is stored with the document | 172 // Link list is stored with the document |
| 173 » CPDF_Document* pDoc = pPage->m_pDocument; | 173 CPDF_Document* pDoc = pPage->m_pDocument; |
| 174 » CPDF_LinkList* pLinkList = (CPDF_LinkList*)pDoc->GetPrivateData(&THISMOD
ULE); | 174 CPDF_LinkList* pLinkList = (CPDF_LinkList*)pDoc->GetPrivateData(&THISMODULE)
; |
| 175 » if (!pLinkList) { | 175 if (!pLinkList) { |
| 176 » » pLinkList = new CPDF_LinkList(pDoc); | 176 pLinkList = new CPDF_LinkList(pDoc); |
| 177 » » pDoc->SetPrivateData(&THISMODULE, pLinkList, ReleaseLinkList); | 177 pDoc->SetPrivateData(&THISMODULE, pLinkList, ReleaseLinkList); |
| 178 » } | 178 } |
| 179 » return pLinkList->GetLinkAtPoint(pPage, (FX_FLOAT)x, (FX_FLOAT)y).GetDic
t(); | 179 return pLinkList->GetLinkAtPoint(pPage, (FX_FLOAT)x, (FX_FLOAT)y).GetDict(); |
| 180 } | 180 } |
| 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 » if (!pDict) | 186 if (!pDict) |
| 187 » » return NULL; | 187 return NULL; |
| 188 » CPDF_Document* pDoc = (CPDF_Document*)document; | 188 CPDF_Document* pDoc = (CPDF_Document*)document; |
| 189 » CPDF_Link link((CPDF_Dictionary*)pDict); | 189 CPDF_Link link((CPDF_Dictionary*)pDict); |
| 190 » FPDF_DEST dest = link.GetDest(pDoc).GetObject(); | 190 FPDF_DEST dest = link.GetDest(pDoc).GetObject(); |
| 191 » if (dest) | 191 if (dest) |
| 192 » » return dest; | 192 return dest; |
| 193 » // If this link is not directly associated with a dest, we try to get ac
tion | 193 // If this link is not directly associated with a dest, we try to get action |
| 194 » CPDF_Action action = link.GetAction(); | 194 CPDF_Action action = link.GetAction(); |
| 195 » if (!action) | 195 if (!action) |
| 196 » » return NULL; | 196 return NULL; |
| 197 » return action.GetDest(pDoc).GetObject(); | 197 return action.GetDest(pDoc).GetObject(); |
| 198 } | 198 } |
| 199 | 199 |
| 200 DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction(FPDF_LINK pDict) | 200 DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction(FPDF_LINK pDict) |
| 201 { | 201 { |
| 202 » if (!pDict) | 202 if (!pDict) |
| 203 » » return NULL; | 203 return NULL; |
| 204 » CPDF_Link link((CPDF_Dictionary*)pDict); | 204 CPDF_Link link((CPDF_Dictionary*)pDict); |
| 205 » return link.GetAction().GetDict(); | 205 return link.GetAction().GetDict(); |
| 206 } | 206 } |
| 207 | 207 |
| 208 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, int* startPos, FP
DF_LINK* linkAnnot) | 208 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page, int* startPos, FP
DF_LINK* linkAnnot) |
| 209 { | 209 { |
| 210 » if(!page || !startPos || !linkAnnot) | 210 if(!page || !startPos || !linkAnnot) |
| 211 » » return FALSE; | 211 return FALSE; |
| 212 » CPDF_Page* pPage = (CPDF_Page*)page; | 212 CPDF_Page* pPage = (CPDF_Page*)page; |
| 213 » if(!pPage->m_pFormDict) | 213 if(!pPage->m_pFormDict) |
| 214 » » return FALSE; | 214 return FALSE; |
| 215 » CPDF_Array* pAnnots = pPage->m_pFormDict->GetArray("Annots"); | 215 CPDF_Array* pAnnots = pPage->m_pFormDict->GetArray("Annots"); |
| 216 » if(!pAnnots) | 216 if(!pAnnots) |
| 217 » » return FALSE; | 217 return FALSE; |
| 218 » for (int i = *startPos; i < (int)pAnnots->GetCount(); i++) { | 218 for (int i = *startPos; i < (int)pAnnots->GetCount(); i++) { |
| 219 » » CPDF_Dictionary* pDict = (CPDF_Dictionary*)pAnnots->GetElementVa
lue(i); | 219 CPDF_Dictionary* pDict = (CPDF_Dictionary*)pAnnots->GetElementValue(i); |
| 220 » » if (!pDict || pDict->GetType() != PDFOBJ_DICTIONARY) | 220 if (!pDict || pDict->GetType() != PDFOBJ_DICTIONARY) |
| 221 » » » continue; | 221 continue; |
| 222 » » if(pDict->GetString(FX_BSTRC("Subtype")).Equal(FX_BSTRC("Link"))
) { | 222 if(pDict->GetString(FX_BSTRC("Subtype")).Equal(FX_BSTRC("Link"))) { |
| 223 » » » *startPos = i + 1; | 223 *startPos = i + 1; |
| 224 » » » *linkAnnot = (FPDF_LINK)pDict; | 224 *linkAnnot = (FPDF_LINK)pDict; |
| 225 » » » return TRUE; | 225 return TRUE; |
| 226 » » } | 226 } |
| 227 » } | 227 } |
| 228 » return FALSE; | 228 return FALSE; |
| 229 } | 229 } |
| 230 | 230 |
| 231 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot, FS_RECTF*
rect) | 231 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot, FS_RECTF*
rect) |
| 232 { | 232 { |
| 233 » if(!linkAnnot || !rect) | 233 if(!linkAnnot || !rect) |
| 234 » » return FALSE; | 234 return FALSE; |
| 235 » CPDF_Dictionary* pAnnotDict = (CPDF_Dictionary*)linkAnnot; | 235 CPDF_Dictionary* pAnnotDict = (CPDF_Dictionary*)linkAnnot; |
| 236 » CPDF_Rect rt = pAnnotDict->GetRect(FX_BSTRC("Rect")); | 236 CPDF_Rect rt = pAnnotDict->GetRect(FX_BSTRC("Rect")); |
| 237 » rect->left = rt.left; | 237 rect->left = rt.left; |
| 238 » rect->bottom = rt.bottom; | 238 rect->bottom = rt.bottom; |
| 239 » rect->right = rt.right; | 239 rect->right = rt.right; |
| 240 » rect->top = rt.top; | 240 rect->top = rt.top; |
| 241 » return TRUE; | 241 return TRUE; |
| 242 } | 242 } |
| 243 | 243 |
| 244 DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot) | 244 DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot) |
| 245 { | 245 { |
| 246 » if(!linkAnnot) | 246 if(!linkAnnot) |
| 247 » » return 0; | 247 return 0; |
| 248 » CPDF_Dictionary* pAnnotDict = (CPDF_Dictionary*)linkAnnot; | 248 CPDF_Dictionary* pAnnotDict = (CPDF_Dictionary*)linkAnnot; |
| 249 » CPDF_Array* pArray = pAnnotDict->GetArray(FX_BSTRC("QuadPoints")); | 249 CPDF_Array* pArray = pAnnotDict->GetArray(FX_BSTRC("QuadPoints")); |
| 250 » if (!pArray) | 250 if (!pArray) |
| 251 » » return 0; | 251 return 0; |
| 252 » else | 252 return pArray->GetCount() / 8; |
| 253 » » return pArray->GetCount() / 8; | |
| 254 } | 253 } |
| 255 | 254 |
| 256 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, int quad
Index, FS_QUADPOINTSF* quadPoints) | 255 DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot, int quad
Index, FS_QUADPOINTSF* quadPoints) |
| 257 { | 256 { |
| 258 » if(!linkAnnot || !quadPoints) | 257 if(!linkAnnot || !quadPoints) |
| 259 » » return FALSE; | 258 return FALSE; |
| 260 » CPDF_Dictionary* pAnnotDict = (CPDF_Dictionary*)linkAnnot; | 259 CPDF_Dictionary* pAnnotDict = (CPDF_Dictionary*)linkAnnot; |
| 261 » CPDF_Array* pArray = pAnnotDict->GetArray(FX_BSTRC("QuadPoints")); | 260 CPDF_Array* pArray = pAnnotDict->GetArray(FX_BSTRC("QuadPoints")); |
| 262 » if (pArray) { | 261 if (pArray) { |
| 263 » » if (quadIndex < 0 || quadIndex >= (int)pArray->GetCount()/8 || (
(quadIndex*8+7) >= (int)pArray->GetCount())) | 262 if (quadIndex < 0 || quadIndex >= (int)pArray->GetCount()/8 || ((quadInd
ex*8+7) >= (int)pArray->GetCount())) |
| 264 » » » return FALSE; | 263 return FALSE; |
| 265 » » quadPoints->x1 = pArray->GetNumber(quadIndex*8); | 264 quadPoints->x1 = pArray->GetNumber(quadIndex*8); |
| 266 » » quadPoints->y1 = pArray->GetNumber(quadIndex*8+1); | 265 quadPoints->y1 = pArray->GetNumber(quadIndex*8+1); |
| 267 » » quadPoints->x2 = pArray->GetNumber(quadIndex*8+2); | 266 quadPoints->x2 = pArray->GetNumber(quadIndex*8+2); |
| 268 » » quadPoints->y2 = pArray->GetNumber(quadIndex*8+3); | 267 quadPoints->y2 = pArray->GetNumber(quadIndex*8+3); |
| 269 » » quadPoints->x3 = pArray->GetNumber(quadIndex*8+4); | 268 quadPoints->x3 = pArray->GetNumber(quadIndex*8+4); |
| 270 » » quadPoints->y3 = pArray->GetNumber(quadIndex*8+5); | 269 quadPoints->y3 = pArray->GetNumber(quadIndex*8+5); |
| 271 » » quadPoints->x4 = pArray->GetNumber(quadIndex*8+6); | 270 quadPoints->x4 = pArray->GetNumber(quadIndex*8+6); |
| 272 » » quadPoints->y4 = pArray->GetNumber(quadIndex*8+7); | 271 quadPoints->y4 = pArray->GetNumber(quadIndex*8+7); |
| 273 » » return TRUE; | 272 return TRUE; |
| 274 » } | 273 } |
| 275 » return FALSE; | 274 return FALSE; |
| 276 } | 275 } |
| 277 | 276 |
| 278 DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc, FPDF_BYTESTR
ING tag, | 277 DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT doc, FPDF_BYTESTR
ING tag, |
| 279 » » » » » » » » » »
» » void* buffer, unsigned long buflen) | 278 void* buffer, unsigned long buf
len) |
| 280 { | 279 { |
| 281 » if (!doc || !tag) | 280 if (!doc || !tag) |
| 282 » » return 0; | 281 return 0; |
| 283 » CPDF_Document* pDoc = (CPDF_Document*)doc; | 282 CPDF_Document* pDoc = (CPDF_Document*)doc; |
| 284 » // Get info dictionary | 283 // Get info dictionary |
| 285 » CPDF_Dictionary* pInfo = pDoc->GetInfo(); | 284 CPDF_Dictionary* pInfo = pDoc->GetInfo(); |
| 286 » if (!pInfo) | 285 if (!pInfo) |
| 287 » » return 0; | 286 return 0; |
| 288 » CFX_WideString text = pInfo->GetUnicodeText(tag); | 287 CFX_WideString text = pInfo->GetUnicodeText(tag); |
| 289 » // Use UTF-16LE encoding | 288 // Use UTF-16LE encoding |
| 290 » CFX_ByteString encodedText = text.UTF16LE_Encode(); | 289 CFX_ByteString encodedText = text.UTF16LE_Encode(); |
| 291 » unsigned long len = encodedText.GetLength(); | 290 unsigned long len = encodedText.GetLength(); |
| 292 » if (buffer && buflen >= len) { | 291 if (buffer && buflen >= len) { |
| 293 » » FXSYS_memcpy(buffer, encodedText.c_str(), len); | 292 FXSYS_memcpy(buffer, encodedText.c_str(), len); |
| 294 » } | 293 } |
| 295 » return len; | 294 return len; |
| 296 } | 295 } |
| OLD | NEW |