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 "Document.h" | 7 #include "Document.h" |
8 | 8 |
9 #include "Field.h" | 9 #include "Field.h" |
10 #include "Icon.h" | 10 #include "Icon.h" |
(...skipping 1362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1373 } | 1373 } |
1374 | 1374 |
1375 CPDF_Dictionary* pPageDict = pDocument->GetPage(nPageNo); | 1375 CPDF_Dictionary* pPageDict = pDocument->GetPage(nPageNo); |
1376 if (!pPageDict) | 1376 if (!pPageDict) |
1377 return FALSE; | 1377 return FALSE; |
1378 | 1378 |
1379 CPDF_Page page; | 1379 CPDF_Page page; |
1380 page.Load(pDocument, pPageDict); | 1380 page.Load(pDocument, pPageDict); |
1381 page.ParseContent(nullptr); | 1381 page.ParseContent(nullptr); |
1382 | 1382 |
1383 FX_POSITION pos = page.GetFirstObjectPosition(); | |
1384 | |
1385 int nWords = 0; | 1383 int nWords = 0; |
1386 | |
1387 CFX_WideString swRet; | 1384 CFX_WideString swRet; |
1388 | 1385 FX_POSITION pos = page.GetPageObjectList()->GetHeadPosition(); |
1389 while (pos) { | 1386 while (pos) { |
1390 if (CPDF_PageObject* pPageObj = page.GetNextObject(pos)) { | 1387 if (CPDF_PageObject* pPageObj = |
| 1388 page.GetPageObjectList()->GetNextObject(pos)) { |
1391 if (pPageObj->m_Type == CPDF_PageObject::TEXT) { | 1389 if (pPageObj->m_Type == CPDF_PageObject::TEXT) { |
1392 int nObjWords = CountWords((CPDF_TextObject*)pPageObj); | 1390 int nObjWords = CountWords((CPDF_TextObject*)pPageObj); |
1393 | 1391 |
1394 if (nWords + nObjWords >= nWordNo) { | 1392 if (nWords + nObjWords >= nWordNo) { |
1395 swRet = GetObjWordStr((CPDF_TextObject*)pPageObj, nWordNo - nWords); | 1393 swRet = GetObjWordStr((CPDF_TextObject*)pPageObj, nWordNo - nWords); |
1396 break; | 1394 break; |
1397 } | 1395 } |
1398 | 1396 |
1399 nWords += nObjWords; | 1397 nWords += nObjWords; |
1400 } | 1398 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 | 1435 |
1438 CPDF_Dictionary* pPageDict = pDocument->GetPage(nPageNo); | 1436 CPDF_Dictionary* pPageDict = pDocument->GetPage(nPageNo); |
1439 if (!pPageDict) | 1437 if (!pPageDict) |
1440 return FALSE; | 1438 return FALSE; |
1441 | 1439 |
1442 CPDF_Page page; | 1440 CPDF_Page page; |
1443 page.Load(pDocument, pPageDict); | 1441 page.Load(pDocument, pPageDict); |
1444 page.ParseContent(nullptr); | 1442 page.ParseContent(nullptr); |
1445 | 1443 |
1446 int nWords = 0; | 1444 int nWords = 0; |
1447 FX_POSITION pos = page.GetFirstObjectPosition(); | 1445 FX_POSITION pos = page.GetPageObjectList()->GetHeadPosition(); |
1448 while (pos) { | 1446 while (pos) { |
1449 if (CPDF_PageObject* pPageObj = page.GetNextObject(pos)) { | 1447 if (CPDF_PageObject* pPageObj = |
| 1448 page.GetPageObjectList()->GetNextObject(pos)) { |
1450 if (pPageObj->m_Type == CPDF_PageObject::TEXT) { | 1449 if (pPageObj->m_Type == CPDF_PageObject::TEXT) { |
1451 CPDF_TextObject* pTextObj = (CPDF_TextObject*)pPageObj; | 1450 CPDF_TextObject* pTextObj = (CPDF_TextObject*)pPageObj; |
1452 nWords += CountWords(pTextObj); | 1451 nWords += CountWords(pTextObj); |
1453 } | 1452 } |
1454 } | 1453 } |
1455 } | 1454 } |
1456 | 1455 |
1457 vRet = nWords; | 1456 vRet = nWords; |
1458 return TRUE; | 1457 return TRUE; |
1459 } | 1458 } |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1636 CJS_DelayData* pData = DelayDataForFieldAndControlIndex.GetAt(i); | 1635 CJS_DelayData* pData = DelayDataForFieldAndControlIndex.GetAt(i); |
1637 Field::DoDelay(m_pDocument, pData); | 1636 Field::DoDelay(m_pDocument, pData); |
1638 DelayDataForFieldAndControlIndex.SetAt(i, NULL); | 1637 DelayDataForFieldAndControlIndex.SetAt(i, NULL); |
1639 delete pData; | 1638 delete pData; |
1640 } | 1639 } |
1641 } | 1640 } |
1642 | 1641 |
1643 CJS_Document* Document::GetCJSDoc() const { | 1642 CJS_Document* Document::GetCJSDoc() const { |
1644 return static_cast<CJS_Document*>(m_pJSObject); | 1643 return static_cast<CJS_Document*>(m_pJSObject); |
1645 } | 1644 } |
OLD | NEW |