Index: fpdfsdk/fpdftext.cpp |
diff --git a/fpdfsdk/fpdftext.cpp b/fpdfsdk/fpdftext.cpp |
index 0d0e86f12db9884cce96e9a22139bdccd63e748c..5dc45c14f0d57d714cc7c7b47896d8e34e273fd3 100644 |
--- a/fpdfsdk/fpdftext.cpp |
+++ b/fpdfsdk/fpdftext.cpp |
@@ -8,9 +8,9 @@ |
#include "core/fpdfapi/fpdf_page/include/cpdf_page.h" |
#include "core/fpdfdoc/include/fpdf_doc.h" |
-#include "core/fpdftext/include/ipdf_linkextract.h" |
-#include "core/fpdftext/include/ipdf_textpage.h" |
-#include "core/fpdftext/include/ipdf_textpagefind.h" |
+#include "core/fpdftext/include/cpdf_linkextract.h" |
+#include "core/fpdftext/include/cpdf_textpage.h" |
+#include "core/fpdftext/include/cpdf_textpagefind.h" |
#include "fpdfsdk/include/fsdk_define.h" |
#ifdef PDF_ENABLE_XFA |
@@ -33,18 +33,18 @@ DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page) { |
#else // PDF_ENABLE_XFA |
CPDF_ViewerPreferences viewRef(pPDFPage->m_pDocument); |
#endif // PDF_ENABLE_XFA |
- IPDF_TextPage* textpage = |
- IPDF_TextPage::CreateTextPage(pPDFPage, viewRef.IsDirectionR2L()); |
+ CPDF_TextPage* textpage = |
+ new CPDF_TextPage(pPDFPage, viewRef.IsDirectionR2L()); |
textpage->ParseTextPage(); |
return textpage; |
} |
DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page) { |
- delete (IPDF_TextPage*)text_page; |
+ delete static_cast<CPDF_TextPage*>(text_page); |
} |
DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page) { |
if (!text_page) |
return -1; |
- IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
+ CPDF_TextPage* textpage = static_cast<CPDF_TextPage*>(text_page); |
return textpage->CountChars(); |
} |
@@ -52,7 +52,7 @@ DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page, |
int index) { |
if (!text_page) |
return 0; |
- IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
+ CPDF_TextPage* textpage = static_cast<CPDF_TextPage*>(text_page); |
if (index < 0 || index >= textpage->CountChars()) |
return 0; |
@@ -66,7 +66,7 @@ DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page, |
int index) { |
if (!text_page) |
return 0; |
- IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
+ CPDF_TextPage* textpage = static_cast<CPDF_TextPage*>(text_page); |
if (index < 0 || index >= textpage->CountChars()) |
return 0; |
@@ -84,7 +84,7 @@ DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page, |
double* top) { |
if (!text_page) |
return; |
- IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
+ CPDF_TextPage* textpage = static_cast<CPDF_TextPage*>(text_page); |
if (index < 0 || index >= textpage->CountChars()) |
return; |
@@ -104,7 +104,7 @@ DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page, |
double yTolerance) { |
if (!text_page) |
return -3; |
- IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
+ CPDF_TextPage* textpage = static_cast<CPDF_TextPage*>(text_page); |
return textpage->GetIndexAtPos((FX_FLOAT)x, (FX_FLOAT)y, (FX_FLOAT)xTolerance, |
(FX_FLOAT)yTolerance); |
} |
@@ -115,7 +115,7 @@ DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page, |
unsigned short* result) { |
if (!text_page) |
return 0; |
- IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
+ CPDF_TextPage* textpage = static_cast<CPDF_TextPage*>(text_page); |
if (start >= textpage->CountChars()) |
return 0; |
@@ -137,7 +137,7 @@ DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page, |
int count) { |
if (!text_page) |
return 0; |
- IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
+ CPDF_TextPage* textpage = static_cast<CPDF_TextPage*>(text_page); |
return textpage->CountRects(start, count); |
} |
DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page, |
@@ -148,7 +148,7 @@ DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page, |
double* bottom) { |
if (!text_page) |
return; |
- IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
+ CPDF_TextPage* textpage = static_cast<CPDF_TextPage*>(text_page); |
CFX_FloatRect rect; |
textpage->GetRect(rect_index, rect.left, rect.top, rect.right, rect.bottom); |
*left = rect.left; |
@@ -166,7 +166,7 @@ DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page, |
int buflen) { |
if (!text_page) |
return 0; |
- IPDF_TextPage* textpage = (IPDF_TextPage*)text_page; |
+ CPDF_TextPage* textpage = static_cast<CPDF_TextPage*>(text_page); |
CFX_FloatRect rect((FX_FLOAT)left, (FX_FLOAT)bottom, (FX_FLOAT)right, |
(FX_FLOAT)top); |
CFX_WideString str = textpage->GetTextByRect(rect); |
@@ -193,41 +193,47 @@ DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page, |
int start_index) { |
if (!text_page) |
return NULL; |
- IPDF_TextPageFind* textpageFind = NULL; |
- textpageFind = IPDF_TextPageFind::CreatePageFind((IPDF_TextPage*)text_page); |
+ |
+ CPDF_TextPageFind* textpageFind = |
+ new CPDF_TextPageFind(static_cast<CPDF_TextPage*>(text_page)); |
FX_STRSIZE len = CFX_WideString::WStringLength(findwhat); |
textpageFind->FindFirst(CFX_WideString::FromUTF16LE(findwhat, len), flags, |
start_index); |
return textpageFind; |
} |
+ |
DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle) { |
if (!handle) |
return FALSE; |
- IPDF_TextPageFind* textpageFind = (IPDF_TextPageFind*)handle; |
+ CPDF_TextPageFind* textpageFind = static_cast<CPDF_TextPageFind*>(handle); |
return textpageFind->FindNext(); |
} |
+ |
DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle) { |
if (!handle) |
return FALSE; |
- IPDF_TextPageFind* textpageFind = (IPDF_TextPageFind*)handle; |
+ CPDF_TextPageFind* textpageFind = static_cast<CPDF_TextPageFind*>(handle); |
return textpageFind->FindPrev(); |
} |
+ |
DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle) { |
if (!handle) |
return 0; |
- IPDF_TextPageFind* textpageFind = (IPDF_TextPageFind*)handle; |
+ CPDF_TextPageFind* textpageFind = static_cast<CPDF_TextPageFind*>(handle); |
return textpageFind->GetCurOrder(); |
} |
+ |
DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle) { |
if (!handle) |
return 0; |
- IPDF_TextPageFind* textpageFind = (IPDF_TextPageFind*)handle; |
+ CPDF_TextPageFind* textpageFind = static_cast<CPDF_TextPageFind*>(handle); |
return textpageFind->GetMatchedCount(); |
} |
+ |
DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle) { |
if (!handle) |
return; |
- IPDF_TextPageFind* textpageFind = (IPDF_TextPageFind*)handle; |
+ CPDF_TextPageFind* textpageFind = static_cast<CPDF_TextPageFind*>(handle); |
delete textpageFind; |
handle = NULL; |
} |
@@ -236,15 +242,14 @@ DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle) { |
DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page) { |
if (!text_page) |
return NULL; |
- IPDF_LinkExtract* pageLink = NULL; |
- pageLink = IPDF_LinkExtract::CreateLinkExtract(); |
- pageLink->ExtractLinks((IPDF_TextPage*)text_page); |
+ CPDF_LinkExtract* pageLink = new CPDF_LinkExtract; |
+ pageLink->ExtractLinks(static_cast<CPDF_TextPage*>(text_page)); |
return pageLink; |
} |
DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page) { |
if (!link_page) |
return 0; |
- IPDF_LinkExtract* pageLink = (IPDF_LinkExtract*)link_page; |
+ CPDF_LinkExtract* pageLink = static_cast<CPDF_LinkExtract*>(link_page); |
return pageLink->CountLinks(); |
} |
DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page, |
@@ -253,7 +258,7 @@ DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page, |
int buflen) { |
if (!link_page) |
return 0; |
- IPDF_LinkExtract* pageLink = (IPDF_LinkExtract*)link_page; |
+ CPDF_LinkExtract* pageLink = static_cast<CPDF_LinkExtract*>(link_page); |
CFX_WideString url = pageLink->GetURL(link_index); |
CFX_ByteString cbUTF16URL = url.UTF16LE_Encode(); |
@@ -272,7 +277,7 @@ DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page, |
int link_index) { |
if (!link_page) |
return 0; |
- IPDF_LinkExtract* pageLink = (IPDF_LinkExtract*)link_page; |
+ CPDF_LinkExtract* pageLink = static_cast<CPDF_LinkExtract*>(link_page); |
CFX_RectArray rectArray; |
pageLink->GetRects(link_index, rectArray); |
return rectArray.GetSize(); |
@@ -286,7 +291,7 @@ DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page, |
double* bottom) { |
if (!link_page) |
return; |
- IPDF_LinkExtract* pageLink = (IPDF_LinkExtract*)link_page; |
+ CPDF_LinkExtract* pageLink = static_cast<CPDF_LinkExtract*>(link_page); |
CFX_RectArray rectArray; |
pageLink->GetRects(link_index, rectArray); |
if (rect_index >= 0 && rect_index < rectArray.GetSize()) { |
@@ -298,5 +303,5 @@ DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page, |
} |
} |
DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page) { |
- delete (IPDF_LinkExtract*)link_page; |
+ delete static_cast<CPDF_LinkExtract*>(link_page); |
} |