diff options
Diffstat (limited to 'core/fpdftext/include')
-rw-r--r-- | core/fpdftext/include/cpdf_linkextract.h | 40 | ||||
-rw-r--r-- | core/fpdftext/include/cpdf_textpage.h | 6 |
2 files changed, 18 insertions, 28 deletions
diff --git a/core/fpdftext/include/cpdf_linkextract.h b/core/fpdftext/include/cpdf_linkextract.h index 263768ee5d..4f9537c799 100644 --- a/core/fpdftext/include/cpdf_linkextract.h +++ b/core/fpdftext/include/cpdf_linkextract.h @@ -7,6 +7,8 @@ #ifndef CORE_FPDFTEXT_INCLUDE_CPDF_LINKEXTRACT_H_ #define CORE_FPDFTEXT_INCLUDE_CPDF_LINKEXTRACT_H_ +#include <vector> + #include "core/fxcrt/include/fx_basic.h" #include "core/fxcrt/include/fx_coordinates.h" #include "core/fxcrt/include/fx_string.h" @@ -14,41 +16,31 @@ class CPDF_TextPage; -class CPDF_LinkExt { - public: - CPDF_LinkExt() {} - ~CPDF_LinkExt() {} - - int m_Start; - int m_Count; - CFX_WideString m_strUrl; -}; - class CPDF_LinkExtract { public: - CPDF_LinkExtract(); + explicit CPDF_LinkExtract(const CPDF_TextPage* pTextPage); ~CPDF_LinkExtract(); - FX_BOOL ExtractLinks(const CPDF_TextPage* pTextPage); - int CountLinks() const; - CFX_WideString GetURL(int index) const; - void GetBoundedSegment(int index, int& start, int& count) const; - void GetRects(int index, CFX_RectArray& rects) const; - - FX_BOOL IsExtract() const { return m_bIsParsed; } + void ExtractLinks(); + size_t CountLinks() const { return m_LinkArray.size(); } + CFX_WideString GetURL(size_t index) const; + void GetRects(size_t index, CFX_RectArray* pRects) const; protected: void ParseLink(); - void DeleteLinkList(); - FX_BOOL CheckWebLink(CFX_WideString& strBeCheck); + bool CheckWebLink(CFX_WideString& str); bool CheckMailLink(CFX_WideString& str); - void AppendToLinkList(int start, int count, const CFX_WideString& strUrl); private: - CFX_ArrayTemplate<CPDF_LinkExt*> m_LinkList; - const CPDF_TextPage* m_pTextPage; + struct Link { + int m_Start; + int m_Count; + CFX_WideString m_strUrl; + }; + + const CPDF_TextPage* const m_pTextPage; CFX_WideString m_strPageText; - bool m_bIsParsed; + std::vector<Link> m_LinkArray; }; #endif // CORE_FPDFTEXT_INCLUDE_CPDF_LINKEXTRACT_H_ diff --git a/core/fpdftext/include/cpdf_textpage.h b/core/fpdftext/include/cpdf_textpage.h index 19e8791b5a..8d608b0bf0 100644 --- a/core/fpdftext/include/cpdf_textpage.h +++ b/core/fpdftext/include/cpdf_textpage.h @@ -67,7 +67,7 @@ class CPDF_TextPage { 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; + void GetRectArray(int start, int nCount, CFX_RectArray* rectArray) const; int GetIndexAtPos(CFX_FloatPoint point, FX_FLOAT xTolerance, FX_FLOAT yTolerance) const; @@ -85,14 +85,12 @@ class CPDF_TextPage { FX_FLOAT& top, FX_FLOAT& right, 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); - void GetBoundedSegment(int index, int& start, int& count) const; + int GetWordBreak(int index, int direction) const; static FX_BOOL IsRectIntersect(const CFX_FloatRect& rect1, |