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 "../../core/include/fpdfdoc/fpdf_doc.h" | 7 #include "../../core/include/fpdfdoc/fpdf_doc.h" |
8 #include "../../core/include/fpdftext/fpdf_text.h" | 8 #include "../../core/include/fpdftext/fpdf_text.h" |
9 #include "../../public/fpdf_text.h" | 9 #include "../../public/fpdf_text.h" |
10 | 10 |
11 #ifdef _WIN32 | 11 #ifdef _WIN32 |
12 #include <tchar.h> | 12 #include <tchar.h> |
13 #endif | 13 #endif |
14 | 14 |
15 » // jabdelmalek: commented out to build on Linux. Not used. | 15 // jabdelmalek: commented out to build on Linux. Not used. |
16 » // extern HANDLE g_hModule; | 16 // extern HANDLE g_hModule; |
17 | 17 |
18 DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page) | 18 DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page) { |
19 { | 19 if (!page) |
20 » if (!page) return NULL; | 20 return NULL; |
21 » IPDF_TextPage* textpage=NULL; | 21 IPDF_TextPage* textpage = NULL; |
22 » CPDF_ViewerPreferences viewRef(((CPDF_Page*)page)->m_pDocument); | 22 CPDF_ViewerPreferences viewRef(((CPDF_Page*)page)->m_pDocument); |
23 » textpage=IPDF_TextPage::CreateTextPage((CPDF_Page*)page,viewRef.IsDirect
ionR2L()); | 23 textpage = |
24 » textpage->ParseTextPage(); | 24 IPDF_TextPage::CreateTextPage((CPDF_Page*)page, viewRef.IsDirectionR2L()); |
25 » return textpage; | 25 textpage->ParseTextPage(); |
26 } | 26 return textpage; |
27 DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page) | 27 } |
28 { | 28 DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page) { |
29 delete (IPDF_TextPage*)text_page; | 29 delete (IPDF_TextPage*)text_page; |
30 } | 30 } |
31 DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page) | 31 DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page) { |
32 { | 32 if (!text_page) |
33 » if (!text_page) return» -1; | 33 return -1; |
34 » IPDF_TextPage* textpage=(IPDF_TextPage*)text_page; | 34 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
35 » return textpage->CountChars(); | 35 return textpage->CountChars(); |
36 } | 36 } |
37 DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, int
index) | 37 DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, |
38 { | 38 int index) { |
39 » if (!text_page) return -1; | 39 if (!text_page) |
40 » IPDF_TextPage* textpage=(IPDF_TextPage*)text_page; | 40 return -1; |
41 | 41 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
42 » if (index<0 || index>=textpage->CountChars()) return 0; | 42 |
43 | 43 if (index < 0 || index >= textpage->CountChars()) |
44 » FPDF_CHAR_INFO» charinfo; | 44 return 0; |
45 » textpage->GetCharInfo(index,charinfo); | 45 |
46 » return charinfo.m_Unicode; | 46 FPDF_CHAR_INFO charinfo; |
47 } | 47 textpage->GetCharInfo(index, charinfo); |
48 DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, int index
) | 48 return charinfo.m_Unicode; |
49 { | 49 } |
50 » if (!text_page) return 0; | 50 DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, |
51 » IPDF_TextPage* textpage=(IPDF_TextPage*)text_page; | 51 int index) { |
52 | 52 if (!text_page) |
53 » if (index<0 || index>=textpage->CountChars()) return 0; | 53 return 0; |
54 | 54 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
55 » FPDF_CHAR_INFO» charinfo; | 55 |
56 » textpage->GetCharInfo(index,charinfo); | 56 if (index < 0 || index >= textpage->CountChars()) |
57 » return charinfo.m_FontSize; | 57 return 0; |
58 } | 58 |
59 | 59 FPDF_CHAR_INFO charinfo; |
60 DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, int index,do
uble* left, | 60 textpage->GetCharInfo(index, charinfo); |
61 » » » » » » » » » »
» » » double* right, double* bottom, double* top) | 61 return charinfo.m_FontSize; |
62 { | 62 } |
63 » if (!text_page) return; | 63 |
64 » IPDF_TextPage* textpage=(IPDF_TextPage*)text_page; | 64 DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, |
65 | 65 int index, |
66 » if (index<0 || index>=textpage->CountChars()) return ; | 66 double* left, |
67 » FPDF_CHAR_INFO» charinfo; | 67 double* right, |
68 » textpage->GetCharInfo(index,charinfo); | 68 double* bottom, |
69 » *left=charinfo.m_CharBox.left; | 69 double* top) { |
70 » *right=charinfo.m_CharBox.right; | 70 if (!text_page) |
71 » *bottom=charinfo.m_CharBox.bottom; | 71 return; |
72 » *top=charinfo.m_CharBox.top; | 72 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
73 } | 73 |
74 | 74 if (index < 0 || index >= textpage->CountChars()) |
75 //select | 75 return; |
76 DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page,double
x,double y,double xTorelance,double yTorelance) | 76 FPDF_CHAR_INFO charinfo; |
77 { | 77 textpage->GetCharInfo(index, charinfo); |
78 » if (!text_page) return -3; | 78 *left = charinfo.m_CharBox.left; |
79 » IPDF_TextPage* textpage=(IPDF_TextPage*)text_page; | 79 *right = charinfo.m_CharBox.right; |
80 » return textpage->GetIndexAtPos((FX_FLOAT)x,(FX_FLOAT)y,(FX_FLOAT)xTorela
nce,(FX_FLOAT)yTorelance); | 80 *bottom = charinfo.m_CharBox.bottom; |
81 } | 81 *top = charinfo.m_CharBox.top; |
82 | 82 } |
83 DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page,int start,int cou
nt,unsigned short* result) | 83 |
84 { | 84 // select |
85 » if (!text_page) return 0; | 85 DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page, |
86 » IPDF_TextPage* textpage=(IPDF_TextPage*)text_page; | 86 double x, |
87 | 87 double y, |
88 » if (start>=textpage->CountChars()) return 0; | 88 double xTorelance, |
89 | 89 double yTorelance) { |
90 » CFX_WideString str=textpage->GetPageText(start,count); | 90 if (!text_page) |
91 » if(str.GetLength()>count) | 91 return -3; |
92 » » str = str.Left(count); | 92 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
93 | 93 return textpage->GetIndexAtPos((FX_FLOAT)x, (FX_FLOAT)y, (FX_FLOAT)xTorelance, |
94 » CFX_ByteString cbUTF16str = str.UTF16LE_Encode(); | 94 (FX_FLOAT)yTorelance); |
95 » FXSYS_memcpy(result,cbUTF16str.GetBuffer(cbUTF16str.GetLength()),cbUTF16
str.GetLength()); | 95 } |
96 » cbUTF16str.ReleaseBuffer(cbUTF16str.GetLength()); | 96 |
97 | 97 DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page, |
98 » return cbUTF16str.GetLength()/sizeof(unsigned short); | 98 int start, |
99 } | 99 int count, |
100 | 100 unsigned short* result) { |
101 DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page,int start,int
count) | 101 if (!text_page) |
102 { | 102 return 0; |
103 » if (!text_page) return 0; | 103 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
104 » IPDF_TextPage* textpage=(IPDF_TextPage*)text_page; | 104 |
105 » return» textpage->CountRects(start,count); | 105 if (start >= textpage->CountChars()) |
106 | 106 return 0; |
107 } | 107 |
108 DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page,int rect_index,
double* left,double* top, | 108 CFX_WideString str = textpage->GetPageText(start, count); |
109 » » » » » » » » » »
double* right, double* bottom) | 109 if (str.GetLength() > count) |
110 { | 110 str = str.Left(count); |
111 » if (!text_page) return; | 111 |
112 » IPDF_TextPage* textpage=(IPDF_TextPage*)text_page; | 112 CFX_ByteString cbUTF16str = str.UTF16LE_Encode(); |
113 » CFX_FloatRect» rect; | 113 FXSYS_memcpy(result, cbUTF16str.GetBuffer(cbUTF16str.GetLength()), |
114 » textpage->GetRect(rect_index,rect.left,rect.top,rect.right,rect.bottom); | 114 cbUTF16str.GetLength()); |
115 » *left=rect.left; | 115 cbUTF16str.ReleaseBuffer(cbUTF16str.GetLength()); |
116 » *top=rect.top; | 116 |
117 » *right=rect.right; | 117 return cbUTF16str.GetLength() / sizeof(unsigned short); |
118 » *bottom=rect.bottom; | 118 } |
119 } | 119 |
120 | 120 DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page, |
121 DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,double lef
t, double top, | 121 int start, |
122 » » » » » » » » » »
» double right, double bottom,unsigned short* buffer,int buflen) | 122 int count) { |
123 { | 123 if (!text_page) |
124 » if (!text_page) return 0; | 124 return 0; |
125 » IPDF_TextPage* textpage=(IPDF_TextPage*)text_page; | 125 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
126 » CFX_FloatRect rect((FX_FLOAT)left,(FX_FLOAT)bottom,(FX_FLOAT)right,(FX_F
LOAT)top); | 126 return textpage->CountRects(start, count); |
127 » CFX_WideString str=textpage->GetTextByRect(rect); | 127 } |
128 | 128 DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page, |
129 » if (buflen<=0 || buffer==NULL) | 129 int rect_index, |
130 » { | 130 double* left, |
131 » » return str.GetLength(); | 131 double* top, |
132 » } | 132 double* right, |
133 | 133 double* bottom) { |
134 » CFX_ByteString cbUTF16Str = str.UTF16LE_Encode(); | 134 if (!text_page) |
135 » int len = cbUTF16Str.GetLength()/sizeof(unsigned short); | 135 return; |
136 » int size = buflen > len ? len : buflen; | 136 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
137 » FXSYS_memcpy(buffer,cbUTF16Str.GetBuffer(size*sizeof(unsigned short)),si
ze*sizeof(unsigned short)); | 137 CFX_FloatRect rect; |
138 » cbUTF16Str.ReleaseBuffer(size*sizeof(unsigned short)); | 138 textpage->GetRect(rect_index, rect.left, rect.top, rect.right, rect.bottom); |
139 | 139 *left = rect.left; |
140 » return size; | 140 *top = rect.top; |
141 | 141 *right = rect.right; |
142 } | 142 *bottom = rect.bottom; |
143 | 143 } |
144 //Search | 144 |
| 145 DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page, |
| 146 double left, |
| 147 double top, |
| 148 double right, |
| 149 double bottom, |
| 150 unsigned short* buffer, |
| 151 int buflen) { |
| 152 if (!text_page) |
| 153 return 0; |
| 154 IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
| 155 CFX_FloatRect rect((FX_FLOAT)left, (FX_FLOAT)bottom, (FX_FLOAT)right, |
| 156 (FX_FLOAT)top); |
| 157 CFX_WideString str = textpage->GetTextByRect(rect); |
| 158 |
| 159 if (buflen <= 0 || buffer == NULL) { |
| 160 return str.GetLength(); |
| 161 } |
| 162 |
| 163 CFX_ByteString cbUTF16Str = str.UTF16LE_Encode(); |
| 164 int len = cbUTF16Str.GetLength() / sizeof(unsigned short); |
| 165 int size = buflen > len ? len : buflen; |
| 166 FXSYS_memcpy(buffer, cbUTF16Str.GetBuffer(size * sizeof(unsigned short)), |
| 167 size * sizeof(unsigned short)); |
| 168 cbUTF16Str.ReleaseBuffer(size * sizeof(unsigned short)); |
| 169 |
| 170 return size; |
| 171 } |
| 172 |
| 173 // Search |
145 //-1 for end | 174 //-1 for end |
146 DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page,FPDF
_WIDESTRING findwhat,unsigned long flags,int start_index) | 175 DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page, |
147 { | 176 FPDF_WIDESTRING findwhat, |
148 » if (!text_page) return NULL; | 177 unsigned long flags, |
149 » IPDF_TextPageFind* textpageFind=NULL; | 178 int start_index) { |
150 » textpageFind=IPDF_TextPageFind::CreatePageFind((IPDF_TextPage*)text_page
); | 179 if (!text_page) |
151 » FX_STRSIZE len = CFX_WideString::WStringLength(findwhat); | 180 return NULL; |
152 » textpageFind->FindFirst(CFX_WideString::FromUTF16LE(findwhat, len),flags
,start_index); | 181 IPDF_TextPageFind* textpageFind = NULL; |
153 » return textpageFind; | 182 textpageFind = IPDF_TextPageFind::CreatePageFind((IPDF_TextPage*)text_page); |
154 } | 183 FX_STRSIZE len = CFX_WideString::WStringLength(findwhat); |
155 DLLEXPORT FPDF_BOOL» STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle) | 184 textpageFind->FindFirst(CFX_WideString::FromUTF16LE(findwhat, len), flags, |
156 { | 185 start_index); |
157 » if (!handle) return FALSE; | 186 return textpageFind; |
158 » IPDF_TextPageFind* textpageFind=(IPDF_TextPageFind*)handle; | 187 } |
159 » return» textpageFind->FindNext(); | 188 DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle) { |
160 } | 189 if (!handle) |
161 DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle) | 190 return FALSE; |
162 { | 191 IPDF_TextPageFind* textpageFind = (IPDF_TextPageFind*)handle; |
163 » if (!handle) return FALSE; | 192 return textpageFind->FindNext(); |
164 » IPDF_TextPageFind* textpageFind=(IPDF_TextPageFind*)handle; | 193 } |
165 » return» textpageFind->FindPrev(); | 194 DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle) { |
166 } | 195 if (!handle) |
167 DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle) | 196 return FALSE; |
168 { | 197 IPDF_TextPageFind* textpageFind = (IPDF_TextPageFind*)handle; |
169 » if (!handle) return 0; | 198 return textpageFind->FindPrev(); |
170 » IPDF_TextPageFind* textpageFind=(IPDF_TextPageFind*)handle; | 199 } |
171 » return textpageFind->GetCurOrder(); | 200 DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle) { |
172 } | 201 if (!handle) |
173 DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle) | 202 return 0; |
174 { | 203 IPDF_TextPageFind* textpageFind = (IPDF_TextPageFind*)handle; |
175 » if (!handle) return 0; | 204 return textpageFind->GetCurOrder(); |
176 » IPDF_TextPageFind* textpageFind=(IPDF_TextPageFind*)handle; | 205 } |
177 » return textpageFind->GetMatchedCount(); | 206 DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle) { |
178 } | 207 if (!handle) |
179 DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle) | 208 return 0; |
180 { | 209 IPDF_TextPageFind* textpageFind = (IPDF_TextPageFind*)handle; |
181 » if (!handle) return; | 210 return textpageFind->GetMatchedCount(); |
182 » IPDF_TextPageFind* textpageFind=(IPDF_TextPageFind*)handle; | 211 } |
183 » delete» textpageFind; | 212 DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle) { |
184 » handle=NULL; | 213 if (!handle) |
185 } | 214 return; |
186 | 215 IPDF_TextPageFind* textpageFind = (IPDF_TextPageFind*)handle; |
187 //web link | 216 delete textpageFind; |
188 DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page) | 217 handle = NULL; |
189 { | 218 } |
190 » if (!text_page) return NULL; | 219 |
191 » IPDF_LinkExtract* pageLink=NULL; | 220 // web link |
192 » pageLink=IPDF_LinkExtract::CreateLinkExtract(); | 221 DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page) { |
193 » pageLink->ExtractLinks((IPDF_TextPage*)text_page); | 222 if (!text_page) |
194 » return pageLink; | 223 return NULL; |
195 } | 224 IPDF_LinkExtract* pageLink = NULL; |
196 DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page) | 225 pageLink = IPDF_LinkExtract::CreateLinkExtract(); |
197 { | 226 pageLink->ExtractLinks((IPDF_TextPage*)text_page); |
198 » if (!link_page) return 0; | 227 return pageLink; |
199 » IPDF_LinkExtract* pageLink=(IPDF_LinkExtract*)link_page; | 228 } |
200 » return» pageLink->CountLinks(); | 229 DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page) { |
201 } | 230 if (!link_page) |
202 DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page,int link_index, un
signed short* buffer,int buflen) | 231 return 0; |
203 { | 232 IPDF_LinkExtract* pageLink = (IPDF_LinkExtract*)link_page; |
204 » if (!link_page) return 0; | 233 return pageLink->CountLinks(); |
205 » IPDF_LinkExtract* pageLink=(IPDF_LinkExtract*)link_page; | 234 } |
206 » CFX_WideString url=pageLink->GetURL(link_index); | 235 DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page, |
207 | 236 int link_index, |
208 » CFX_ByteString cbUTF16URL = url.UTF16LE_Encode(); | 237 unsigned short* buffer, |
209 » int len= cbUTF16URL.GetLength()/sizeof(unsigned short); | 238 int buflen) { |
210 » if (buffer==NULL || buflen<=0) | 239 if (!link_page) |
211 » » return len; | 240 return 0; |
212 » int size=len<buflen ? len :buflen; | 241 IPDF_LinkExtract* pageLink = (IPDF_LinkExtract*)link_page; |
213 » if (size>0) | 242 CFX_WideString url = pageLink->GetURL(link_index); |
214 » { | 243 |
215 » » FXSYS_memcpy(buffer,cbUTF16URL.GetBuffer(size*sizeof(unsigned sh
ort)),size*sizeof(unsigned short)); | 244 CFX_ByteString cbUTF16URL = url.UTF16LE_Encode(); |
216 » » cbUTF16URL.ReleaseBuffer(size*sizeof(unsigned short)); | 245 int len = cbUTF16URL.GetLength() / sizeof(unsigned short); |
217 » } | 246 if (buffer == NULL || buflen <= 0) |
218 » return size; | 247 return len; |
219 } | 248 int size = len < buflen ? len : buflen; |
220 DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page,int link_index
) | 249 if (size > 0) { |
221 { | 250 FXSYS_memcpy(buffer, cbUTF16URL.GetBuffer(size * sizeof(unsigned short)), |
222 » if (!link_page) return 0; | 251 size * sizeof(unsigned short)); |
223 » IPDF_LinkExtract* pageLink=(IPDF_LinkExtract*)link_page; | 252 cbUTF16URL.ReleaseBuffer(size * sizeof(unsigned short)); |
224 » CFX_RectArray rectArray; | 253 } |
225 » pageLink->GetRects(link_index,rectArray); | 254 return size; |
226 » return rectArray.GetSize(); | 255 } |
227 } | 256 DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page, |
228 DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page,int link_index,
int rect_index, double* left, | 257 int link_index) { |
229 » » » » » » » » » »
double* top,double* right, double* bottom) | 258 if (!link_page) |
230 { | 259 return 0; |
231 » if (!link_page) return; | 260 IPDF_LinkExtract* pageLink = (IPDF_LinkExtract*)link_page; |
232 » IPDF_LinkExtract* pageLink=(IPDF_LinkExtract*)link_page; | 261 CFX_RectArray rectArray; |
233 » CFX_RectArray rectArray; | 262 pageLink->GetRects(link_index, rectArray); |
234 » pageLink->GetRects(link_index,rectArray); | 263 return rectArray.GetSize(); |
235 » if (rect_index >= 0 && rect_index < rectArray.GetSize()) { | 264 } |
236 » » CFX_FloatRect rect=rectArray.GetAt(rect_index); | 265 DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page, |
237 » » *left=rect.left; | 266 int link_index, |
238 » » *right=rect.right; | 267 int rect_index, |
239 » » *top=rect.top; | 268 double* left, |
240 » » *bottom=rect.bottom; | 269 double* top, |
241 » } | 270 double* right, |
242 } | 271 double* bottom) { |
243 DLLEXPORT void» STDCALL»FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page) | 272 if (!link_page) |
244 { | 273 return; |
245 delete (IPDF_LinkExtract*)link_page; | 274 IPDF_LinkExtract* pageLink = (IPDF_LinkExtract*)link_page; |
246 } | 275 CFX_RectArray rectArray; |
247 | 276 pageLink->GetRects(link_index, rectArray); |
| 277 if (rect_index >= 0 && rect_index < rectArray.GetSize()) { |
| 278 CFX_FloatRect rect = rectArray.GetAt(rect_index); |
| 279 *left = rect.left; |
| 280 *right = rect.right; |
| 281 *top = rect.top; |
| 282 *bottom = rect.bottom; |
| 283 } |
| 284 } |
| 285 DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page) { |
| 286 delete (IPDF_LinkExtract*)link_page; |
| 287 } |
OLD | NEW |