Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: fpdfsdk/fpdftext.cpp

Issue 1897993002: Remove IPDF_TextPage, IPDF_TextPageFind and IPDF_LinkExtract interfaces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/fpdf_searchex.cpp ('k') | pdfium.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "public/fpdf_text.h" 7 #include "public/fpdf_text.h"
8 8
9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" 9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
10 #include "core/fpdfdoc/include/fpdf_doc.h" 10 #include "core/fpdfdoc/include/fpdf_doc.h"
11 #include "core/fpdftext/include/ipdf_linkextract.h" 11 #include "core/fpdftext/include/cpdf_linkextract.h"
12 #include "core/fpdftext/include/ipdf_textpage.h" 12 #include "core/fpdftext/include/cpdf_textpage.h"
13 #include "core/fpdftext/include/ipdf_textpagefind.h" 13 #include "core/fpdftext/include/cpdf_textpagefind.h"
14 #include "fpdfsdk/include/fsdk_define.h" 14 #include "fpdfsdk/include/fsdk_define.h"
15 15
16 #ifdef PDF_ENABLE_XFA 16 #ifdef PDF_ENABLE_XFA
17 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" 17 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h"
18 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h" 18 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_page.h"
19 #endif // PDF_ENABLE_XFA 19 #endif // PDF_ENABLE_XFA
20 20
21 #ifdef _WIN32 21 #ifdef _WIN32
22 #include <tchar.h> 22 #include <tchar.h>
23 #endif 23 #endif
24 24
25 DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page) { 25 DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page) {
26 CPDF_Page* pPDFPage = CPDFPageFromFPDFPage(page); 26 CPDF_Page* pPDFPage = CPDFPageFromFPDFPage(page);
27 if (!pPDFPage) 27 if (!pPDFPage)
28 return nullptr; 28 return nullptr;
29 #ifdef PDF_ENABLE_XFA 29 #ifdef PDF_ENABLE_XFA
30 CPDFXFA_Page* pPage = (CPDFXFA_Page*)page; 30 CPDFXFA_Page* pPage = (CPDFXFA_Page*)page;
31 CPDFXFA_Document* pDoc = pPage->GetDocument(); 31 CPDFXFA_Document* pDoc = pPage->GetDocument();
32 CPDF_ViewerPreferences viewRef(pDoc->GetPDFDoc()); 32 CPDF_ViewerPreferences viewRef(pDoc->GetPDFDoc());
33 #else // PDF_ENABLE_XFA 33 #else // PDF_ENABLE_XFA
34 CPDF_ViewerPreferences viewRef(pPDFPage->m_pDocument); 34 CPDF_ViewerPreferences viewRef(pPDFPage->m_pDocument);
35 #endif // PDF_ENABLE_XFA 35 #endif // PDF_ENABLE_XFA
36 IPDF_TextPage* textpage = 36 CPDF_TextPage* textpage =
37 IPDF_TextPage::CreateTextPage(pPDFPage, viewRef.IsDirectionR2L()); 37 new CPDF_TextPage(pPDFPage, viewRef.IsDirectionR2L());
38 textpage->ParseTextPage(); 38 textpage->ParseTextPage();
39 return textpage; 39 return textpage;
40 } 40 }
41 DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page) { 41 DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page) {
42 delete (IPDF_TextPage*)text_page; 42 delete static_cast<CPDF_TextPage*>(text_page);
Lei Zhang 2016/04/18 21:08:11 Do you think UnderlyingFromFPDFTextPage(), similar
dsinclair 2016/04/19 13:08:07 Done.
43 } 43 }
44 DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page) { 44 DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page) {
45 if (!text_page) 45 if (!text_page)
46 return -1; 46 return -1;
47 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; 47 CPDF_TextPage* textpage = static_cast<CPDF_TextPage*>(text_page);
48 return textpage->CountChars(); 48 return textpage->CountChars();
49 } 49 }
50 50
51 DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, 51 DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page,
52 int index) { 52 int index) {
53 if (!text_page) 53 if (!text_page)
54 return 0; 54 return 0;
55 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; 55 CPDF_TextPage* textpage = static_cast<CPDF_TextPage*>(text_page);
56 56
57 if (index < 0 || index >= textpage->CountChars()) 57 if (index < 0 || index >= textpage->CountChars())
58 return 0; 58 return 0;
59 59
60 FPDF_CHAR_INFO charinfo; 60 FPDF_CHAR_INFO charinfo;
61 textpage->GetCharInfo(index, &charinfo); 61 textpage->GetCharInfo(index, &charinfo);
62 return charinfo.m_Unicode; 62 return charinfo.m_Unicode;
63 } 63 }
64 64
65 DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, 65 DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page,
66 int index) { 66 int index) {
67 if (!text_page) 67 if (!text_page)
68 return 0; 68 return 0;
69 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; 69 CPDF_TextPage* textpage = static_cast<CPDF_TextPage*>(text_page);
70 70
71 if (index < 0 || index >= textpage->CountChars()) 71 if (index < 0 || index >= textpage->CountChars())
72 return 0; 72 return 0;
73 73
74 FPDF_CHAR_INFO charinfo; 74 FPDF_CHAR_INFO charinfo;
75 textpage->GetCharInfo(index, &charinfo); 75 textpage->GetCharInfo(index, &charinfo);
76 return charinfo.m_FontSize; 76 return charinfo.m_FontSize;
77 } 77 }
78 78
79 DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, 79 DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page,
80 int index, 80 int index,
81 double* left, 81 double* left,
82 double* right, 82 double* right,
83 double* bottom, 83 double* bottom,
84 double* top) { 84 double* top) {
85 if (!text_page) 85 if (!text_page)
86 return; 86 return;
87 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; 87 CPDF_TextPage* textpage = static_cast<CPDF_TextPage*>(text_page);
88 88
89 if (index < 0 || index >= textpage->CountChars()) 89 if (index < 0 || index >= textpage->CountChars())
90 return; 90 return;
91 FPDF_CHAR_INFO charinfo; 91 FPDF_CHAR_INFO charinfo;
92 textpage->GetCharInfo(index, &charinfo); 92 textpage->GetCharInfo(index, &charinfo);
93 *left = charinfo.m_CharBox.left; 93 *left = charinfo.m_CharBox.left;
94 *right = charinfo.m_CharBox.right; 94 *right = charinfo.m_CharBox.right;
95 *bottom = charinfo.m_CharBox.bottom; 95 *bottom = charinfo.m_CharBox.bottom;
96 *top = charinfo.m_CharBox.top; 96 *top = charinfo.m_CharBox.top;
97 } 97 }
98 98
99 // select 99 // select
100 DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page, 100 DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page,
101 double x, 101 double x,
102 double y, 102 double y,
103 double xTolerance, 103 double xTolerance,
104 double yTolerance) { 104 double yTolerance) {
105 if (!text_page) 105 if (!text_page)
106 return -3; 106 return -3;
107 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; 107 CPDF_TextPage* textpage = static_cast<CPDF_TextPage*>(text_page);
108 return textpage->GetIndexAtPos((FX_FLOAT)x, (FX_FLOAT)y, (FX_FLOAT)xTolerance, 108 return textpage->GetIndexAtPos((FX_FLOAT)x, (FX_FLOAT)y, (FX_FLOAT)xTolerance,
109 (FX_FLOAT)yTolerance); 109 (FX_FLOAT)yTolerance);
110 } 110 }
111 111
112 DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page, 112 DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page,
113 int start, 113 int start,
114 int count, 114 int count,
115 unsigned short* result) { 115 unsigned short* result) {
116 if (!text_page) 116 if (!text_page)
117 return 0; 117 return 0;
118 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; 118 CPDF_TextPage* textpage = static_cast<CPDF_TextPage*>(text_page);
119 119
120 if (start >= textpage->CountChars()) 120 if (start >= textpage->CountChars())
121 return 0; 121 return 0;
122 122
123 CFX_WideString str = textpage->GetPageText(start, count); 123 CFX_WideString str = textpage->GetPageText(start, count);
124 if (str.GetLength() > count) 124 if (str.GetLength() > count)
125 str = str.Left(count); 125 str = str.Left(count);
126 126
127 CFX_ByteString cbUTF16str = str.UTF16LE_Encode(); 127 CFX_ByteString cbUTF16str = str.UTF16LE_Encode();
128 FXSYS_memcpy(result, cbUTF16str.GetBuffer(cbUTF16str.GetLength()), 128 FXSYS_memcpy(result, cbUTF16str.GetBuffer(cbUTF16str.GetLength()),
129 cbUTF16str.GetLength()); 129 cbUTF16str.GetLength());
130 cbUTF16str.ReleaseBuffer(cbUTF16str.GetLength()); 130 cbUTF16str.ReleaseBuffer(cbUTF16str.GetLength());
131 131
132 return cbUTF16str.GetLength() / sizeof(unsigned short); 132 return cbUTF16str.GetLength() / sizeof(unsigned short);
133 } 133 }
134 134
135 DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page, 135 DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page,
136 int start, 136 int start,
137 int count) { 137 int count) {
138 if (!text_page) 138 if (!text_page)
139 return 0; 139 return 0;
140 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; 140 CPDF_TextPage* textpage = static_cast<CPDF_TextPage*>(text_page);
141 return textpage->CountRects(start, count); 141 return textpage->CountRects(start, count);
142 } 142 }
143 DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page, 143 DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page,
144 int rect_index, 144 int rect_index,
145 double* left, 145 double* left,
146 double* top, 146 double* top,
147 double* right, 147 double* right,
148 double* bottom) { 148 double* bottom) {
149 if (!text_page) 149 if (!text_page)
150 return; 150 return;
151 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; 151 CPDF_TextPage* textpage = static_cast<CPDF_TextPage*>(text_page);
152 CFX_FloatRect rect; 152 CFX_FloatRect rect;
153 textpage->GetRect(rect_index, rect.left, rect.top, rect.right, rect.bottom); 153 textpage->GetRect(rect_index, rect.left, rect.top, rect.right, rect.bottom);
154 *left = rect.left; 154 *left = rect.left;
155 *top = rect.top; 155 *top = rect.top;
156 *right = rect.right; 156 *right = rect.right;
157 *bottom = rect.bottom; 157 *bottom = rect.bottom;
158 } 158 }
159 159
160 DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page, 160 DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,
161 double left, 161 double left,
162 double top, 162 double top,
163 double right, 163 double right,
164 double bottom, 164 double bottom,
165 unsigned short* buffer, 165 unsigned short* buffer,
166 int buflen) { 166 int buflen) {
167 if (!text_page) 167 if (!text_page)
168 return 0; 168 return 0;
169 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; 169 CPDF_TextPage* textpage = static_cast<CPDF_TextPage*>(text_page);
170 CFX_FloatRect rect((FX_FLOAT)left, (FX_FLOAT)bottom, (FX_FLOAT)right, 170 CFX_FloatRect rect((FX_FLOAT)left, (FX_FLOAT)bottom, (FX_FLOAT)right,
171 (FX_FLOAT)top); 171 (FX_FLOAT)top);
172 CFX_WideString str = textpage->GetTextByRect(rect); 172 CFX_WideString str = textpage->GetTextByRect(rect);
173 173
174 if (buflen <= 0 || !buffer) { 174 if (buflen <= 0 || !buffer) {
175 return str.GetLength(); 175 return str.GetLength();
176 } 176 }
177 177
178 CFX_ByteString cbUTF16Str = str.UTF16LE_Encode(); 178 CFX_ByteString cbUTF16Str = str.UTF16LE_Encode();
179 int len = cbUTF16Str.GetLength() / sizeof(unsigned short); 179 int len = cbUTF16Str.GetLength() / sizeof(unsigned short);
180 int size = buflen > len ? len : buflen; 180 int size = buflen > len ? len : buflen;
181 FXSYS_memcpy(buffer, cbUTF16Str.GetBuffer(size * sizeof(unsigned short)), 181 FXSYS_memcpy(buffer, cbUTF16Str.GetBuffer(size * sizeof(unsigned short)),
182 size * sizeof(unsigned short)); 182 size * sizeof(unsigned short));
183 cbUTF16Str.ReleaseBuffer(size * sizeof(unsigned short)); 183 cbUTF16Str.ReleaseBuffer(size * sizeof(unsigned short));
184 184
185 return size; 185 return size;
186 } 186 }
187 187
188 // Search 188 // Search
189 // -1 for end 189 // -1 for end
190 DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page, 190 DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page,
191 FPDF_WIDESTRING findwhat, 191 FPDF_WIDESTRING findwhat,
192 unsigned long flags, 192 unsigned long flags,
193 int start_index) { 193 int start_index) {
194 if (!text_page) 194 if (!text_page)
195 return NULL; 195 return NULL;
196 IPDF_TextPageFind* textpageFind = NULL; 196
197 textpageFind = IPDF_TextPageFind::CreatePageFind((IPDF_TextPage*)text_page); 197 CPDF_TextPageFind* textpageFind =
198 new CPDF_TextPageFind(static_cast<CPDF_TextPage*>(text_page));
198 FX_STRSIZE len = CFX_WideString::WStringLength(findwhat); 199 FX_STRSIZE len = CFX_WideString::WStringLength(findwhat);
199 textpageFind->FindFirst(CFX_WideString::FromUTF16LE(findwhat, len), flags, 200 textpageFind->FindFirst(CFX_WideString::FromUTF16LE(findwhat, len), flags,
200 start_index); 201 start_index);
201 return textpageFind; 202 return textpageFind;
202 } 203 }
204
203 DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle) { 205 DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle) {
204 if (!handle) 206 if (!handle)
205 return FALSE; 207 return FALSE;
206 IPDF_TextPageFind* textpageFind = (IPDF_TextPageFind*)handle; 208 CPDF_TextPageFind* textpageFind = static_cast<CPDF_TextPageFind*>(handle);
207 return textpageFind->FindNext(); 209 return textpageFind->FindNext();
208 } 210 }
211
209 DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle) { 212 DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle) {
210 if (!handle) 213 if (!handle)
211 return FALSE; 214 return FALSE;
212 IPDF_TextPageFind* textpageFind = (IPDF_TextPageFind*)handle; 215 CPDF_TextPageFind* textpageFind = static_cast<CPDF_TextPageFind*>(handle);
213 return textpageFind->FindPrev(); 216 return textpageFind->FindPrev();
214 } 217 }
218
215 DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle) { 219 DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle) {
216 if (!handle) 220 if (!handle)
217 return 0; 221 return 0;
218 IPDF_TextPageFind* textpageFind = (IPDF_TextPageFind*)handle; 222 CPDF_TextPageFind* textpageFind = static_cast<CPDF_TextPageFind*>(handle);
219 return textpageFind->GetCurOrder(); 223 return textpageFind->GetCurOrder();
220 } 224 }
225
221 DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle) { 226 DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle) {
222 if (!handle) 227 if (!handle)
223 return 0; 228 return 0;
224 IPDF_TextPageFind* textpageFind = (IPDF_TextPageFind*)handle; 229 CPDF_TextPageFind* textpageFind = static_cast<CPDF_TextPageFind*>(handle);
225 return textpageFind->GetMatchedCount(); 230 return textpageFind->GetMatchedCount();
226 } 231 }
232
227 DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle) { 233 DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle) {
228 if (!handle) 234 if (!handle)
229 return; 235 return;
230 IPDF_TextPageFind* textpageFind = (IPDF_TextPageFind*)handle; 236 CPDF_TextPageFind* textpageFind = static_cast<CPDF_TextPageFind*>(handle);
231 delete textpageFind; 237 delete textpageFind;
232 handle = NULL; 238 handle = NULL;
233 } 239 }
234 240
235 // web link 241 // web link
236 DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page) { 242 DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page) {
237 if (!text_page) 243 if (!text_page)
238 return NULL; 244 return NULL;
239 IPDF_LinkExtract* pageLink = NULL; 245 CPDF_LinkExtract* pageLink = new CPDF_LinkExtract;
240 pageLink = IPDF_LinkExtract::CreateLinkExtract(); 246 pageLink->ExtractLinks(static_cast<CPDF_TextPage*>(text_page));
241 pageLink->ExtractLinks((IPDF_TextPage*)text_page);
242 return pageLink; 247 return pageLink;
243 } 248 }
244 DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page) { 249 DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page) {
245 if (!link_page) 250 if (!link_page)
246 return 0; 251 return 0;
247 IPDF_LinkExtract* pageLink = (IPDF_LinkExtract*)link_page; 252 CPDF_LinkExtract* pageLink = static_cast<CPDF_LinkExtract*>(link_page);
248 return pageLink->CountLinks(); 253 return pageLink->CountLinks();
249 } 254 }
250 DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page, 255 DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page,
251 int link_index, 256 int link_index,
252 unsigned short* buffer, 257 unsigned short* buffer,
253 int buflen) { 258 int buflen) {
254 if (!link_page) 259 if (!link_page)
255 return 0; 260 return 0;
256 IPDF_LinkExtract* pageLink = (IPDF_LinkExtract*)link_page; 261 CPDF_LinkExtract* pageLink = static_cast<CPDF_LinkExtract*>(link_page);
257 CFX_WideString url = pageLink->GetURL(link_index); 262 CFX_WideString url = pageLink->GetURL(link_index);
258 263
259 CFX_ByteString cbUTF16URL = url.UTF16LE_Encode(); 264 CFX_ByteString cbUTF16URL = url.UTF16LE_Encode();
260 int len = cbUTF16URL.GetLength() / sizeof(unsigned short); 265 int len = cbUTF16URL.GetLength() / sizeof(unsigned short);
261 if (!buffer || buflen <= 0) 266 if (!buffer || buflen <= 0)
262 return len; 267 return len;
263 int size = len < buflen ? len : buflen; 268 int size = len < buflen ? len : buflen;
264 if (size > 0) { 269 if (size > 0) {
265 FXSYS_memcpy(buffer, cbUTF16URL.GetBuffer(size * sizeof(unsigned short)), 270 FXSYS_memcpy(buffer, cbUTF16URL.GetBuffer(size * sizeof(unsigned short)),
266 size * sizeof(unsigned short)); 271 size * sizeof(unsigned short));
267 cbUTF16URL.ReleaseBuffer(size * sizeof(unsigned short)); 272 cbUTF16URL.ReleaseBuffer(size * sizeof(unsigned short));
268 } 273 }
269 return size; 274 return size;
270 } 275 }
271 DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page, 276 DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page,
272 int link_index) { 277 int link_index) {
273 if (!link_page) 278 if (!link_page)
274 return 0; 279 return 0;
275 IPDF_LinkExtract* pageLink = (IPDF_LinkExtract*)link_page; 280 CPDF_LinkExtract* pageLink = static_cast<CPDF_LinkExtract*>(link_page);
276 CFX_RectArray rectArray; 281 CFX_RectArray rectArray;
277 pageLink->GetRects(link_index, rectArray); 282 pageLink->GetRects(link_index, rectArray);
278 return rectArray.GetSize(); 283 return rectArray.GetSize();
279 } 284 }
280 DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page, 285 DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page,
281 int link_index, 286 int link_index,
282 int rect_index, 287 int rect_index,
283 double* left, 288 double* left,
284 double* top, 289 double* top,
285 double* right, 290 double* right,
286 double* bottom) { 291 double* bottom) {
287 if (!link_page) 292 if (!link_page)
288 return; 293 return;
289 IPDF_LinkExtract* pageLink = (IPDF_LinkExtract*)link_page; 294 CPDF_LinkExtract* pageLink = static_cast<CPDF_LinkExtract*>(link_page);
290 CFX_RectArray rectArray; 295 CFX_RectArray rectArray;
291 pageLink->GetRects(link_index, rectArray); 296 pageLink->GetRects(link_index, rectArray);
292 if (rect_index >= 0 && rect_index < rectArray.GetSize()) { 297 if (rect_index >= 0 && rect_index < rectArray.GetSize()) {
293 CFX_FloatRect rect = rectArray.GetAt(rect_index); 298 CFX_FloatRect rect = rectArray.GetAt(rect_index);
294 *left = rect.left; 299 *left = rect.left;
295 *right = rect.right; 300 *right = rect.right;
296 *top = rect.top; 301 *top = rect.top;
297 *bottom = rect.bottom; 302 *bottom = rect.bottom;
298 } 303 }
299 } 304 }
300 DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page) { 305 DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page) {
301 delete (IPDF_LinkExtract*)link_page; 306 delete static_cast<CPDF_LinkExtract*>(link_page);
302 } 307 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdf_searchex.cpp ('k') | pdfium.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698