| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <cctype> | 8 #include <cctype> |
| 9 #include <cwctype> | 9 #include <cwctype> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 if (FXSYS_fabs(this_y - prev_y) > threshold * 2) { | 981 if (FXSYS_fabs(this_y - prev_y) > threshold * 2) { |
| 982 for (int i = 0; i < count; i++) { | 982 for (int i = 0; i < count; i++) { |
| 983 ProcessTextObject(m_LineObj.GetAt(i)); | 983 ProcessTextObject(m_LineObj.GetAt(i)); |
| 984 } | 984 } |
| 985 m_LineObj.RemoveAll(); | 985 m_LineObj.RemoveAll(); |
| 986 m_LineObj.Add(Obj); | 986 m_LineObj.Add(Obj); |
| 987 return; | 987 return; |
| 988 } | 988 } |
| 989 int i = 0; | 989 int i = 0; |
| 990 for (i = count - 1; i >= 0; i--) { | 990 for (i = count - 1; i >= 0; i--) { |
| 991 PDFTEXT_Obj prev_Obj = m_LineObj.GetAt(i); | 991 PDFTEXT_Obj prev_text_obj = m_LineObj.GetAt(i); |
| 992 CFX_Matrix prev_matrix; | 992 FX_FLOAT Prev_x = prev_text_obj.m_pTextObj->GetPosX(), |
| 993 prev_Obj.m_pTextObj->GetTextMatrix(&prev_matrix); | 993 Prev_y = prev_text_obj.m_pTextObj->GetPosY(); |
| 994 FX_FLOAT Prev_x = prev_Obj.m_pTextObj->GetPosX(), | 994 prev_text_obj.m_formMatrix.Transform(Prev_x, Prev_y); |
| 995 Prev_y = prev_Obj.m_pTextObj->GetPosY(); | |
| 996 prev_Obj.m_formMatrix.Transform(Prev_x, Prev_y); | |
| 997 m_DisplayMatrix.Transform(Prev_x, Prev_y); | 995 m_DisplayMatrix.Transform(Prev_x, Prev_y); |
| 998 if (this_x >= Prev_x) { | 996 if (this_x >= Prev_x) { |
| 999 if (i == count - 1) { | 997 if (i == count - 1) |
| 1000 m_LineObj.Add(Obj); | 998 m_LineObj.Add(Obj); |
| 1001 } else { | 999 else |
| 1002 m_LineObj.InsertAt(i + 1, Obj); | 1000 m_LineObj.InsertAt(i + 1, Obj); |
| 1003 } | |
| 1004 break; | 1001 break; |
| 1005 } | 1002 } |
| 1006 } | 1003 } |
| 1007 if (i < 0) { | 1004 if (i < 0) { |
| 1008 m_LineObj.InsertAt(0, Obj); | 1005 m_LineObj.InsertAt(0, Obj); |
| 1009 } | 1006 } |
| 1010 } | 1007 } |
| 1011 | 1008 |
| 1012 FPDFText_MarkedContent CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) { | 1009 FPDFText_MarkedContent CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) { |
| 1013 CPDF_TextObject* pTextObj = Obj.m_pTextObj; | 1010 CPDF_TextObject* pTextObj = Obj.m_pTextObj; |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1604 m_pPreTextObj->GetTextMatrix(&m); | 1601 m_pPreTextObj->GetTextMatrix(&m); |
| 1605 if (PrevItem.m_OriginX > tempItem.m_OriginX && | 1602 if (PrevItem.m_OriginX > tempItem.m_OriginX && |
| 1606 m_DisplayMatrix.a > 0.9 && m_DisplayMatrix.b < 0.1 && | 1603 m_DisplayMatrix.a > 0.9 && m_DisplayMatrix.b < 0.1 && |
| 1607 m_DisplayMatrix.c < 0.1 && m_DisplayMatrix.d < -0.9 && m.b < 0.1 && | 1604 m_DisplayMatrix.c < 0.1 && m_DisplayMatrix.d < -0.9 && m.b < 0.1 && |
| 1608 m.c < 0.1) { | 1605 m.c < 0.1) { |
| 1609 CFX_FloatRect re(0, m_pPreTextObj->m_Bottom, 1000, | 1606 CFX_FloatRect re(0, m_pPreTextObj->m_Bottom, 1000, |
| 1610 m_pPreTextObj->m_Top); | 1607 m_pPreTextObj->m_Top); |
| 1611 if (re.Contains(pObj->GetPosX(), pObj->GetPosY())) { | 1608 if (re.Contains(pObj->GetPosX(), pObj->GetPosY())) { |
| 1612 bNewline = FALSE; | 1609 bNewline = FALSE; |
| 1613 } else { | 1610 } else { |
| 1614 CFX_FloatRect re(0, pObj->m_Bottom, 1000, pObj->m_Top); | 1611 CFX_FloatRect rect(0, pObj->m_Bottom, 1000, pObj->m_Top); |
| 1615 if (re.Contains(m_pPreTextObj->GetPosX(), | 1612 if (rect.Contains(m_pPreTextObj->GetPosX(), |
| 1616 m_pPreTextObj->GetPosY())) { | 1613 m_pPreTextObj->GetPosY())) { |
| 1617 bNewline = FALSE; | 1614 bNewline = FALSE; |
| 1618 } | 1615 } |
| 1619 } | 1616 } |
| 1620 } | 1617 } |
| 1621 } | 1618 } |
| 1622 } | 1619 } |
| 1623 } | 1620 } |
| 1624 if (bNewline) | 1621 if (bNewline) |
| 1625 return IsHyphen(curChar) ? 3 : 2; | 1622 return IsHyphen(curChar) ? 3 : 2; |
| 1626 | 1623 |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2341 return index < m_LinkArray.size() ? m_LinkArray[index].m_strUrl : L""; | 2338 return index < m_LinkArray.size() ? m_LinkArray[index].m_strUrl : L""; |
| 2342 } | 2339 } |
| 2343 | 2340 |
| 2344 std::vector<CFX_FloatRect> CPDF_LinkExtract::GetRects(size_t index) const { | 2341 std::vector<CFX_FloatRect> CPDF_LinkExtract::GetRects(size_t index) const { |
| 2345 if (index >= m_LinkArray.size()) | 2342 if (index >= m_LinkArray.size()) |
| 2346 return std::vector<CFX_FloatRect>(); | 2343 return std::vector<CFX_FloatRect>(); |
| 2347 | 2344 |
| 2348 return m_pTextPage->GetRectArray(m_LinkArray[index].m_Start, | 2345 return m_pTextPage->GetRectArray(m_LinkArray[index].m_Start, |
| 2349 m_LinkArray[index].m_Count); | 2346 m_LinkArray[index].m_Count); |
| 2350 } | 2347 } |
| OLD | NEW |