summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-04-04 15:24:20 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-04 15:24:20 -0700
commited9c4386713084f37548b46ab36f618021f716f5 (patch)
treec5d3bca40a87d9beb9fea03c680f13cc8eb2400c
parentc220e59f36a1a5664fc795c801968083adda1722 (diff)
downloadpdfium-ed9c4386713084f37548b46ab36f618021f716f5.tar.xz
Make IPDF_VariableText_{Provider,Iterator} inner classes.
This CL moves the IPDF_VariableText_Provider and IPDF_VariableText_Iterator classes to be nested sub-classes of IPDF_VariableText. BUG=pdfium:455 Review URL: https://codereview.chromium.org/1855403002
-rw-r--r--BUILD.gn2
-rw-r--r--core/fpdfdoc/cpvt_generateap.cpp2
-rw-r--r--core/fpdfdoc/cpvt_generateap.h5
-rw-r--r--core/fpdfdoc/cpvt_provider.h6
-rw-r--r--core/fpdfdoc/doc_vt.cpp10
-rw-r--r--core/fpdfdoc/include/ipdf_variabletext_provider.h28
-rw-r--r--core/fpdfdoc/ipdf_variabletext_provider.cpp9
-rw-r--r--core/fpdfdoc/pdf_vt.h14
-rw-r--r--core/include/fpdfdoc/fpdf_vt.h186
-rw-r--r--fpdfsdk/fxedit/fxet_edit.cpp40
-rw-r--r--fpdfsdk/include/fxedit/fx_edit.h6
-rw-r--r--fpdfsdk/include/fxedit/fxet_edit.h11
-rw-r--r--pdfium.gyp2
13 files changed, 99 insertions, 222 deletions
diff --git a/BUILD.gn b/BUILD.gn
index f056e3b1dc..6e11f18ca6 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -217,8 +217,6 @@ static_library("fpdfdoc") {
"core/fpdfdoc/doc_viewerPreferences.cpp",
"core/fpdfdoc/doc_vt.cpp",
"core/fpdfdoc/doc_vtmodule.cpp",
- "core/fpdfdoc/include/ipdf_variabletext_provider.h",
- "core/fpdfdoc/ipdf_variabletext_provider.cpp",
"core/fpdfdoc/ipvt_fontmap.h",
"core/fpdfdoc/pdf_vt.h",
"core/fpdfdoc/tagged_int.h",
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp
index f9d6e9630b..dd935de61e 100644
--- a/core/fpdfdoc/cpvt_generateap.cpp
+++ b/core/fpdfdoc/cpvt_generateap.cpp
@@ -499,7 +499,7 @@ FX_BOOL CPVT_GenerateAP::GenerateListBoxAP(CPDF_Document* pDoc,
// Static.
CFX_ByteString CPVT_GenerateAP::GenerateEditAP(
IPVT_FontMap* pFontMap,
- IPDF_VariableText_Iterator* pIterator,
+ IPDF_VariableText::Iterator* pIterator,
const CFX_FloatPoint& ptOffset,
FX_BOOL bContinuous,
uint16_t SubWord,
diff --git a/core/fpdfdoc/cpvt_generateap.h b/core/fpdfdoc/cpvt_generateap.h
index b97b38ad6b..79062cbfc3 100644
--- a/core/fpdfdoc/cpvt_generateap.h
+++ b/core/fpdfdoc/cpvt_generateap.h
@@ -12,6 +12,7 @@
#include "core/fxcrt/include/fx_coordinates.h"
#include "core/fxcrt/include/fx_string.h"
#include "core/fxcrt/include/fx_system.h"
+#include "core/include/fpdfdoc/fpdf_vt.h"
// border style
#define PBS_SOLID 0
@@ -23,8 +24,8 @@
class CPDF_Dictionary;
class CPDF_Document;
-class IPDF_VariableText_Iterator;
class IPVT_FontMap;
+
struct CPVT_WordRange;
FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict);
@@ -38,7 +39,7 @@ class CPVT_GenerateAP {
static FX_BOOL GenerateListBoxAP(CPDF_Document* pDoc,
CPDF_Dictionary* pAnnotDict);
static CFX_ByteString GenerateEditAP(IPVT_FontMap* pFontMap,
- IPDF_VariableText_Iterator* pIterator,
+ IPDF_VariableText::Iterator* pIterator,
const CFX_FloatPoint& ptOffset,
FX_BOOL bContinuous,
uint16_t SubWord = 0,
diff --git a/core/fpdfdoc/cpvt_provider.h b/core/fpdfdoc/cpvt_provider.h
index e7edd538e5..fb6ff94861 100644
--- a/core/fpdfdoc/cpvt_provider.h
+++ b/core/fpdfdoc/cpvt_provider.h
@@ -7,16 +7,16 @@
#ifndef CORE_FPDFDOC_CPVT_PROVIDER_H_
#define CORE_FPDFDOC_CPVT_PROVIDER_H_
-#include "core/fpdfdoc/include/ipdf_variabletext_provider.h"
#include "core/fpdfdoc/ipvt_fontmap.h"
#include "core/fxcrt/include/fx_system.h"
+#include "core/include/fpdfdoc/fpdf_vt.h"
-class CPVT_Provider : public IPDF_VariableText_Provider {
+class CPVT_Provider : public IPDF_VariableText::Provider {
public:
CPVT_Provider(IPVT_FontMap* pFontMap);
~CPVT_Provider() override;
- // IPDF_VariableText_Provider
+ // IPDF_VariableText::Provider
int32_t GetCharWidth(int32_t nFontIndex,
uint16_t word,
int32_t nWordStyle) override;
diff --git a/core/fpdfdoc/doc_vt.cpp b/core/fpdfdoc/doc_vt.cpp
index 5977288d54..e91b945986 100644
--- a/core/fpdfdoc/doc_vt.cpp
+++ b/core/fpdfdoc/doc_vt.cpp
@@ -6,10 +6,10 @@
#include <algorithm>
-#include "core/fpdfdoc/include/ipdf_variabletext_provider.h"
#include "core/fpdfdoc/pdf_vt.h"
#include "core/include/fpdfdoc/fpdf_doc.h"
#include "core/include/fpdfdoc/fpdf_vt.h"
+#include "core/include/fpdfdoc/fpdf_vt.h"
const uint8_t gFontSizeSteps[] = {4, 6, 8, 9, 10, 12, 14, 18, 20,
25, 30, 35, 40, 45, 50, 55, 60, 70,
@@ -1643,15 +1643,15 @@ int32_t CPDF_VariableText::GetDefaultFontIndex() {
FX_BOOL CPDF_VariableText::IsLatinWord(uint16_t word) {
return m_pVTProvider ? m_pVTProvider->IsLatinWord(word) : FALSE;
}
-IPDF_VariableText_Iterator* CPDF_VariableText::GetIterator() {
+IPDF_VariableText::Iterator* CPDF_VariableText::GetIterator() {
if (!m_pVTIterator) {
m_pVTIterator = new CPDF_VariableText_Iterator(this);
}
return m_pVTIterator;
}
-IPDF_VariableText_Provider* CPDF_VariableText::SetProvider(
- IPDF_VariableText_Provider* pProvider) {
- IPDF_VariableText_Provider* pOld = m_pVTProvider;
+IPDF_VariableText::Provider* CPDF_VariableText::SetProvider(
+ IPDF_VariableText::Provider* pProvider) {
+ IPDF_VariableText::Provider* pOld = m_pVTProvider;
m_pVTProvider = pProvider;
return pOld;
}
diff --git a/core/fpdfdoc/include/ipdf_variabletext_provider.h b/core/fpdfdoc/include/ipdf_variabletext_provider.h
deleted file mode 100644
index 592c7da9d2..0000000000
--- a/core/fpdfdoc/include/ipdf_variabletext_provider.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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_FPDFDOC_INCLUDE_IPDF_VARIABLETEXT_PROVIDER_H_
-#define CORE_FPDFDOC_INCLUDE_IPDF_VARIABLETEXT_PROVIDER_H_
-
-#include "core/fxcrt/include/fx_system.h"
-
-class IPDF_VariableText_Provider {
- public:
- virtual ~IPDF_VariableText_Provider();
-
- virtual int32_t GetCharWidth(int32_t nFontIndex,
- uint16_t word,
- int32_t nWordStyle) = 0;
- virtual int32_t GetTypeAscent(int32_t nFontIndex) = 0;
- virtual int32_t GetTypeDescent(int32_t nFontIndex) = 0;
- virtual int32_t GetWordFontIndex(uint16_t word,
- int32_t charset,
- int32_t nFontIndex) = 0;
- virtual int32_t GetDefaultFontIndex() = 0;
- virtual FX_BOOL IsLatinWord(uint16_t word) = 0;
-};
-
-#endif // CORE_FPDFDOC_INCLUDE_IPDF_VARIABLETEXT_PROVIDER_H_
diff --git a/core/fpdfdoc/ipdf_variabletext_provider.cpp b/core/fpdfdoc/ipdf_variabletext_provider.cpp
deleted file mode 100644
index 82937f745a..0000000000
--- a/core/fpdfdoc/ipdf_variabletext_provider.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-// 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
-
-#include "core/fpdfdoc/include/ipdf_variabletext_provider.h"
-
-IPDF_VariableText_Provider::~IPDF_VariableText_Provider() {}
diff --git a/core/fpdfdoc/pdf_vt.h b/core/fpdfdoc/pdf_vt.h
index f97c48638f..73913f78f4 100644
--- a/core/fpdfdoc/pdf_vt.h
+++ b/core/fpdfdoc/pdf_vt.h
@@ -342,9 +342,9 @@ class CPDF_VariableText : public IPDF_VariableText, private CPDF_EditContainer {
~CPDF_VariableText() override;
// IPDF_VariableText
- IPDF_VariableText_Provider* SetProvider(
- IPDF_VariableText_Provider* pProvider) override;
- IPDF_VariableText_Iterator* GetIterator() override;
+ IPDF_VariableText::Provider* SetProvider(
+ IPDF_VariableText::Provider* pProvider) override;
+ IPDF_VariableText::Iterator* GetIterator() override;
void SetPlateRect(const CFX_FloatRect& rect) override {
CPDF_EditContainer::SetPlateRect(rect);
}
@@ -521,16 +521,16 @@ class CPDF_VariableText : public IPDF_VariableText, private CPDF_EditContainer {
private:
FX_BOOL m_bInitial;
FX_BOOL m_bRichText;
- IPDF_VariableText_Provider* m_pVTProvider;
- CPDF_VariableText_Iterator* m_pVTIterator;
+ IPDF_VariableText::Provider* m_pVTProvider;
+ CPDF_VariableText::Iterator* m_pVTIterator;
};
-class CPDF_VariableText_Iterator : public IPDF_VariableText_Iterator {
+class CPDF_VariableText_Iterator : public IPDF_VariableText::Iterator {
public:
explicit CPDF_VariableText_Iterator(CPDF_VariableText* pVT);
~CPDF_VariableText_Iterator() override;
- // IPDF_VariableText_Iterator
+ // IPDF_VariableText::Iterator
FX_BOOL NextWord() override;
FX_BOOL PrevWord() override;
FX_BOOL NextLine() override;
diff --git a/core/include/fpdfdoc/fpdf_vt.h b/core/include/fpdfdoc/fpdf_vt.h
index 1e0d351fee..d8a904c632 100644
--- a/core/include/fpdfdoc/fpdf_vt.h
+++ b/core/include/fpdfdoc/fpdf_vt.h
@@ -10,8 +10,6 @@
#include "core/include/fxge/fx_dib.h"
class IPDF_VariableText;
-class IPDF_VariableText_Iterator;
-class IPDF_VariableText_Provider;
struct CPVT_Line;
struct CPVT_Section;
struct CPVT_Word;
@@ -39,57 +37,43 @@ struct CPVT_WordPlace {
FX_BOOL operator!=(const CPVT_WordPlace& wp) const { return !(*this == wp); }
inline int32_t WordCmp(const CPVT_WordPlace& wp) const {
- if (nSecIndex > wp.nSecIndex) {
+ if (nSecIndex > wp.nSecIndex)
return 1;
- }
- if (nSecIndex < wp.nSecIndex) {
+ if (nSecIndex < wp.nSecIndex)
return -1;
- }
- if (nLineIndex > wp.nLineIndex) {
+ if (nLineIndex > wp.nLineIndex)
return 1;
- }
- if (nLineIndex < wp.nLineIndex) {
+ if (nLineIndex < wp.nLineIndex)
return -1;
- }
- if (nWordIndex > wp.nWordIndex) {
+ if (nWordIndex > wp.nWordIndex)
return 1;
- }
- if (nWordIndex < wp.nWordIndex) {
+ if (nWordIndex < wp.nWordIndex)
return -1;
- }
return 0;
}
inline int32_t LineCmp(const CPVT_WordPlace& wp) const {
- if (nSecIndex > wp.nSecIndex) {
+ if (nSecIndex > wp.nSecIndex)
return 1;
- }
- if (nSecIndex < wp.nSecIndex) {
+ if (nSecIndex < wp.nSecIndex)
return -1;
- }
- if (nLineIndex > wp.nLineIndex) {
+ if (nLineIndex > wp.nLineIndex)
return 1;
- }
- if (nLineIndex < wp.nLineIndex) {
+ if (nLineIndex < wp.nLineIndex)
return -1;
- }
return 0;
}
inline int32_t SecCmp(const CPVT_WordPlace& wp) const {
- if (nSecIndex > wp.nSecIndex) {
+ if (nSecIndex > wp.nSecIndex)
return 1;
- }
- if (nSecIndex < wp.nSecIndex) {
+ if (nSecIndex < wp.nSecIndex)
return -1;
- }
return 0;
}
int32_t nSecIndex;
-
int32_t nLineIndex;
-
int32_t nWordIndex;
};
struct CPVT_WordRange {
@@ -135,7 +119,6 @@ struct CPVT_WordRange {
}
CPVT_WordPlace BeginPos;
-
CPVT_WordPlace EndPos;
};
struct CPVT_SecProps {
@@ -152,9 +135,7 @@ struct CPVT_SecProps {
nAlignment(other.nAlignment) {}
FX_FLOAT fLineLeading;
-
FX_FLOAT fLineIndent;
-
int32_t nAlignment;
};
struct CPVT_WordProps {
@@ -192,17 +173,11 @@ struct CPVT_WordProps {
nHorzScale(other.nHorzScale) {}
int32_t nFontIndex;
-
FX_FLOAT fFontSize;
-
FX_COLORREF dwWordColor;
-
int32_t nScriptType;
-
int32_t nWordStyle;
-
FX_FLOAT fCharSpace;
-
int32_t nHorzScale;
};
struct CPVT_Word {
@@ -217,23 +192,14 @@ struct CPVT_Word {
WordProps() {}
uint16_t Word;
-
int32_t nCharset;
-
CPVT_WordPlace WordPlace;
-
CFX_FloatPoint ptWord;
-
FX_FLOAT fAscent;
-
FX_FLOAT fDescent;
-
FX_FLOAT fWidth;
-
int32_t nFontIndex;
-
FX_FLOAT fFontSize;
-
CPVT_WordProps WordProps;
};
struct CPVT_Line {
@@ -241,104 +207,84 @@ struct CPVT_Line {
: ptLine(0, 0), fLineWidth(0.0f), fLineAscent(0.0f), fLineDescent(0.0f) {}
CPVT_WordPlace lineplace;
-
CPVT_WordPlace lineEnd;
-
CFX_FloatPoint ptLine;
-
FX_FLOAT fLineWidth;
-
FX_FLOAT fLineAscent;
-
FX_FLOAT fLineDescent;
};
struct CPVT_Section {
CPVT_WordPlace secplace;
-
CFX_FloatRect rcSection;
-
CPVT_SecProps SecProps;
-
CPVT_WordProps WordProps;
};
-class IPDF_VariableText_Iterator {
- public:
- virtual ~IPDF_VariableText_Iterator() {}
-
- virtual FX_BOOL NextWord() = 0;
-
- virtual FX_BOOL PrevWord() = 0;
-
- virtual FX_BOOL NextLine() = 0;
-
- virtual FX_BOOL PrevLine() = 0;
-
- virtual FX_BOOL NextSection() = 0;
-
- virtual FX_BOOL PrevSection() = 0;
-
- virtual FX_BOOL GetWord(CPVT_Word& word) const = 0;
-
- virtual FX_BOOL SetWord(const CPVT_Word& word) = 0;
-
- virtual FX_BOOL GetLine(CPVT_Line& line) const = 0;
-
- virtual FX_BOOL GetSection(CPVT_Section& section) const = 0;
-
- virtual FX_BOOL SetSection(const CPVT_Section& section) = 0;
-
- virtual void SetAt(int32_t nWordIndex) = 0;
-
- virtual void SetAt(const CPVT_WordPlace& place) = 0;
-
- virtual const CPVT_WordPlace& GetAt() const = 0;
-};
class IPDF_VariableText {
public:
- static IPDF_VariableText* NewVariableText();
+ class Provider {
+ public:
+ virtual ~Provider() {}
+
+ virtual int32_t GetCharWidth(int32_t nFontIndex,
+ uint16_t word,
+ int32_t nWordStyle) = 0;
+ virtual int32_t GetTypeAscent(int32_t nFontIndex) = 0;
+ virtual int32_t GetTypeDescent(int32_t nFontIndex) = 0;
+ virtual int32_t GetWordFontIndex(uint16_t word,
+ int32_t charset,
+ int32_t nFontIndex) = 0;
+ virtual int32_t GetDefaultFontIndex() = 0;
+ virtual FX_BOOL IsLatinWord(uint16_t word) = 0;
+ };
+
+ class Iterator {
+ public:
+ virtual ~Iterator() {}
+
+ virtual FX_BOOL NextWord() = 0;
+ virtual FX_BOOL PrevWord() = 0;
+ virtual FX_BOOL NextLine() = 0;
+ virtual FX_BOOL PrevLine() = 0;
+ virtual FX_BOOL NextSection() = 0;
+ virtual FX_BOOL PrevSection() = 0;
+ virtual FX_BOOL GetWord(CPVT_Word& word) const = 0;
+ virtual FX_BOOL SetWord(const CPVT_Word& word) = 0;
+ virtual FX_BOOL GetLine(CPVT_Line& line) const = 0;
+ virtual FX_BOOL GetSection(CPVT_Section& section) const = 0;
+ virtual FX_BOOL SetSection(const CPVT_Section& section) = 0;
+ virtual void SetAt(int32_t nWordIndex) = 0;
+ virtual void SetAt(const CPVT_WordPlace& place) = 0;
+ virtual const CPVT_WordPlace& GetAt() const = 0;
+ };
+ static IPDF_VariableText* NewVariableText();
static void DelVariableText(IPDF_VariableText* pVT);
- virtual IPDF_VariableText_Provider* SetProvider(
- IPDF_VariableText_Provider* pProvider) = 0;
+ virtual void Initialize() = 0;
- virtual IPDF_VariableText_Iterator* GetIterator() = 0;
+ virtual Provider* SetProvider(Provider* pProvider) = 0;
+ virtual Iterator* GetIterator() = 0;
virtual void SetPlateRect(const CFX_FloatRect& rect) = 0;
-
virtual void SetAlignment(int32_t nFormat = 0) = 0;
-
virtual void SetPasswordChar(uint16_t wSubWord = '*') = 0;
-
virtual void SetLimitChar(int32_t nLimitChar = 0) = 0;
-
virtual void SetCharArray(int32_t nCharArray = 0) = 0;
-
virtual void SetCharSpace(FX_FLOAT fCharSpace = 0.0f) = 0;
-
virtual void SetHorzScale(int32_t nHorzScale = 100) = 0;
-
virtual void SetMultiLine(FX_BOOL bMultiLine = TRUE) = 0;
-
virtual void SetAutoReturn(FX_BOOL bAuto = TRUE) = 0;
-
virtual void SetAutoFontSize(FX_BOOL bAuto = TRUE) = 0;
-
virtual void SetFontSize(FX_FLOAT fFontSize) = 0;
-
virtual void SetLineLeading(FX_FLOAT fLineLeading) = 0;
-
virtual void SetRichText(FX_BOOL bRichText) = 0;
- virtual void Initialize() = 0;
-
virtual FX_BOOL IsValid() const = 0;
-
virtual FX_BOOL IsRichText() const = 0;
+ virtual FX_BOOL IsMultiLine() const = 0;
virtual void RearrangeAll() = 0;
-
virtual void RearrangePart(const CPVT_WordRange& PlaceRange) = 0;
virtual void ResetAll() = 0;
@@ -347,18 +293,15 @@ class IPDF_VariableText {
int32_t charset = 1,
const CPVT_SecProps* pSecProps = NULL,
const CPVT_WordProps* pWordProps = NULL) = 0;
-
virtual CPVT_WordPlace InsertWord(
const CPVT_WordPlace& place,
uint16_t word,
int32_t charset = 1,
const CPVT_WordProps* pWordProps = NULL) = 0;
-
virtual CPVT_WordPlace InsertSection(
const CPVT_WordPlace& place,
const CPVT_SecProps* pSecProps = NULL,
const CPVT_WordProps* pWordProps = NULL) = 0;
-
virtual CPVT_WordPlace InsertText(
const CPVT_WordPlace& place,
const FX_WCHAR* text,
@@ -367,70 +310,45 @@ class IPDF_VariableText {
const CPVT_WordProps* pWordProps = NULL) = 0;
virtual CPVT_WordPlace DeleteWords(const CPVT_WordRange& PlaceRange) = 0;
-
virtual CPVT_WordPlace DeleteWord(const CPVT_WordPlace& place) = 0;
-
virtual CPVT_WordPlace BackSpaceWord(const CPVT_WordPlace& place) = 0;
virtual const CFX_FloatRect& GetPlateRect() const = 0;
-
virtual CFX_FloatRect GetContentRect() const = 0;
-
virtual int32_t GetTotalWords() const = 0;
-
virtual FX_FLOAT GetFontSize() const = 0;
-
virtual int32_t GetAlignment() const = 0;
-
virtual uint16_t GetPasswordChar() const = 0;
-
virtual int32_t GetCharArray() const = 0;
-
virtual int32_t GetLimitChar() const = 0;
-
- virtual FX_BOOL IsMultiLine() const = 0;
-
virtual int32_t GetHorzScale() const = 0;
-
virtual FX_FLOAT GetCharSpace() const = 0;
-
virtual CPVT_WordPlace GetBeginWordPlace() const = 0;
-
virtual CPVT_WordPlace GetEndWordPlace() const = 0;
-
virtual CPVT_WordPlace GetPrevWordPlace(
const CPVT_WordPlace& place) const = 0;
-
virtual CPVT_WordPlace GetNextWordPlace(
const CPVT_WordPlace& place) const = 0;
virtual CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const = 0;
-
virtual CPVT_WordPlace GetUpWordPlace(const CPVT_WordPlace& place,
const CFX_FloatPoint& point) const = 0;
-
virtual CPVT_WordPlace GetDownWordPlace(
const CPVT_WordPlace& place,
const CFX_FloatPoint& point) const = 0;
-
virtual CPVT_WordPlace GetLineBeginPlace(
const CPVT_WordPlace& place) const = 0;
-
virtual CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const = 0;
-
virtual CPVT_WordPlace GetSectionBeginPlace(
const CPVT_WordPlace& place) const = 0;
-
virtual CPVT_WordPlace GetSectionEndPlace(
const CPVT_WordPlace& place) const = 0;
virtual void UpdateWordPlace(CPVT_WordPlace& place) const = 0;
-
virtual CPVT_WordPlace AdjustLineHeader(const CPVT_WordPlace& place,
FX_BOOL bPrevOrNext) const = 0;
virtual int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const = 0;
-
virtual CPVT_WordPlace WordIndexToWordPlace(int32_t index) const = 0;
protected:
diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp
index f45f9ea5f2..0cb5a28e4c 100644
--- a/fpdfsdk/fxedit/fxet_edit.cpp
+++ b/fpdfsdk/fxedit/fxet_edit.cpp
@@ -13,7 +13,7 @@
#define FX_EDIT_UNDO_MAXITEM 10000
CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit* pEdit,
- IPDF_VariableText_Iterator* pVTIterator)
+ IPDF_VariableText::Iterator* pVTIterator)
: m_pEdit(pEdit), m_pVTIterator(pVTIterator) {}
CFX_Edit_Iterator::~CFX_Edit_Iterator() {}
@@ -784,7 +784,7 @@ void CFX_Edit::SetFontMap(IFX_Edit_FontMap* pFontMap) {
m_pVT->SetProvider(m_pVTProvide = new CFX_Edit_Provider(pFontMap));
}
-void CFX_Edit::SetVTProvider(IPDF_VariableText_Provider* pProvider) {
+void CFX_Edit::SetVTProvider(IPDF_VariableText::Provider* pProvider) {
m_pVT->SetProvider(pProvider);
}
@@ -978,7 +978,7 @@ CFX_WideString CFX_Edit::GetText() const {
CFX_WideString swRet;
if (m_pVT->IsValid()) {
- if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) {
+ if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) {
FX_BOOL bRich = m_pVT->IsRichText();
pIterator->SetAt(0);
@@ -1015,7 +1015,7 @@ CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange& range) const {
if (m_pVT->IsValid()) {
FX_BOOL bRich = m_pVT->IsRichText();
- if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) {
+ if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) {
CPVT_WordRange wrTemp = range;
m_pVT->UpdateWordPlace(wrTemp.BeginPos);
m_pVT->UpdateWordPlace(wrTemp.EndPos);
@@ -1060,7 +1060,7 @@ int32_t CFX_Edit::GetTotalWords() const {
int32_t CFX_Edit::GetTotalLines() const {
int32_t nLines = 0;
- if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) {
+ if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) {
pIterator->SetAt(0);
while (pIterator->NextLine())
nLines++;
@@ -1190,7 +1190,7 @@ FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps,
FX_BOOL bSet = FALSE;
FX_BOOL bSet1, bSet2;
if (m_pVT->IsValid() && m_pVT->IsRichText()) {
- if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) {
+ if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) {
CPVT_WordRange wrTemp = m_SelState.ConvertToWordRange();
m_pVT->UpdateWordPlace(wrTemp.BeginPos);
@@ -1266,7 +1266,7 @@ FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps,
const CPVT_WordRange& wr,
FX_BOOL bAddUndo) {
if (m_pVT->IsValid() && m_pVT->IsRichText()) {
- if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) {
+ if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) {
FX_BOOL bSet = FALSE;
CPVT_Section secinfo;
CPVT_Section OldSecinfo;
@@ -1445,7 +1445,7 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps,
const CPVT_WordRange& wr,
FX_BOOL bAddUndo) {
if (m_pVT->IsValid() && m_pVT->IsRichText()) {
- if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) {
+ if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) {
FX_BOOL bSet = FALSE;
CPVT_Word wordinfo;
CPVT_Word OldWordinfo;
@@ -1919,7 +1919,7 @@ void CFX_Edit::ScrollToCaret() {
CFX_FloatPoint ptHead(0, 0);
CFX_FloatPoint ptFoot(0, 0);
- if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) {
+ if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) {
pIterator->SetAt(m_wpCaret);
CPVT_Word word;
@@ -1993,7 +1993,7 @@ void CFX_Edit::Refresh(REFRESH_PLAN_E ePlan,
void CFX_Edit::RefreshPushLineRects(const CPVT_WordRange& wr) {
if (m_pVT->IsValid()) {
- if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) {
+ if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) {
CPVT_WordPlace wpBegin = wr.BeginPos;
m_pVT->UpdateWordPlace(wpBegin);
CPVT_WordPlace wpEnd = wr.EndPos;
@@ -2021,7 +2021,7 @@ void CFX_Edit::RefreshPushLineRects(const CPVT_WordRange& wr) {
void CFX_Edit::RefreshPushRandomRects(const CPVT_WordRange& wr) {
if (m_pVT->IsValid()) {
- if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) {
+ if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) {
CPVT_WordRange wrTemp = wr;
m_pVT->UpdateWordPlace(wrTemp.BeginPos);
@@ -2064,7 +2064,7 @@ void CFX_Edit::RefreshPushRandomRects(const CPVT_WordRange& wr) {
}
void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) {
- if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) {
+ if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) {
CPVT_WordRange wrTemp = wr;
m_pVT->UpdateWordPlace(wrTemp.BeginPos);
@@ -2129,7 +2129,7 @@ void CFX_Edit::SetCaretInfo() {
if (!m_bNotifyFlag) {
CFX_FloatPoint ptHead(0.0f, 0.0f), ptFoot(0.0f, 0.0f);
- if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) {
+ if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) {
pIterator->SetAt(m_wpCaret);
CPVT_Word word;
CPVT_Line line;
@@ -2164,7 +2164,7 @@ void CFX_Edit::SetCaretChange() {
CPVT_SecProps SecProps;
CPVT_WordProps WordProps;
- if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) {
+ if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) {
pIterator->SetAt(m_wpCaret);
CPVT_Word word;
CPVT_Section section;
@@ -2547,7 +2547,7 @@ FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) {
CPVT_Word word;
if (bAddUndo) {
- if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) {
+ if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) {
pIterator->SetAt(m_wpCaret);
pIterator->GetSection(section);
pIterator->GetWord(word);
@@ -2610,7 +2610,7 @@ FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) {
CPVT_Word word;
if (bAddUndo) {
- if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) {
+ if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) {
pIterator->SetAt(m_pVT->GetNextWordPlace(m_wpCaret));
pIterator->GetSection(section);
pIterator->GetWord(word);
@@ -2684,7 +2684,7 @@ FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) {
if (m_pVT->IsRichText()) {
BeginGroupUndo(L"");
- if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) {
+ if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) {
pIterator->SetAt(range.EndPos);
CPVT_Word wordinfo;
@@ -2817,7 +2817,7 @@ FX_BOOL CFX_Edit::Undo() {
void CFX_Edit::SetCaretOrigin() {
if (m_pVT->IsValid()) {
- if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) {
+ if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) {
pIterator->SetAt(m_wpCaret);
CPVT_Word word;
CPVT_Line line;
@@ -2930,7 +2930,7 @@ void CFX_Edit::EnableOprNotify(FX_BOOL bNotify) {
}
FX_FLOAT CFX_Edit::GetLineTop(const CPVT_WordPlace& place) const {
- if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) {
+ if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) {
CPVT_WordPlace wpOld = pIterator->GetAt();
pIterator->SetAt(place);
@@ -2946,7 +2946,7 @@ FX_FLOAT CFX_Edit::GetLineTop(const CPVT_WordPlace& place) const {
}
FX_FLOAT CFX_Edit::GetLineBottom(const CPVT_WordPlace& place) const {
- if (IPDF_VariableText_Iterator* pIterator = m_pVT->GetIterator()) {
+ if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) {
CPVT_WordPlace wpOld = pIterator->GetAt();
pIterator->SetAt(place);
diff --git a/fpdfsdk/include/fxedit/fx_edit.h b/fpdfsdk/include/fxedit/fx_edit.h
index 905ad392a9..2adf97b882 100644
--- a/fpdfsdk/include/fxedit/fx_edit.h
+++ b/fpdfsdk/include/fxedit/fx_edit.h
@@ -8,6 +8,7 @@
#define FPDFSDK_INCLUDE_FXEDIT_FX_EDIT_H_
#include "core/fxcrt/include/fx_basic.h"
+#include "core/include/fpdfdoc/fpdf_vt.h"
#include "core/include/fxge/fx_dib.h"
class CFX_RenderDevice;
@@ -24,8 +25,7 @@ class IFX_Edit_UndoItem;
class IFX_List;
class IFX_List_Notify;
class IFX_SystemHandler;
-class IPDF_VariableText;
-class IPDF_VariableText_Provider;
+
struct CPVT_Line;
struct CPVT_SecProps;
struct CPVT_Section;
@@ -187,7 +187,7 @@ class IFX_Edit {
virtual void SetFontMap(IFX_Edit_FontMap* pFontMap) = 0;
// if user don't like to use FontMap, implement VTProvider and set it
// directly.
- virtual void SetVTProvider(IPDF_VariableText_Provider* pProvider) = 0;
+ virtual void SetVTProvider(IPDF_VariableText::Provider* pProvider) = 0;
// set a IFX_Edit_Notify pointer implemented by user.
virtual void SetNotify(IFX_Edit_Notify* pNotify) = 0;
virtual void SetOprNotify(IFX_Edit_OprNotify* pOprNotify) = 0;
diff --git a/fpdfsdk/include/fxedit/fxet_edit.h b/fpdfsdk/include/fxedit/fxet_edit.h
index d3383ac2cd..a9df992bf2 100644
--- a/fpdfsdk/include/fxedit/fxet_edit.h
+++ b/fpdfsdk/include/fxedit/fxet_edit.h
@@ -7,7 +7,6 @@
#ifndef FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_
#define FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_
-#include "core/fpdfdoc/include/ipdf_variabletext_provider.h"
#include "core/include/fpdfdoc/fpdf_vt.h"
#include "fpdfsdk/include/fxedit/fx_edit.h"
@@ -516,7 +515,7 @@ class CFX_Edit : public IFX_Edit {
// IFX_Edit
void SetFontMap(IFX_Edit_FontMap* pFontMap) override;
- void SetVTProvider(IPDF_VariableText_Provider* pProvider) override;
+ void SetVTProvider(IPDF_VariableText::Provider* pProvider) override;
void SetNotify(IFX_Edit_Notify* pNotify) override;
void SetOprNotify(IFX_Edit_OprNotify* pOprNotify) override;
IFX_Edit_Iterator* GetIterator() override;
@@ -755,7 +754,7 @@ class CFX_Edit : public IFX_Edit {
class CFX_Edit_Iterator : public IFX_Edit_Iterator {
public:
- CFX_Edit_Iterator(CFX_Edit* pEdit, IPDF_VariableText_Iterator* pVTIterator);
+ CFX_Edit_Iterator(CFX_Edit* pEdit, IPDF_VariableText::Iterator* pVTIterator);
~CFX_Edit_Iterator() override;
// IFX_Edit_Iterator
@@ -775,17 +774,17 @@ class CFX_Edit_Iterator : public IFX_Edit_Iterator {
private:
CFX_Edit* m_pEdit;
- IPDF_VariableText_Iterator* m_pVTIterator;
+ IPDF_VariableText::Iterator* m_pVTIterator;
};
-class CFX_Edit_Provider : public IPDF_VariableText_Provider {
+class CFX_Edit_Provider : public IPDF_VariableText::Provider {
public:
explicit CFX_Edit_Provider(IFX_Edit_FontMap* pFontMap);
~CFX_Edit_Provider() override;
IFX_Edit_FontMap* GetFontMap();
- // IPDF_VariableText_Provider:
+ // IPDF_VariableText::Provider:
int32_t GetCharWidth(int32_t nFontIndex,
uint16_t word,
int32_t nWordStyle) override;
diff --git a/pdfium.gyp b/pdfium.gyp
index 8572141162..281cec356a 100644
--- a/pdfium.gyp
+++ b/pdfium.gyp
@@ -247,8 +247,6 @@
'core/fpdfdoc/doc_viewerPreferences.cpp',
'core/fpdfdoc/doc_vt.cpp',
'core/fpdfdoc/doc_vtmodule.cpp',
- 'core/fpdfdoc/include/ipdf_variabletext_provider.h',
- 'core/fpdfdoc/ipdf_variabletext_provider.cpp',
'core/fpdfdoc/ipvt_fontmap.h',
'core/fpdfdoc/pdf_vt.h',
'core/fpdfdoc/tagged_int.h',