Revert "Add type cast definitions for CPDF_Reference."
[pdfium.git] / fpdfsdk / src / fpdftext.cpp
index 0761ffa..800c138 100644 (file)
@@ -7,21 +7,19 @@
 #include "../../core/include/fpdfdoc/fpdf_doc.h"
 #include "../../core/include/fpdftext/fpdf_text.h"
 #include "../../public/fpdf_text.h"
+#include "../include/fsdk_define.h"
 
 #ifdef _WIN32
 #include <tchar.h>
 #endif
 
-// jabdelmalek: commented out to build on Linux.  Not used.
-// extern HANDLE g_hModule;
-
 DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page) {
-  if (!page)
-    return NULL;
-  IPDF_TextPage* textpage = NULL;
-  CPDF_ViewerPreferences viewRef(((CPDF_Page*)page)->m_pDocument);
-  textpage =
-      IPDF_TextPage::CreateTextPage((CPDF_Page*)page, viewRef.IsDirectionR2L());
+  CPDF_Page* pPage = CPDFPageFromFPDFPage(page);
+  if (!pPage)
+    return nullptr;
+  CPDF_ViewerPreferences viewRef(pPage->m_pDocument);
+  IPDF_TextPage* textpage =
+      IPDF_TextPage::CreateTextPage(pPage, viewRef.IsDirectionR2L());
   textpage->ParseTextPage();
   return textpage;
 }
@@ -85,13 +83,13 @@ DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page,
 DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page,
                                                  double x,
                                                  double y,
-                                                 double xTorelance,
-                                                 double yTorelance) {
+                                                 double xTolerance,
+                                                 double yTolerance) {
   if (!text_page)
     return -3;
   IPDF_TextPage* textpage = (IPDF_TextPage*)text_page;
-  return textpage->GetIndexAtPos((FX_FLOAT)x, (FX_FLOAT)y, (FX_FLOAT)xTorelance,
-                                 (FX_FLOAT)yTorelance);
+  return textpage->GetIndexAtPos((FX_FLOAT)x, (FX_FLOAT)y, (FX_FLOAT)xTolerance,
+                                 (FX_FLOAT)yTolerance);
 }
 
 DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page,