diff options
author | dsinclair <dsinclair@chromium.org> | 2016-04-04 15:24:20 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-04 15:24:20 -0700 |
commit | ed9c4386713084f37548b46ab36f618021f716f5 (patch) | |
tree | c5d3bca40a87d9beb9fea03c680f13cc8eb2400c /fpdfsdk | |
parent | c220e59f36a1a5664fc795c801968083adda1722 (diff) | |
download | pdfium-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
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/fxedit/fxet_edit.cpp | 40 | ||||
-rw-r--r-- | fpdfsdk/include/fxedit/fx_edit.h | 6 | ||||
-rw-r--r-- | fpdfsdk/include/fxedit/fxet_edit.h | 11 |
3 files changed, 28 insertions, 29 deletions
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; |