Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2381)

Unified Diff: core/fpdftext/include/cpdf_textpage.h

Issue 1897993002: Remove IPDF_TextPage, IPDF_TextPageFind and IPDF_LinkExtract interfaces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdftext/include/cpdf_linkextract.h ('k') | core/fpdftext/include/cpdf_textpagefind.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdftext/include/cpdf_textpage.h
diff --git a/core/fpdftext/fpdf_text_int.h b/core/fpdftext/include/cpdf_textpage.h
similarity index 48%
rename from core/fpdftext/fpdf_text_int.h
rename to core/fpdftext/include/cpdf_textpage.h
index 7acab55ccb855767a85c040e64ff8603d35ebf13..19e8791b5a42f938eac3785fbcbd5f098a4e19cc 100644
--- a/core/fpdftext/fpdf_text_int.h
+++ b/core/fpdftext/include/cpdf_textpage.h
@@ -1,49 +1,36 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
+// Copyright 2016 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#ifndef CORE_FPDFTEXT_FPDF_TEXT_INT_H_
-#define CORE_FPDFTEXT_FPDF_TEXT_INT_H_
+#ifndef CORE_FPDFTEXT_INCLUDE_CPDF_TEXTPAGE_H_
+#define CORE_FPDFTEXT_INCLUDE_CPDF_TEXTPAGE_H_
#include <deque>
#include <vector>
#include "core/fpdfapi/fpdf_page/cpdf_pageobjectlist.h"
-#include "core/fpdfapi/fpdf_page/include/cpdf_form.h"
-#include "core/fpdfapi/fpdf_page/include/cpdf_page.h"
-#include "core/fpdftext/include/ipdf_linkextract.h"
-#include "core/fpdftext/include/ipdf_textpage.h"
-#include "core/fpdftext/include/ipdf_textpagefind.h"
#include "core/fxcrt/include/fx_basic.h"
+#include "core/fxcrt/include/fx_coordinates.h"
+#include "core/fxcrt/include/fx_string.h"
class CFX_BidiChar;
-class CPDF_FormObject;
-class CPDF_LinkExtract;
-class CPDF_TextPageFind;
class CPDF_Font;
+class CPDF_FormObject;
+class CPDF_Page;
+class CPDF_TextObject;
-#define FPDFTEXT_CHAR_ERROR -1
-#define FPDFTEXT_CHAR_NORMAL 0
-#define FPDFTEXT_CHAR_GENERATED 1
-#define FPDFTEXT_CHAR_UNUNICODE 2
-#define FPDFTEXT_CHAR_HYPHEN 3
-#define FPDFTEXT_CHAR_PIECE 4
-#define FPDFTEXT_MC_PASS 0
-#define FPDFTEXT_MC_DONE 1
-#define FPDFTEXT_MC_DELAY 2
-
-struct PAGECHAR_INFO {
- int m_CharCode;
+struct FPDF_CHAR_INFO {
FX_WCHAR m_Unicode;
+ FX_WCHAR m_Charcode;
+ int32_t m_Flag;
+ FX_FLOAT m_FontSize;
FX_FLOAT m_OriginX;
FX_FLOAT m_OriginY;
- int32_t m_Flag;
CFX_FloatRect m_CharBox;
CPDF_TextObject* m_pTextObj;
CFX_Matrix m_Matrix;
- int m_Index;
};
struct FPDF_SEGMENT {
@@ -51,52 +38,62 @@ struct FPDF_SEGMENT {
int m_nCount;
};
+struct PAGECHAR_INFO {
+ int m_CharCode;
+ FX_WCHAR m_Unicode;
+ FX_FLOAT m_OriginX;
+ FX_FLOAT m_OriginY;
+ int32_t m_Flag;
+ CFX_FloatRect m_CharBox;
+ CPDF_TextObject* m_pTextObj;
+ CFX_Matrix m_Matrix;
+ int m_Index;
+};
+
struct PDFTEXT_Obj {
CPDF_TextObject* m_pTextObj;
CFX_Matrix m_formMatrix;
};
-class CPDF_TextPage : public IPDF_TextPage {
+class CPDF_TextPage {
public:
CPDF_TextPage(const CPDF_Page* pPage, int flags);
- ~CPDF_TextPage() override {}
+ ~CPDF_TextPage() {}
// IPDF_TextPage:
- void ParseTextPage() override;
- bool IsParsed() const override { return m_bIsParsed; }
- int CharIndexFromTextIndex(int TextIndex) const override;
- int TextIndexFromCharIndex(int CharIndex) const override;
- int CountChars() const override;
- void GetCharInfo(int index, FPDF_CHAR_INFO* info) const override;
- void GetRectArray(int start,
- int nCount,
- CFX_RectArray& rectArray) const override;
+ void ParseTextPage();
+ bool IsParsed() const { return m_bIsParsed; }
+ int CharIndexFromTextIndex(int TextIndex) const;
+ int TextIndexFromCharIndex(int CharIndex) const;
+ int CountChars() const;
+ void GetCharInfo(int index, FPDF_CHAR_INFO* info) const;
+ void GetRectArray(int start, int nCount, CFX_RectArray& rectArray) const;
int GetIndexAtPos(CFX_FloatPoint point,
FX_FLOAT xTolerance,
- FX_FLOAT yTolerance) const override;
+ FX_FLOAT yTolerance) const;
int GetIndexAtPos(FX_FLOAT x,
FX_FLOAT y,
FX_FLOAT xTolerance,
- FX_FLOAT yTolerance) const override;
- CFX_WideString GetTextByRect(const CFX_FloatRect& rect) const override;
+ FX_FLOAT yTolerance) const;
+ CFX_WideString GetTextByRect(const CFX_FloatRect& rect) const;
void GetRectsArrayByRect(const CFX_FloatRect& rect,
- CFX_RectArray& resRectArray) const override;
- CFX_WideString GetPageText(int start = 0, int nCount = -1) const override;
- int CountRects(int start, int nCount) override;
+ CFX_RectArray& resRectArray) const;
+ CFX_WideString GetPageText(int start = 0, int nCount = -1) const;
+ int CountRects(int start, int nCount);
void GetRect(int rectIndex,
FX_FLOAT& left,
FX_FLOAT& top,
FX_FLOAT& right,
- FX_FLOAT& bottom) const override;
- FX_BOOL GetBaselineRotate(int rectIndex, int& Rotate) override;
- FX_BOOL GetBaselineRotate(const CFX_FloatRect& rect, int& Rotate) override;
+ FX_FLOAT& bottom) const;
+ FX_BOOL GetBaselineRotate(int rectIndex, int& Rotate);
+ FX_BOOL GetBaselineRotate(const CFX_FloatRect& rect, int& Rotate);
int CountBoundedSegments(FX_FLOAT left,
FX_FLOAT top,
FX_FLOAT right,
FX_FLOAT bottom,
- FX_BOOL bContains = FALSE) override;
- void GetBoundedSegment(int index, int& start, int& count) const override;
- int GetWordBreak(int index, int direction) const override;
+ FX_BOOL bContains = FALSE);
+ void GetBoundedSegment(int index, int& start, int& count) const;
+ int GetWordBreak(int index, int direction) const;
static FX_BOOL IsRectIntersect(const CFX_FloatRect& rect1,
const CFX_FloatRect& rect2);
@@ -157,91 +154,4 @@ class CPDF_TextPage : public IPDF_TextPage {
CFX_FloatRect m_CurlineRect;
};
-class CPDF_TextPageFind : public IPDF_TextPageFind {
- public:
- explicit CPDF_TextPageFind(const IPDF_TextPage* pTextPage);
- ~CPDF_TextPageFind() override {}
-
- // IPDF_TextPageFind
- FX_BOOL FindFirst(const CFX_WideString& findwhat,
- int flags,
- int startPos = 0) override;
- FX_BOOL FindNext() override;
- FX_BOOL FindPrev() override;
- void GetRectArray(CFX_RectArray& rects) const override;
- int GetCurOrder() const override;
- int GetMatchedCount() const override;
-
- protected:
- void ExtractFindWhat(const CFX_WideString& findwhat);
- FX_BOOL IsMatchWholeWord(const CFX_WideString& csPageText,
- int startPos,
- int endPos);
- FX_BOOL ExtractSubString(CFX_WideString& rString,
- const FX_WCHAR* lpszFullString,
- int iSubString,
- FX_WCHAR chSep);
- CFX_WideString MakeReverse(const CFX_WideString& str);
- int ReverseFind(const CFX_WideString& csPageText,
- const CFX_WideString& csWord,
- int nStartPos,
- int& WordLength);
- int GetCharIndex(int index) const;
-
- private:
- std::vector<uint16_t> m_CharIndex;
- const IPDF_TextPage* m_pTextPage;
- CFX_WideString m_strText;
- CFX_WideString m_findWhat;
- int m_flags;
- std::vector<CFX_WideString> m_csFindWhatArray;
- int m_findNextStart;
- int m_findPreStart;
- FX_BOOL m_bMatchCase;
- FX_BOOL m_bMatchWholeWord;
- int m_resStart;
- int m_resEnd;
- CFX_RectArray m_resArray;
- FX_BOOL m_IsFind;
-};
-
-class CPDF_LinkExt {
- public:
- CPDF_LinkExt() {}
- int m_Start;
- int m_Count;
- CFX_WideString m_strUrl;
- virtual ~CPDF_LinkExt() {}
-};
-
-typedef CFX_ArrayTemplate<CPDF_LinkExt*> LINK_InfoArray;
-
-class CPDF_LinkExtract : public IPDF_LinkExtract {
- public:
- CPDF_LinkExtract();
- ~CPDF_LinkExtract() override;
-
- // IPDF_LinkExtract
- FX_BOOL ExtractLinks(const IPDF_TextPage* pTextPage) override;
- int CountLinks() const override;
- CFX_WideString GetURL(int index) const override;
- void GetBoundedSegment(int index, int& start, int& count) const override;
- void GetRects(int index, CFX_RectArray& rects) const override;
-
- FX_BOOL IsExtract() const { return m_bIsParsed; }
-
- protected:
- void ParseLink();
- void DeleteLinkList();
- FX_BOOL CheckWebLink(CFX_WideString& strBeCheck);
- bool CheckMailLink(CFX_WideString& str);
- void AppendToLinkList(int start, int count, const CFX_WideString& strUrl);
-
- private:
- LINK_InfoArray m_LinkList;
- const CPDF_TextPage* m_pTextPage;
- CFX_WideString m_strPageText;
- bool m_bIsParsed;
-};
-
-#endif // CORE_FPDFTEXT_FPDF_TEXT_INT_H_
+#endif // CORE_FPDFTEXT_INCLUDE_CPDF_TEXTPAGE_H_
« no previous file with comments | « core/fpdftext/include/cpdf_linkextract.h ('k') | core/fpdftext/include/cpdf_textpagefind.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698