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 | 8 |
9 const int nMaxRecursion = 32; | 9 const int nMaxRecursion = 32; |
10 int CPDF_Dest::GetPageIndex(CPDF_Document* pDoc) { | 10 int CPDF_Dest::GetPageIndex(CPDF_Document* pDoc) { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 while (g_sZoomModes[i][0] != '\0') { | 49 while (g_sZoomModes[i][0] != '\0') { |
50 if (mode == g_sZoomModes[i]) { | 50 if (mode == g_sZoomModes[i]) { |
51 return i + 1; | 51 return i + 1; |
52 } | 52 } |
53 i++; | 53 i++; |
54 } | 54 } |
55 return 0; | 55 return 0; |
56 } | 56 } |
57 FX_FLOAT CPDF_Dest::GetParam(int index) { | 57 FX_FLOAT CPDF_Dest::GetParam(int index) { |
58 CPDF_Array* pArray = ToArray(m_pObj); | 58 CPDF_Array* pArray = ToArray(m_pObj); |
59 return pArray ? pArray->GetNumber(2 + index) : 0; | 59 return pArray ? pArray->GetNumberAt(2 + index) : 0; |
60 } | 60 } |
61 CFX_ByteString CPDF_Dest::GetRemoteName() { | 61 CFX_ByteString CPDF_Dest::GetRemoteName() { |
62 return m_pObj ? m_pObj->GetString() : CFX_ByteString(); | 62 return m_pObj ? m_pObj->GetString() : CFX_ByteString(); |
63 } | 63 } |
64 CPDF_NameTree::CPDF_NameTree(CPDF_Document* pDoc, | 64 CPDF_NameTree::CPDF_NameTree(CPDF_Document* pDoc, |
65 const CFX_ByteStringC& category) { | 65 const CFX_ByteStringC& category) { |
66 if (pDoc->GetRoot() && pDoc->GetRoot()->GetDict("Names")) | 66 if (pDoc->GetRoot() && pDoc->GetRoot()->GetDictBy("Names")) |
67 m_pRoot = pDoc->GetRoot()->GetDict("Names")->GetDict(category); | 67 m_pRoot = pDoc->GetRoot()->GetDictBy("Names")->GetDictBy(category); |
68 else | 68 else |
69 m_pRoot = NULL; | 69 m_pRoot = NULL; |
70 } | 70 } |
71 static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, | 71 static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, |
72 const CFX_ByteString& csName, | 72 const CFX_ByteString& csName, |
73 int& nIndex, | 73 int& nIndex, |
74 CPDF_Array** ppFind, | 74 CPDF_Array** ppFind, |
75 int nLevel = 0) { | 75 int nLevel = 0) { |
76 if (nLevel > nMaxRecursion) { | 76 if (nLevel > nMaxRecursion) { |
77 return NULL; | 77 return NULL; |
78 } | 78 } |
79 CPDF_Array* pLimits = pNode->GetArray("Limits"); | 79 CPDF_Array* pLimits = pNode->GetArrayBy("Limits"); |
80 if (pLimits) { | 80 if (pLimits) { |
81 CFX_ByteString csLeft = pLimits->GetString(0); | 81 CFX_ByteString csLeft = pLimits->GetStringAt(0); |
82 CFX_ByteString csRight = pLimits->GetString(1); | 82 CFX_ByteString csRight = pLimits->GetStringAt(1); |
83 if (csLeft.Compare(csRight) > 0) { | 83 if (csLeft.Compare(csRight) > 0) { |
84 CFX_ByteString csTmp = csRight; | 84 CFX_ByteString csTmp = csRight; |
85 csRight = csLeft; | 85 csRight = csLeft; |
86 csLeft = csTmp; | 86 csLeft = csTmp; |
87 } | 87 } |
88 if (csName.Compare(csLeft) < 0 || csName.Compare(csRight) > 0) { | 88 if (csName.Compare(csLeft) < 0 || csName.Compare(csRight) > 0) { |
89 return NULL; | 89 return NULL; |
90 } | 90 } |
91 } | 91 } |
92 CPDF_Array* pNames = pNode->GetArray("Names"); | 92 CPDF_Array* pNames = pNode->GetArrayBy("Names"); |
93 if (pNames) { | 93 if (pNames) { |
94 FX_DWORD dwCount = pNames->GetCount() / 2; | 94 FX_DWORD dwCount = pNames->GetCount() / 2; |
95 for (FX_DWORD i = 0; i < dwCount; i++) { | 95 for (FX_DWORD i = 0; i < dwCount; i++) { |
96 CFX_ByteString csValue = pNames->GetString(i * 2); | 96 CFX_ByteString csValue = pNames->GetStringAt(i * 2); |
97 int32_t iCompare = csValue.Compare(csName); | 97 int32_t iCompare = csValue.Compare(csName); |
98 if (iCompare <= 0) { | 98 if (iCompare <= 0) { |
99 if (ppFind) { | 99 if (ppFind) { |
100 *ppFind = pNames; | 100 *ppFind = pNames; |
101 } | 101 } |
102 if (iCompare < 0) { | 102 if (iCompare < 0) { |
103 continue; | 103 continue; |
104 } | 104 } |
105 } else { | 105 } else { |
106 break; | 106 break; |
107 } | 107 } |
108 nIndex += i; | 108 nIndex += i; |
109 return pNames->GetElementValue(i * 2 + 1); | 109 return pNames->GetElementValue(i * 2 + 1); |
110 } | 110 } |
111 nIndex += dwCount; | 111 nIndex += dwCount; |
112 return NULL; | 112 return NULL; |
113 } | 113 } |
114 CPDF_Array* pKids = pNode->GetArray("Kids"); | 114 CPDF_Array* pKids = pNode->GetArrayBy("Kids"); |
115 if (!pKids) { | 115 if (!pKids) { |
116 return NULL; | 116 return NULL; |
117 } | 117 } |
118 for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { | 118 for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { |
119 CPDF_Dictionary* pKid = pKids->GetDict(i); | 119 CPDF_Dictionary* pKid = pKids->GetDictAt(i); |
120 if (!pKid) { | 120 if (!pKid) { |
121 continue; | 121 continue; |
122 } | 122 } |
123 CPDF_Object* pFound = | 123 CPDF_Object* pFound = |
124 SearchNameNode(pKid, csName, nIndex, ppFind, nLevel + 1); | 124 SearchNameNode(pKid, csName, nIndex, ppFind, nLevel + 1); |
125 if (pFound) { | 125 if (pFound) { |
126 return pFound; | 126 return pFound; |
127 } | 127 } |
128 } | 128 } |
129 return NULL; | 129 return NULL; |
130 } | 130 } |
131 static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, | 131 static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, |
132 int nIndex, | 132 int nIndex, |
133 int& nCurIndex, | 133 int& nCurIndex, |
134 CFX_ByteString& csName, | 134 CFX_ByteString& csName, |
135 CPDF_Array** ppFind, | 135 CPDF_Array** ppFind, |
136 int nLevel = 0) { | 136 int nLevel = 0) { |
137 if (nLevel > nMaxRecursion) { | 137 if (nLevel > nMaxRecursion) { |
138 return NULL; | 138 return NULL; |
139 } | 139 } |
140 CPDF_Array* pNames = pNode->GetArray("Names"); | 140 CPDF_Array* pNames = pNode->GetArrayBy("Names"); |
141 if (pNames) { | 141 if (pNames) { |
142 int nCount = pNames->GetCount() / 2; | 142 int nCount = pNames->GetCount() / 2; |
143 if (nIndex >= nCurIndex + nCount) { | 143 if (nIndex >= nCurIndex + nCount) { |
144 nCurIndex += nCount; | 144 nCurIndex += nCount; |
145 return NULL; | 145 return NULL; |
146 } | 146 } |
147 if (ppFind) { | 147 if (ppFind) { |
148 *ppFind = pNames; | 148 *ppFind = pNames; |
149 } | 149 } |
150 csName = pNames->GetString((nIndex - nCurIndex) * 2); | 150 csName = pNames->GetStringAt((nIndex - nCurIndex) * 2); |
151 return pNames->GetElementValue((nIndex - nCurIndex) * 2 + 1); | 151 return pNames->GetElementValue((nIndex - nCurIndex) * 2 + 1); |
152 } | 152 } |
153 CPDF_Array* pKids = pNode->GetArray("Kids"); | 153 CPDF_Array* pKids = pNode->GetArrayBy("Kids"); |
154 if (!pKids) { | 154 if (!pKids) { |
155 return NULL; | 155 return NULL; |
156 } | 156 } |
157 for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { | 157 for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { |
158 CPDF_Dictionary* pKid = pKids->GetDict(i); | 158 CPDF_Dictionary* pKid = pKids->GetDictAt(i); |
159 if (!pKid) { | 159 if (!pKid) { |
160 continue; | 160 continue; |
161 } | 161 } |
162 CPDF_Object* pFound = | 162 CPDF_Object* pFound = |
163 SearchNameNode(pKid, nIndex, nCurIndex, csName, ppFind, nLevel + 1); | 163 SearchNameNode(pKid, nIndex, nCurIndex, csName, ppFind, nLevel + 1); |
164 if (pFound) { | 164 if (pFound) { |
165 return pFound; | 165 return pFound; |
166 } | 166 } |
167 } | 167 } |
168 return NULL; | 168 return NULL; |
169 } | 169 } |
170 static int CountNames(CPDF_Dictionary* pNode, int nLevel = 0) { | 170 static int CountNames(CPDF_Dictionary* pNode, int nLevel = 0) { |
171 if (nLevel > nMaxRecursion) { | 171 if (nLevel > nMaxRecursion) { |
172 return 0; | 172 return 0; |
173 } | 173 } |
174 CPDF_Array* pNames = pNode->GetArray("Names"); | 174 CPDF_Array* pNames = pNode->GetArrayBy("Names"); |
175 if (pNames) { | 175 if (pNames) { |
176 return pNames->GetCount() / 2; | 176 return pNames->GetCount() / 2; |
177 } | 177 } |
178 CPDF_Array* pKids = pNode->GetArray("Kids"); | 178 CPDF_Array* pKids = pNode->GetArrayBy("Kids"); |
179 if (!pKids) { | 179 if (!pKids) { |
180 return 0; | 180 return 0; |
181 } | 181 } |
182 int nCount = 0; | 182 int nCount = 0; |
183 for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { | 183 for (FX_DWORD i = 0; i < pKids->GetCount(); i++) { |
184 CPDF_Dictionary* pKid = pKids->GetDict(i); | 184 CPDF_Dictionary* pKid = pKids->GetDictAt(i); |
185 if (!pKid) { | 185 if (!pKid) { |
186 continue; | 186 continue; |
187 } | 187 } |
188 nCount += CountNames(pKid, nLevel + 1); | 188 nCount += CountNames(pKid, nLevel + 1); |
189 } | 189 } |
190 return nCount; | 190 return nCount; |
191 } | 191 } |
192 int CPDF_NameTree::GetCount() const { | 192 int CPDF_NameTree::GetCount() const { |
193 if (!m_pRoot) { | 193 if (!m_pRoot) { |
194 return 0; | 194 return 0; |
(...skipping 22 matching lines...) Expand all Loading... |
217 if (!m_pRoot) { | 217 if (!m_pRoot) { |
218 return NULL; | 218 return NULL; |
219 } | 219 } |
220 int nIndex = 0; | 220 int nIndex = 0; |
221 return SearchNameNode(m_pRoot, csName, nIndex, NULL); | 221 return SearchNameNode(m_pRoot, csName, nIndex, NULL); |
222 } | 222 } |
223 CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc, | 223 CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc, |
224 const CFX_ByteStringC& sName) { | 224 const CFX_ByteStringC& sName) { |
225 CPDF_Object* pValue = LookupValue(sName); | 225 CPDF_Object* pValue = LookupValue(sName); |
226 if (!pValue) { | 226 if (!pValue) { |
227 CPDF_Dictionary* pDests = pDoc->GetRoot()->GetDict("Dests"); | 227 CPDF_Dictionary* pDests = pDoc->GetRoot()->GetDictBy("Dests"); |
228 if (!pDests) | 228 if (!pDests) |
229 return nullptr; | 229 return nullptr; |
230 pValue = pDests->GetElementValue(sName); | 230 pValue = pDests->GetElementValue(sName); |
231 } | 231 } |
232 if (!pValue) | 232 if (!pValue) |
233 return nullptr; | 233 return nullptr; |
234 if (CPDF_Array* pArray = pValue->AsArray()) | 234 if (CPDF_Array* pArray = pValue->AsArray()) |
235 return pArray; | 235 return pArray; |
236 if (CPDF_Dictionary* pDict = pValue->AsDictionary()) | 236 if (CPDF_Dictionary* pDict = pValue->AsDictionary()) |
237 return pDict->GetArray("D"); | 237 return pDict->GetArrayBy("D"); |
238 return nullptr; | 238 return nullptr; |
239 } | 239 } |
240 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \ | 240 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \ |
241 _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 241 _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
242 static CFX_WideString ChangeSlashToPlatform(const FX_WCHAR* str) { | 242 static CFX_WideString ChangeSlashToPlatform(const FX_WCHAR* str) { |
243 CFX_WideString result; | 243 CFX_WideString result; |
244 while (*str) { | 244 while (*str) { |
245 if (*str == '/') { | 245 if (*str == '/') { |
246 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 246 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
247 result += ':'; | 247 result += ':'; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 return result; | 297 return result; |
298 #else | 298 #else |
299 return filepath; | 299 return filepath; |
300 #endif | 300 #endif |
301 } | 301 } |
302 FX_BOOL CPDF_FileSpec::GetFileName(CFX_WideString& csFileName) const { | 302 FX_BOOL CPDF_FileSpec::GetFileName(CFX_WideString& csFileName) const { |
303 if (!m_pObj) { | 303 if (!m_pObj) { |
304 return FALSE; | 304 return FALSE; |
305 } | 305 } |
306 if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) { | 306 if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) { |
307 csFileName = pDict->GetUnicodeText("UF"); | 307 csFileName = pDict->GetUnicodeTextBy("UF"); |
308 if (csFileName.IsEmpty()) { | 308 if (csFileName.IsEmpty()) { |
309 csFileName = CFX_WideString::FromLocal(pDict->GetString("F")); | 309 csFileName = CFX_WideString::FromLocal(pDict->GetStringBy("F")); |
310 } | 310 } |
311 if (pDict->GetString("FS") == "URL") { | 311 if (pDict->GetStringBy("FS") == "URL") { |
312 return TRUE; | 312 return TRUE; |
313 } | 313 } |
314 if (csFileName.IsEmpty()) { | 314 if (csFileName.IsEmpty()) { |
315 if (pDict->KeyExist("DOS")) { | 315 if (pDict->KeyExist("DOS")) { |
316 csFileName = CFX_WideString::FromLocal(pDict->GetString("DOS")); | 316 csFileName = CFX_WideString::FromLocal(pDict->GetStringBy("DOS")); |
317 } else if (pDict->KeyExist("Mac")) { | 317 } else if (pDict->KeyExist("Mac")) { |
318 csFileName = CFX_WideString::FromLocal(pDict->GetString("Mac")); | 318 csFileName = CFX_WideString::FromLocal(pDict->GetStringBy("Mac")); |
319 } else if (pDict->KeyExist("Unix")) { | 319 } else if (pDict->KeyExist("Unix")) { |
320 csFileName = CFX_WideString::FromLocal(pDict->GetString("Unix")); | 320 csFileName = CFX_WideString::FromLocal(pDict->GetStringBy("Unix")); |
321 } else { | 321 } else { |
322 return FALSE; | 322 return FALSE; |
323 } | 323 } |
324 } | 324 } |
325 } else { | 325 } else { |
326 csFileName = CFX_WideString::FromLocal(m_pObj->GetString()); | 326 csFileName = CFX_WideString::FromLocal(m_pObj->GetString()); |
327 } | 327 } |
328 csFileName = FILESPEC_DecodeFileName(csFileName); | 328 csFileName = FILESPEC_DecodeFileName(csFileName); |
329 return TRUE; | 329 return TRUE; |
330 } | 330 } |
331 CPDF_FileSpec::CPDF_FileSpec() { | 331 CPDF_FileSpec::CPDF_FileSpec() { |
332 m_pObj = new CPDF_Dictionary; | 332 m_pObj = new CPDF_Dictionary; |
333 if (CPDF_Dictionary* pDict = ToDictionary(m_pObj)) { | 333 if (CPDF_Dictionary* pDict = ToDictionary(m_pObj)) { |
334 pDict->SetAtName("Type", "Filespec"); | 334 pDict->SetAtName("Type", "Filespec"); |
335 } | 335 } |
336 } | 336 } |
337 FX_BOOL CPDF_FileSpec::IsURL() const { | 337 FX_BOOL CPDF_FileSpec::IsURL() const { |
338 if (CPDF_Dictionary* pDict = ToDictionary(m_pObj)) { | 338 if (CPDF_Dictionary* pDict = ToDictionary(m_pObj)) { |
339 return pDict->GetString("FS") == "URL"; | 339 return pDict->GetStringBy("FS") == "URL"; |
340 } | 340 } |
341 return FALSE; | 341 return FALSE; |
342 } | 342 } |
343 CFX_WideString FILESPEC_EncodeFileName(const CFX_WideStringC& filepath) { | 343 CFX_WideString FILESPEC_EncodeFileName(const CFX_WideStringC& filepath) { |
344 if (filepath.GetLength() <= 1) { | 344 if (filepath.GetLength() <= 1) { |
345 return CFX_WideString(); | 345 return CFX_WideString(); |
346 } | 346 } |
347 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 347 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
348 if (filepath.GetAt(1) == ':') { | 348 if (filepath.GetAt(1) == ':') { |
349 CFX_WideString result; | 349 CFX_WideString result; |
(...skipping 25 matching lines...) Expand all Loading... |
375 return ChangeSlashToPDF(filepath.GetPtr()); | 375 return ChangeSlashToPDF(filepath.GetPtr()); |
376 #else | 376 #else |
377 return filepath; | 377 return filepath; |
378 #endif | 378 #endif |
379 } | 379 } |
380 CPDF_Stream* CPDF_FileSpec::GetFileStream() const { | 380 CPDF_Stream* CPDF_FileSpec::GetFileStream() const { |
381 if (!m_pObj) | 381 if (!m_pObj) |
382 return nullptr; | 382 return nullptr; |
383 if (CPDF_Stream* pStream = m_pObj->AsStream()) | 383 if (CPDF_Stream* pStream = m_pObj->AsStream()) |
384 return pStream; | 384 return pStream; |
385 if (CPDF_Dictionary* pEF = m_pObj->AsDictionary()->GetDict("EF")) | 385 if (CPDF_Dictionary* pEF = m_pObj->AsDictionary()->GetDictBy("EF")) |
386 return pEF->GetStream("F"); | 386 return pEF->GetStreamBy("F"); |
387 return nullptr; | 387 return nullptr; |
388 } | 388 } |
389 static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object* pObj, | 389 static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object* pObj, |
390 const CFX_WideStringC& wsFileName, | 390 const CFX_WideStringC& wsFileName, |
391 FX_BOOL bURL) { | 391 FX_BOOL bURL) { |
392 CFX_WideString wsStr; | 392 CFX_WideString wsStr; |
393 if (bURL) { | 393 if (bURL) { |
394 wsStr = wsFileName; | 394 wsStr = wsFileName; |
395 } else { | 395 } else { |
396 wsStr = FILESPEC_EncodeFileName(wsFileName); | 396 wsStr = FILESPEC_EncodeFileName(wsFileName); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 } | 468 } |
469 CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const { | 469 CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const { |
470 CFX_WideString wsLabel; | 470 CFX_WideString wsLabel; |
471 if (!m_pDocument) { | 471 if (!m_pDocument) { |
472 return wsLabel; | 472 return wsLabel; |
473 } | 473 } |
474 CPDF_Dictionary* pPDFRoot = m_pDocument->GetRoot(); | 474 CPDF_Dictionary* pPDFRoot = m_pDocument->GetRoot(); |
475 if (!pPDFRoot) { | 475 if (!pPDFRoot) { |
476 return wsLabel; | 476 return wsLabel; |
477 } | 477 } |
478 CPDF_Dictionary* pLabels = pPDFRoot->GetDict("PageLabels"); | 478 CPDF_Dictionary* pLabels = pPDFRoot->GetDictBy("PageLabels"); |
479 CPDF_NumberTree numberTree(pLabels); | 479 CPDF_NumberTree numberTree(pLabels); |
480 CPDF_Object* pValue = NULL; | 480 CPDF_Object* pValue = NULL; |
481 int n = nPage; | 481 int n = nPage; |
482 while (n >= 0) { | 482 while (n >= 0) { |
483 pValue = numberTree.LookupValue(n); | 483 pValue = numberTree.LookupValue(n); |
484 if (pValue) { | 484 if (pValue) { |
485 break; | 485 break; |
486 } | 486 } |
487 n--; | 487 n--; |
488 } | 488 } |
489 if (pValue) { | 489 if (pValue) { |
490 pValue = pValue->GetDirect(); | 490 pValue = pValue->GetDirect(); |
491 if (CPDF_Dictionary* pLabel = pValue->AsDictionary()) { | 491 if (CPDF_Dictionary* pLabel = pValue->AsDictionary()) { |
492 if (pLabel->KeyExist("P")) { | 492 if (pLabel->KeyExist("P")) { |
493 wsLabel += pLabel->GetUnicodeText("P"); | 493 wsLabel += pLabel->GetUnicodeTextBy("P"); |
494 } | 494 } |
495 CFX_ByteString bsNumberingStyle = pLabel->GetString("S", NULL); | 495 CFX_ByteString bsNumberingStyle = pLabel->GetStringBy("S", NULL); |
496 int nLabelNum = nPage - n + pLabel->GetInteger("St", 1); | 496 int nLabelNum = nPage - n + pLabel->GetIntegerBy("St", 1); |
497 CFX_WideString wsNumPortion = | 497 CFX_WideString wsNumPortion = |
498 _GetLabelNumPortion(nLabelNum, bsNumberingStyle); | 498 _GetLabelNumPortion(nLabelNum, bsNumberingStyle); |
499 wsLabel += wsNumPortion; | 499 wsLabel += wsNumPortion; |
500 return wsLabel; | 500 return wsLabel; |
501 } | 501 } |
502 } | 502 } |
503 wsLabel.Format(L"%d", nPage + 1); | 503 wsLabel.Format(L"%d", nPage + 1); |
504 return wsLabel; | 504 return wsLabel; |
505 } | 505 } |
506 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_ByteStringC& bsLabel) const { | 506 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_ByteStringC& bsLabel) const { |
(...skipping 17 matching lines...) Expand all Loading... |
524 int nPage = FXSYS_atoi(bsLbl); | 524 int nPage = FXSYS_atoi(bsLbl); |
525 if (nPage > 0 && nPage <= nPages) { | 525 if (nPage > 0 && nPage <= nPages) { |
526 return nPage; | 526 return nPage; |
527 } | 527 } |
528 return -1; | 528 return -1; |
529 } | 529 } |
530 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { | 530 int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { |
531 CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr()); | 531 CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr()); |
532 return GetPageByLabel(bsLabel); | 532 return GetPageByLabel(bsLabel); |
533 } | 533 } |
OLD | NEW |