summaryrefslogtreecommitdiff
path: root/core/fpdftext/cpdf_textpage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdftext/cpdf_textpage.cpp')
-rw-r--r--core/fpdftext/cpdf_textpage.cpp49
1 files changed, 24 insertions, 25 deletions
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index ee1d51bfd8..f73793cd72 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -348,14 +348,14 @@ int CPDF_TextPage::GetIndexAtPos(const CFX_PointF& point,
return pos < pdfium::CollectionSize<int>(m_CharList) ? pos : NearPos;
}
-CFX_WideString CPDF_TextPage::GetTextByRect(const CFX_FloatRect& rect) const {
+WideString CPDF_TextPage::GetTextByRect(const CFX_FloatRect& rect) const {
if (!m_bIsParsed)
- return CFX_WideString();
+ return WideString();
float posy = 0;
bool IsContainPreChar = false;
bool IsAddLineFeed = false;
- CFX_WideString strText;
+ WideString strText;
for (const auto& charinfo : m_CharList) {
if (IsRectIntersect(rect, charinfo.m_CharBox)) {
if (fabs(posy - charinfo.m_Origin.y) > 0 && !IsContainPreChar &&
@@ -436,7 +436,7 @@ void CPDF_TextPage::CheckMarkedContentObject(int32_t& start,
}
}
-CFX_WideString CPDF_TextPage::GetPageText(int start, int nCount) const {
+WideString CPDF_TextPage::GetPageText(int start, int nCount) const {
if (!m_bIsParsed || nCount == 0)
return L"";
@@ -445,8 +445,8 @@ CFX_WideString CPDF_TextPage::GetPageText(int start, int nCount) const {
if (nCount == -1) {
nCount = pdfium::CollectionSize<int>(m_CharList) - start;
- CFX_WideStringC wsTextBuf = m_TextBuf.AsStringC();
- return CFX_WideString(wsTextBuf.Right(wsTextBuf.GetLength() - start));
+ WideStringView wsTextBuf = m_TextBuf.AsStringView();
+ return WideString(wsTextBuf.Right(wsTextBuf.GetLength() - start));
}
if (nCount <= 0 || m_CharList.empty())
return L"";
@@ -478,7 +478,7 @@ CFX_WideString CPDF_TextPage::GetPageText(int start, int nCount) const {
nCount = start + nCount - nCountOffset - startindex;
if (nCount <= 0)
return L"";
- return CFX_WideString(m_TextBuf.AsStringC().Mid(startindex, nCount));
+ return WideString(m_TextBuf.AsStringView().Mid(startindex, nCount));
}
int CPDF_TextPage::CountRects(int start, int nCount) {
@@ -630,7 +630,7 @@ int CPDF_TextPage::GetCharWidth(uint32_t charCode, CPDF_Font* pFont) const {
if (int w = pFont->GetCharWidthF(charCode))
return w;
- CFX_ByteString str;
+ ByteString str;
pFont->AppendChar(&str, charCode);
if (int w = pFont->GetStringWidth(str.c_str(), 1))
return w;
@@ -702,7 +702,7 @@ void CPDF_TextPage::CloseTempLine() {
if (m_TempCharList.empty())
return;
- CFX_WideString str = m_TempTextBuf.MakeString();
+ WideString str = m_TempTextBuf.MakeString();
bool bPrevSpace = false;
for (FX_STRSIZE i = 0; i < str.GetLength(); i++) {
if (str[i] != ' ') {
@@ -814,7 +814,7 @@ FPDFText_MarkedContent CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) {
if (nContentMark < 1)
return FPDFText_MarkedContent::Pass;
- CFX_WideString actText;
+ WideString actText;
bool bExist = false;
CPDF_Dictionary* pDict = nullptr;
int n = 0;
@@ -876,7 +876,7 @@ void CPDF_TextPage::ProcessMarkedContent(PDFTEXT_Obj Obj) {
if (nContentMark < 1)
return;
- CFX_WideString actText;
+ WideString actText;
for (int n = 0; n < nContentMark; n++) {
const CPDF_ContentMarkItem& item = pTextObj->m_ContentMark.GetItem(n);
CPDF_Dictionary* pDict = item.GetParam();
@@ -941,13 +941,13 @@ void CPDF_TextPage::SwapTempTextBuf(int32_t iCharListStartAppend,
bool CPDF_TextPage::IsRightToLeft(const CPDF_TextObject* pTextObj,
const CPDF_Font* pFont,
int nItems) const {
- CFX_WideString str;
+ WideString str;
for (int32_t i = 0; i < nItems; i++) {
CPDF_TextObjectItem item;
pTextObj->GetItemInfo(i, &item);
if (item.m_CharCode == static_cast<uint32_t>(-1))
continue;
- CFX_WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode);
+ WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode);
wchar_t wChar = !wstrItem.IsEmpty() ? wstrItem[0] : 0;
if (wChar == 0)
wChar = item.m_CharCode;
@@ -1004,7 +1004,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
if (pTextObj->CountChars() == 1) {
CPDF_TextObjectItem item;
pTextObj->GetCharInfo(0, &item);
- CFX_WideString wstrItem =
+ WideString wstrItem =
pTextObj->GetFont()->UnicodeFromCharCode(item.m_CharCode);
if (wstrItem.IsEmpty())
wstrItem += (wchar_t)item.m_CharCode;
@@ -1013,7 +1013,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
return;
}
while (m_TempTextBuf.GetSize() > 0 &&
- m_TempTextBuf.AsStringC()[m_TempTextBuf.GetLength() - 1] ==
+ m_TempTextBuf.AsStringView()[m_TempTextBuf.GetLength() - 1] ==
0x20) {
m_TempTextBuf.Delete(m_TempTextBuf.GetLength() - 1, 1);
m_TempCharList.pop_back();
@@ -1053,9 +1053,9 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
PAGECHAR_INFO charinfo;
pTextObj->GetItemInfo(i, &item);
if (item.m_CharCode == static_cast<uint32_t>(-1)) {
- CFX_WideString str = m_TempTextBuf.MakeString();
+ WideString str = m_TempTextBuf.MakeString();
if (str.IsEmpty())
- str = m_TextBuf.AsStringC();
+ str = m_TextBuf.AsStringView();
if (str.IsEmpty() || str[str.GetLength() - 1] == TEXT_SPACE_CHAR)
continue;
@@ -1106,7 +1106,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
continue;
}
spacing = 0;
- CFX_WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode);
+ WideString wstrItem = pFont->UnicodeFromCharCode(item.m_CharCode);
bool bNoUnicode = false;
if (wstrItem.IsEmpty() && item.m_CharCode) {
wstrItem += static_cast<wchar_t>(item.m_CharCode);
@@ -1177,7 +1177,7 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) {
m_TempCharList.push_back(charinfo);
}
} else if (i == 0) {
- CFX_WideString str = m_TempTextBuf.MakeString();
+ WideString str = m_TempTextBuf.MakeString();
if (!str.IsEmpty() && str[str.GetLength() - 1] == TEXT_SPACE_CHAR) {
m_TempTextBuf.Delete(m_TempTextBuf.GetLength() - 1, 1);
m_TempCharList.pop_back();
@@ -1220,11 +1220,11 @@ CPDF_TextPage::TextOrientation CPDF_TextPage::GetTextObjectWritingMode(
}
bool CPDF_TextPage::IsHyphen(wchar_t curChar) const {
- CFX_WideStringC curText;
+ WideStringView curText;
if (!m_TempTextBuf.IsEmpty())
- curText = m_TempTextBuf.AsStringC();
+ curText = m_TempTextBuf.AsStringView();
else if (!m_TextBuf.IsEmpty())
- curText = m_TextBuf.AsStringC();
+ curText = m_TextBuf.AsStringView();
else
return false;
@@ -1267,8 +1267,7 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
int nItem = m_pPreTextObj->CountItems();
m_pPreTextObj->GetItemInfo(nItem - 1, &PrevItem);
pObj->GetItemInfo(0, &item);
- CFX_WideString wstrItem =
- pObj->GetFont()->UnicodeFromCharCode(item.m_CharCode);
+ WideString wstrItem = pObj->GetFont()->UnicodeFromCharCode(item.m_CharCode);
if (wstrItem.IsEmpty())
wstrItem += static_cast<wchar_t>(item.m_CharCode);
wchar_t curChar = wstrItem[0];
@@ -1356,7 +1355,7 @@ CPDF_TextPage::GenerateCharacter CPDF_TextPage::ProcessInsertObject(
IsHyphen(curChar)) {
return GenerateCharacter::Hyphen;
}
- CFX_WideString PrevStr =
+ WideString PrevStr =
m_pPreTextObj->GetFont()->UnicodeFromCharCode(PrevItem.m_CharCode);
if (PrevStr.IsEmpty())
return GenerateCharacter::None;