summaryrefslogtreecommitdiff
path: root/core/fpdftext/cpdf_textpage.h
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-08-07 21:45:34 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-07 21:45:34 +0000
commit3bee9c60f013b8b7e99c39ee35699d132b330334 (patch)
treefc00b16bf5c6b84af3c4683e43a2652b80db173b /core/fpdftext/cpdf_textpage.h
parente1c2f6d7fe7a50280161832799550a3ee8f98088 (diff)
downloadpdfium-3bee9c60f013b8b7e99c39ee35699d132b330334.tar.xz
Add FPDFTextObj_GetText() API
Generalize CPDF_TextPage::GetTextByRect(), so that it's possible to get the text from a text page using a predicate, that way we can easily get the text that belongs to single text object as well. Change-Id: Ia457af0f41184694dc1481709be72b35685bce7f Reviewed-on: https://pdfium-review.googlesource.com/39530 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdftext/cpdf_textpage.h')
-rw-r--r--core/fpdftext/cpdf_textpage.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/fpdftext/cpdf_textpage.h b/core/fpdftext/cpdf_textpage.h
index 36d01854f5..90b45bd96b 100644
--- a/core/fpdftext/cpdf_textpage.h
+++ b/core/fpdftext/cpdf_textpage.h
@@ -8,6 +8,7 @@
#define CORE_FPDFTEXT_CPDF_TEXTPAGE_H_
#include <deque>
+#include <functional>
#include <vector>
#include "core/fpdfapi/page/cpdf_pageobjectlist.h"
@@ -97,6 +98,7 @@ class CPDF_TextPage {
std::vector<CFX_FloatRect> GetRectArray(int start, int nCount) const;
int GetIndexAtPos(const CFX_PointF& point, const CFX_SizeF& tolerance) const;
WideString GetTextByRect(const CFX_FloatRect& rect) const;
+ WideString GetTextByObject(const CPDF_TextObject* pTextObj) const;
// Returns string with the text from |m_TextBuf| that are covered by the input
// range. |start| and |count| are in terms of the |m_CharIndex|, so the range
@@ -151,6 +153,8 @@ class CPDF_TextPage {
TextOrientation FindTextlineFlowOrientation() const;
void AppendGeneratedCharacter(wchar_t unicode, const CFX_Matrix& formMatrix);
void SwapTempTextBuf(int32_t iCharListStartAppend, int32_t iBufStartAppend);
+ WideString GetTextByPredicate(
+ const std::function<bool(const PAGECHAR_INFO&)>& predicate) const;
UnownedPtr<const CPDF_Page> const m_pPage;
std::vector<uint16_t> m_CharIndex;