summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_page/include
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2016-03-21 09:15:45 -0400
committerDan Sinclair <dsinclair@chromium.org>2016-03-21 09:15:45 -0400
commit584b1e679f41a580e2b38d5534f126355c78043b (patch)
treeca3f78bc30673b9c4650433168efe574920c60f1 /core/fpdfapi/fpdf_page/include
parentedbb319d3143692befdbb0603089b7e265cf89aa (diff)
downloadpdfium-584b1e679f41a580e2b38d5534f126355c78043b.tar.xz
Move core/include/fpdfapi/fpdf_pageobj.h into core/fpdfapi.
This CL splits the file into individual classes and moves them into core/fpdfapi/fpdf_page as needed. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1811053002 .
Diffstat (limited to 'core/fpdfapi/fpdf_page/include')
-rw-r--r--core/fpdfapi/fpdf_page/include/cpdf_clippath.h34
-rw-r--r--core/fpdfapi/fpdf_page/include/cpdf_formobject.h34
-rw-r--r--core/fpdfapi/fpdf_page/include/cpdf_generalstate.h29
-rw-r--r--core/fpdfapi/fpdf_page/include/cpdf_generalstatedata.h49
-rw-r--r--core/fpdfapi/fpdf_page/include/cpdf_imageobject.h34
-rw-r--r--core/fpdfapi/fpdf_page/include/cpdf_page.h3
-rw-r--r--core/fpdfapi/fpdf_page/include/cpdf_pageobject.h71
-rw-r--r--core/fpdfapi/fpdf_page/include/cpdf_path.h50
-rw-r--r--core/fpdfapi/fpdf_page/include/cpdf_pathobject.h36
-rw-r--r--core/fpdfapi/fpdf_page/include/cpdf_shadingobject.h34
-rw-r--r--core/fpdfapi/fpdf_page/include/cpdf_textobject.h69
-rw-r--r--core/fpdfapi/fpdf_page/include/cpdf_textstatedata.h31
12 files changed, 474 insertions, 0 deletions
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_clippath.h b/core/fpdfapi/fpdf_page/include/cpdf_clippath.h
new file mode 100644
index 0000000000..4631e8266a
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/include/cpdf_clippath.h
@@ -0,0 +1,34 @@
+// 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_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_CLIPPATH_H_
+#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_CLIPPATH_H_
+
+#include "core/fpdfapi/fpdf_page/cpdf_clippathdata.h"
+#include "core/fpdfapi/fpdf_page/include/cpdf_path.h"
+#include "core/include/fxcrt/fx_basic.h"
+#include "core/include/fxcrt/fx_coordinates.h"
+#include "core/include/fxcrt/fx_system.h"
+
+class CPDF_TextObject;
+
+class CPDF_ClipPath : public CFX_CountRef<CPDF_ClipPathData> {
+ public:
+ FX_DWORD GetPathCount() const { return m_pObject->m_PathCount; }
+ CPDF_Path GetPath(int i) const { return m_pObject->m_pPathList[i]; }
+ int GetClipType(int i) const { return m_pObject->m_pTypeList[i]; }
+ FX_DWORD GetTextCount() const { return m_pObject->m_TextCount; }
+ CPDF_TextObject* GetText(int i) const { return m_pObject->m_pTextList[i]; }
+ CFX_FloatRect GetClipBox() const;
+
+ void AppendPath(CPDF_Path path, int type, FX_BOOL bAutoMerge);
+ void DeletePath(int layer_index);
+
+ void AppendTexts(CPDF_TextObject** pTexts, int count);
+ void Transform(const CFX_Matrix& matrix);
+};
+
+#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_CLIPPATH_H_
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_formobject.h b/core/fpdfapi/fpdf_page/include/cpdf_formobject.h
new file mode 100644
index 0000000000..47d40e0e8b
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/include/cpdf_formobject.h
@@ -0,0 +1,34 @@
+// 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_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_FORMOBJECT_H_
+#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_FORMOBJECT_H_
+
+#include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h"
+#include "core/include/fxcrt/fx_coordinates.h"
+
+class Form;
+
+class CPDF_FormObject : public CPDF_PageObject {
+ public:
+ CPDF_FormObject();
+ ~CPDF_FormObject() override;
+
+ // CPDF_PageObject:
+ CPDF_FormObject* Clone() const override;
+ Type GetType() const override { return FORM; };
+ void Transform(const CFX_Matrix& matrix) override;
+ bool IsForm() const override { return true; };
+ CPDF_FormObject* AsForm() override { return this; };
+ const CPDF_FormObject* AsForm() const override { return this; };
+
+ void CalcBoundingBox();
+
+ CPDF_Form* m_pForm;
+ CFX_Matrix m_FormMatrix;
+};
+
+#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_FORMOBJECT_H_
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_generalstate.h b/core/fpdfapi/fpdf_page/include/cpdf_generalstate.h
new file mode 100644
index 0000000000..3495b6c3ff
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/include/cpdf_generalstate.h
@@ -0,0 +1,29 @@
+// 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_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_GENERALSTATE_H_
+#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_GENERALSTATE_H_
+
+#include "core/fpdfapi/fpdf_page/include/cpdf_generalstatedata.h"
+#include "core/include/fxcrt/fx_basic.h"
+
+class CPDF_GeneralState : public CFX_CountRef<CPDF_GeneralStateData> {
+ public:
+ void SetRenderIntent(const CFX_ByteString& ri);
+
+ int GetBlendType() const {
+ return m_pObject ? m_pObject->m_BlendType : FXDIB_BLEND_NORMAL;
+ }
+
+ int GetAlpha(FX_BOOL bStroke) const {
+ if (!m_pObject)
+ return 255;
+ return FXSYS_round(
+ (bStroke ? m_pObject->m_StrokeAlpha : m_pObject->m_FillAlpha) * 255);
+ }
+};
+
+#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_GENERALSTATE_H_
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_generalstatedata.h b/core/fpdfapi/fpdf_page/include/cpdf_generalstatedata.h
new file mode 100644
index 0000000000..f2e5510ccc
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/include/cpdf_generalstatedata.h
@@ -0,0 +1,49 @@
+// 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_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_GENERALSTATEDATA_H_
+#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_GENERALSTATEDATA_H_
+
+#include "core/include/fxcrt/fx_coordinates.h"
+#include "core/include/fxcrt/fx_string.h"
+#include "core/include/fxcrt/fx_system.h"
+#include "core/include/fxge/fx_dib.h"
+
+class CPDF_TransferFunc;
+class CPDF_Object;
+
+class CPDF_GeneralStateData {
+ public:
+ CPDF_GeneralStateData();
+ CPDF_GeneralStateData(const CPDF_GeneralStateData& src);
+ ~CPDF_GeneralStateData();
+
+ void SetBlendMode(const CFX_ByteStringC& blend_mode);
+
+ char m_BlendMode[16];
+ int m_BlendType;
+ CPDF_Object* m_pSoftMask;
+ FX_FLOAT m_SMaskMatrix[6];
+ FX_FLOAT m_StrokeAlpha;
+ FX_FLOAT m_FillAlpha;
+ CPDF_Object* m_pTR;
+ CPDF_TransferFunc* m_pTransferFunc;
+ CFX_Matrix m_Matrix;
+ int m_RenderIntent;
+ FX_BOOL m_StrokeAdjust;
+ FX_BOOL m_AlphaSource;
+ FX_BOOL m_TextKnockout;
+ FX_BOOL m_StrokeOP;
+ FX_BOOL m_FillOP;
+ int m_OPMode;
+ CPDF_Object* m_pBG;
+ CPDF_Object* m_pUCR;
+ CPDF_Object* m_pHT;
+ FX_FLOAT m_Flatness;
+ FX_FLOAT m_Smoothness;
+};
+
+#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_GENERALSTATEDATA_H_
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_imageobject.h b/core/fpdfapi/fpdf_page/include/cpdf_imageobject.h
new file mode 100644
index 0000000000..dec60c9d9b
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/include/cpdf_imageobject.h
@@ -0,0 +1,34 @@
+// 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_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGEOBJECT_H_
+#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGEOBJECT_H_
+
+#include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h"
+#include "core/include/fxcrt/fx_coordinates.h"
+
+class CPDF_Image;
+
+class CPDF_ImageObject : public CPDF_PageObject {
+ public:
+ CPDF_ImageObject();
+ ~CPDF_ImageObject() override;
+
+ // CPDF_PageObject:
+ CPDF_ImageObject* Clone() const override;
+ Type GetType() const override { return IMAGE; };
+ void Transform(const CFX_Matrix& matrix) override;
+ bool IsImage() const override { return true; };
+ CPDF_ImageObject* AsImage() override { return this; };
+ const CPDF_ImageObject* AsImage() const override { return this; };
+
+ void CalcBoundingBox();
+
+ CPDF_Image* m_pImage;
+ CFX_Matrix m_Matrix;
+};
+
+#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_IMAGEOBJECT_H_
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_page.h b/core/fpdfapi/fpdf_page/include/cpdf_page.h
index 82c88d1c37..5e27ba2ec7 100644
--- a/core/fpdfapi/fpdf_page/include/cpdf_page.h
+++ b/core/fpdfapi/fpdf_page/include/cpdf_page.h
@@ -18,6 +18,9 @@ class CPDF_Object;
class CPDF_PageRenderCache;
class CPDF_ParseOptions;
+CPDF_Object* FPDFAPI_GetPageAttr(CPDF_Dictionary* pPageDict,
+ const CFX_ByteStringC& name);
+
class CPDF_Page : public CPDF_PageObjectHolder, public CFX_PrivateData {
public:
CPDF_Page();
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_pageobject.h b/core/fpdfapi/fpdf_page/include/cpdf_pageobject.h
new file mode 100644
index 0000000000..2f55547b47
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/include/cpdf_pageobject.h
@@ -0,0 +1,71 @@
+// 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_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PAGEOBJECT_H_
+#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PAGEOBJECT_H_
+
+#include "core/fpdfapi/fpdf_page/cpdf_contentmark.h"
+#include "core/fpdfapi/fpdf_page/cpdf_graphicstates.h"
+#include "core/include/fxcrt/fx_coordinates.h"
+#include "core/include/fxcrt/fx_system.h"
+
+class CPDF_TextObject;
+class CPDF_PathObject;
+class CPDF_ImageObject;
+class CPDF_ShadingObject;
+class CPDF_FormObject;
+
+class CPDF_PageObject : public CPDF_GraphicStates {
+ public:
+ enum Type {
+ TEXT = 1,
+ PATH,
+ IMAGE,
+ SHADING,
+ FORM,
+ };
+
+ CPDF_PageObject();
+ virtual ~CPDF_PageObject();
+
+ virtual CPDF_PageObject* Clone() const = 0;
+ virtual Type GetType() const = 0;
+ virtual void Transform(const CFX_Matrix& matrix) = 0;
+ virtual bool IsText() const { return false; }
+ virtual bool IsPath() const { return false; }
+ virtual bool IsImage() const { return false; }
+ virtual bool IsShading() const { return false; }
+ virtual bool IsForm() const { return false; }
+ virtual CPDF_TextObject* AsText() { return nullptr; }
+ virtual const CPDF_TextObject* AsText() const { return nullptr; }
+ virtual CPDF_PathObject* AsPath() { return nullptr; }
+ virtual const CPDF_PathObject* AsPath() const { return nullptr; }
+ virtual CPDF_ImageObject* AsImage() { return nullptr; }
+ virtual const CPDF_ImageObject* AsImage() const { return nullptr; }
+ virtual CPDF_ShadingObject* AsShading() { return nullptr; }
+ virtual const CPDF_ShadingObject* AsShading() const { return nullptr; }
+ virtual CPDF_FormObject* AsForm() { return nullptr; }
+ virtual const CPDF_FormObject* AsForm() const { return nullptr; }
+
+ void TransformClipPath(CFX_Matrix& matrix);
+ void TransformGeneralState(CFX_Matrix& matrix);
+ FX_RECT GetBBox(const CFX_Matrix* pMatrix) const;
+
+ FX_FLOAT m_Left;
+ FX_FLOAT m_Right;
+ FX_FLOAT m_Top;
+ FX_FLOAT m_Bottom;
+ CPDF_ContentMark m_ContentMark;
+
+ protected:
+ void CopyData(const CPDF_PageObject* pSrcObject);
+
+ private:
+ CPDF_PageObject(const CPDF_PageObject& src) = delete;
+ void operator=(const CPDF_PageObject& src) = delete;
+};
+
+#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PAGEOBJECT_H_
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_path.h b/core/fpdfapi/fpdf_page/include/cpdf_path.h
new file mode 100644
index 0000000000..a90115486a
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/include/cpdf_path.h
@@ -0,0 +1,50 @@
+// 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_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PATH_H_
+#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PATH_H_
+
+#include "core/include/fxcrt/fx_system.h"
+#include "core/include/fxge/fx_ge.h"
+
+class CPDF_Path : public CFX_CountRef<CFX_PathData> {
+ public:
+ int GetPointCount() const { return m_pObject->m_PointCount; }
+ int GetFlag(int index) const { return m_pObject->m_pPoints[index].m_Flag; }
+
+ FX_FLOAT GetPointX(int index) const {
+ return m_pObject->m_pPoints[index].m_PointX;
+ }
+
+ FX_FLOAT GetPointY(int index) const {
+ return m_pObject->m_pPoints[index].m_PointY;
+ }
+
+ FX_PATHPOINT* GetPoints() const { return m_pObject->m_pPoints; }
+ CFX_FloatRect GetBoundingBox() const { return m_pObject->GetBoundingBox(); }
+
+ CFX_FloatRect GetBoundingBox(FX_FLOAT line_width,
+ FX_FLOAT miter_limit) const {
+ return m_pObject->GetBoundingBox(line_width, miter_limit);
+ }
+
+ FX_BOOL IsRect() const { return m_pObject->IsRect(); }
+
+ void Transform(const CFX_Matrix* pMatrix) { GetModify()->Transform(pMatrix); }
+
+ void Append(CPDF_Path src, const CFX_Matrix* pMatrix) {
+ m_pObject->Append(src.m_pObject, pMatrix);
+ }
+
+ void AppendRect(FX_FLOAT left,
+ FX_FLOAT bottom,
+ FX_FLOAT right,
+ FX_FLOAT top) {
+ m_pObject->AppendRect(left, bottom, right, top);
+ }
+};
+
+#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PATH_H_
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_pathobject.h b/core/fpdfapi/fpdf_page/include/cpdf_pathobject.h
new file mode 100644
index 0000000000..30df0c2937
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/include/cpdf_pathobject.h
@@ -0,0 +1,36 @@
+// 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_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PATHOBJECT_H_
+#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PATHOBJECT_H_
+
+#include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h"
+#include "core/fpdfapi/fpdf_page/include/cpdf_path.h"
+#include "core/include/fxcrt/fx_coordinates.h"
+#include "core/include/fxcrt/fx_system.h"
+
+class CPDF_PathObject : public CPDF_PageObject {
+ public:
+ CPDF_PathObject();
+ ~CPDF_PathObject() override;
+
+ // CPDF_PageObject:
+ CPDF_PathObject* Clone() const override;
+ Type GetType() const override { return PATH; };
+ void Transform(const CFX_Matrix& maxtrix) override;
+ bool IsPath() const override { return true; };
+ CPDF_PathObject* AsPath() override { return this; };
+ const CPDF_PathObject* AsPath() const override { return this; };
+
+ void CalcBoundingBox();
+
+ CPDF_Path m_Path;
+ int m_FillType;
+ FX_BOOL m_bStroke;
+ CFX_Matrix m_Matrix;
+};
+
+#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PATHOBJECT_H_
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_shadingobject.h b/core/fpdfapi/fpdf_page/include/cpdf_shadingobject.h
new file mode 100644
index 0000000000..f43a1e3a4f
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/include/cpdf_shadingobject.h
@@ -0,0 +1,34 @@
+// 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_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_SHADINGOBJECT_H_
+#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_SHADINGOBJECT_H_
+
+#include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h"
+#include "core/include/fxcrt/fx_coordinates.h"
+
+class CPDF_ShadingPattern;
+
+class CPDF_ShadingObject : public CPDF_PageObject {
+ public:
+ CPDF_ShadingObject();
+ ~CPDF_ShadingObject() override;
+
+ // CPDF_PageObject:
+ CPDF_ShadingObject* Clone() const override;
+ Type GetType() const override { return SHADING; };
+ void Transform(const CFX_Matrix& matrix) override;
+ bool IsShading() const override { return true; };
+ CPDF_ShadingObject* AsShading() override { return this; };
+ const CPDF_ShadingObject* AsShading() const override { return this; };
+
+ void CalcBoundingBox();
+
+ CPDF_ShadingPattern* m_pShading;
+ CFX_Matrix m_Matrix;
+};
+
+#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_SHADINGOBJECT_H_
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_textobject.h b/core/fpdfapi/fpdf_page/include/cpdf_textobject.h
new file mode 100644
index 0000000000..9aaa2f0160
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/include/cpdf_textobject.h
@@ -0,0 +1,69 @@
+// 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_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_TEXTOBJECT_H_
+#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_TEXTOBJECT_H_
+
+#include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h"
+#include "core/include/fxcrt/fx_string.h"
+#include "core/include/fxcrt/fx_system.h"
+
+struct CPDF_TextObjectItem {
+ FX_DWORD m_CharCode;
+ FX_FLOAT m_OriginX;
+ FX_FLOAT m_OriginY;
+};
+
+class CPDF_TextObject : public CPDF_PageObject {
+ public:
+ CPDF_TextObject();
+ ~CPDF_TextObject() override;
+
+ // CPDF_PageObject:
+ CPDF_TextObject* Clone() const override;
+ Type GetType() const override { return TEXT; };
+ void Transform(const CFX_Matrix& matrix) override;
+ bool IsText() const override { return true; };
+ CPDF_TextObject* AsText() override { return this; };
+ const CPDF_TextObject* AsText() const override { return this; };
+
+ int CountItems() const { return m_nChars; }
+ void GetItemInfo(int index, CPDF_TextObjectItem* pInfo) const;
+ int CountChars() const;
+ void GetCharInfo(int index, FX_DWORD& charcode, FX_FLOAT& kerning) const;
+ void GetCharInfo(int index, CPDF_TextObjectItem* pInfo) const;
+ FX_FLOAT GetCharWidth(FX_DWORD charcode) const;
+ FX_FLOAT GetPosX() const { return m_PosX; }
+ FX_FLOAT GetPosY() const { return m_PosY; }
+ void GetTextMatrix(CFX_Matrix* pMatrix) const;
+ CPDF_Font* GetFont() const { return m_TextState.GetFont(); }
+ FX_FLOAT GetFontSize() const { return m_TextState.GetFontSize(); }
+
+ void SetText(const CFX_ByteString& text);
+ void SetPosition(FX_FLOAT x, FX_FLOAT y);
+
+ void RecalcPositionData() { CalcPositionData(nullptr, nullptr, 1); }
+
+ protected:
+ friend class CPDF_RenderStatus;
+ friend class CPDF_StreamContentParser;
+ friend class CPDF_TextRenderer;
+
+ void SetSegments(const CFX_ByteString* pStrs, FX_FLOAT* pKerning, int nSegs);
+
+ void CalcPositionData(FX_FLOAT* pTextAdvanceX,
+ FX_FLOAT* pTextAdvanceY,
+ FX_FLOAT horz_scale,
+ int level = 0);
+
+ FX_FLOAT m_PosX;
+ FX_FLOAT m_PosY;
+ int m_nChars;
+ FX_DWORD* m_pCharCodes;
+ FX_FLOAT* m_pCharPos;
+};
+
+#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_TEXTOBJECT_H_
diff --git a/core/fpdfapi/fpdf_page/include/cpdf_textstatedata.h b/core/fpdfapi/fpdf_page/include/cpdf_textstatedata.h
new file mode 100644
index 0000000000..1fcc1fe8c2
--- /dev/null
+++ b/core/fpdfapi/fpdf_page/include/cpdf_textstatedata.h
@@ -0,0 +1,31 @@
+// 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_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_TEXTSTATEDATA_H_
+#define CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_TEXTSTATEDATA_H_
+
+#include "core/include/fxcrt/fx_system.h"
+
+class CPDF_Font;
+class CPDF_Document;
+
+class CPDF_TextStateData {
+ public:
+ CPDF_TextStateData();
+ CPDF_TextStateData(const CPDF_TextStateData& src);
+ ~CPDF_TextStateData();
+
+ CPDF_Font* m_pFont;
+ CPDF_Document* m_pDocument;
+ FX_FLOAT m_FontSize;
+ FX_FLOAT m_CharSpace;
+ FX_FLOAT m_WordSpace;
+ FX_FLOAT m_Matrix[4];
+ int m_TextMode;
+ FX_FLOAT m_CTM[4];
+};
+
+#endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_TEXTSTATEDATA_H_