From c7a7349cf316af37d4ad4b71c5742159deccbf33 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Tue, 5 Apr 2016 12:01:42 -0700 Subject: Remove core/include/fpdfdoc/fpdf_vt.h This CL removes the core/include/fpdfdoc/fpdf_vt.h file. The IPDF_VariableText class was removed in favour of the only concrete class of CPD_VariableText. CPVT_Provider was moved to CPDF_VariableText::Provider and CPDF_VariableText_Iterator was moved to CPDF_VariableText::Iterator. The IFX_Edit_FontMap interface was merged into the IPVT_FontMap interface so there is only one. Other classes were split out as needed in order to keep things compiling. BUG=pdfium:468 Review URL: https://codereview.chromium.org/1860063002 --- fpdfsdk/fsdk_baseform.cpp | 5 -- fpdfsdk/fxedit/DEPS | 1 + fpdfsdk/fxedit/fxet_ap.cpp | 6 +- fpdfsdk/fxedit/fxet_edit.cpp | 63 ++++++++++---------- fpdfsdk/fxedit/fxet_list.cpp | 5 +- fpdfsdk/fxedit/fxet_module.cpp | 12 ++-- fpdfsdk/fxedit/fxet_pageobjs.cpp | 10 ++-- fpdfsdk/include/fsdk_define.h | 1 - fpdfsdk/include/fxedit/fx_edit.h | 115 +++++++++++++++++++++++++++---------- fpdfsdk/include/fxedit/fxet_edit.h | 31 +++++----- fpdfsdk/include/fxedit/fxet_list.h | 6 +- fpdfsdk/pdfwindow/DEPS | 1 + fpdfsdk/pdfwindow/PWL_Edit.cpp | 5 +- fpdfsdk/pdfwindow/PWL_EditCtrl.cpp | 4 +- fpdfsdk/pdfwindow/PWL_FontMap.cpp | 1 + fpdfsdk/pdfwindow/PWL_FontMap.h | 5 +- fpdfsdk/pdfwindow/PWL_Label.cpp | 1 + fpdfsdk/pdfwindow/PWL_Utils.cpp | 6 +- fpdfsdk/pdfwindow/PWL_Utils.h | 9 +-- fpdfsdk/pdfwindow/PWL_Wnd.cpp | 2 +- fpdfsdk/pdfwindow/PWL_Wnd.h | 6 +- 21 files changed, 179 insertions(+), 116 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/fsdk_baseform.cpp b/fpdfsdk/fsdk_baseform.cpp index d195d87fc1..fe7c23932f 100644 --- a/fpdfsdk/fsdk_baseform.cpp +++ b/fpdfsdk/fsdk_baseform.cpp @@ -30,11 +30,6 @@ #include "xfa/include/fxfa/xfa_ffwidget.h" #endif // PDF_ENABLE_XFA -#define IsFloatZero(f) ((f) < 0.01 && (f) > -0.01) -#define IsFloatBigger(fa, fb) ((fa) > (fb) && !IsFloatZero((fa) - (fb))) -#define IsFloatSmaller(fa, fb) ((fa) < (fb) && !IsFloatZero((fa) - (fb))) -#define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb)) - CPDFSDK_Widget::CPDFSDK_Widget(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView, CPDFSDK_InterForm* pInterForm) diff --git a/fpdfsdk/fxedit/DEPS b/fpdfsdk/fxedit/DEPS index 8e0928c269..cf99b35f95 100644 --- a/fpdfsdk/fxedit/DEPS +++ b/fpdfsdk/fxedit/DEPS @@ -1,3 +1,4 @@ include_rules = [ '+core/fpdfapi/fpdf_font/include', + '+core/fpdfdoc/include', ] diff --git a/fpdfsdk/fxedit/fxet_ap.cpp b/fpdfsdk/fxedit/fxet_ap.cpp index c17a2caaf6..48c6876a74 100644 --- a/fpdfsdk/fxedit/fxet_ap.cpp +++ b/fpdfsdk/fxedit/fxet_ap.cpp @@ -6,10 +6,12 @@ #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfdoc/include/cpvt_word.h" +#include "core/fpdfdoc/include/ipvt_fontmap.h" #include "fpdfsdk/include/fxedit/fx_edit.h" #include "fpdfsdk/include/fxedit/fxet_edit.h" -CFX_ByteString GetPDFWordString(IFX_Edit_FontMap* pFontMap, +CFX_ByteString GetPDFWordString(IPVT_FontMap* pFontMap, int32_t nFontIndex, uint16_t Word, uint16_t SubWord) { @@ -42,7 +44,7 @@ static CFX_ByteString GetWordRenderString(const CFX_ByteString& strWords) { return ""; } -static CFX_ByteString GetFontSetString(IFX_Edit_FontMap* pFontMap, +static CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap, int32_t nFontIndex, FX_FLOAT fFontSize) { CFX_ByteTextBuf sRet; diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp index 0cb5a28e4c..f275248ac2 100644 --- a/fpdfsdk/fxedit/fxet_edit.cpp +++ b/fpdfsdk/fxedit/fxet_edit.cpp @@ -9,11 +9,14 @@ #include #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" +#include "core/fpdfdoc/include/cpvt_section.h" +#include "core/fpdfdoc/include/cpvt_word.h" +#include "core/fpdfdoc/include/ipvt_fontmap.h" #define FX_EDIT_UNDO_MAXITEM 10000 CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit* pEdit, - IPDF_VariableText::Iterator* pVTIterator) + CPDF_VariableText::Iterator* pVTIterator) : m_pEdit(pEdit), m_pVTIterator(pVTIterator) {} CFX_Edit_Iterator::~CFX_Edit_Iterator() {} @@ -88,14 +91,14 @@ IFX_Edit* CFX_Edit_Iterator::GetEdit() const { return m_pEdit; } -CFX_Edit_Provider::CFX_Edit_Provider(IFX_Edit_FontMap* pFontMap) - : m_pFontMap(pFontMap) { +CFX_Edit_Provider::CFX_Edit_Provider(IPVT_FontMap* pFontMap) + : CPDF_VariableText::Provider(pFontMap), m_pFontMap(pFontMap) { ASSERT(m_pFontMap); } CFX_Edit_Provider::~CFX_Edit_Provider() {} -IFX_Edit_FontMap* CFX_Edit_Provider::GetFontMap() { +IPVT_FontMap* CFX_Edit_Provider::GetFontMap() { return m_pFontMap; } @@ -739,7 +742,7 @@ void CFXEU_SetWordProps::Undo() { } } -CFX_Edit::CFX_Edit(IPDF_VariableText* pVT) +CFX_Edit::CFX_Edit(CPDF_VariableText* pVT) : m_pVT(pVT), m_pNotify(NULL), m_pOprNotify(NULL), @@ -779,12 +782,12 @@ void CFX_Edit::Initialize() { SetCaretOrigin(); } -void CFX_Edit::SetFontMap(IFX_Edit_FontMap* pFontMap) { +void CFX_Edit::SetFontMap(IPVT_FontMap* pFontMap) { delete m_pVTProvide; m_pVT->SetProvider(m_pVTProvide = new CFX_Edit_Provider(pFontMap)); } -void CFX_Edit::SetVTProvider(IPDF_VariableText::Provider* pProvider) { +void CFX_Edit::SetVTProvider(CPDF_VariableText::Provider* pProvider) { m_pVT->SetProvider(pProvider); } @@ -803,11 +806,11 @@ IFX_Edit_Iterator* CFX_Edit::GetIterator() { return m_pIterator; } -IPDF_VariableText* CFX_Edit::GetVariableText() { +CPDF_VariableText* CFX_Edit::GetVariableText() { return m_pVT; } -IFX_Edit_FontMap* CFX_Edit::GetFontMap() { +IPVT_FontMap* CFX_Edit::GetFontMap() { if (m_pVTProvide) return m_pVTProvide->GetFontMap(); @@ -978,7 +981,7 @@ CFX_WideString CFX_Edit::GetText() const { CFX_WideString swRet; if (m_pVT->IsValid()) { - if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { + if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { FX_BOOL bRich = m_pVT->IsRichText(); pIterator->SetAt(0); @@ -1015,7 +1018,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 (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { CPVT_WordRange wrTemp = range; m_pVT->UpdateWordPlace(wrTemp.BeginPos); m_pVT->UpdateWordPlace(wrTemp.EndPos); @@ -1060,7 +1063,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 (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { pIterator->SetAt(0); while (pIterator->NextLine()) nLines++; @@ -1120,7 +1123,7 @@ FX_BOOL CFX_Edit::SetRichTextColor(FX_COLORREF dwColor) { return SetRichTextProps(EP_WORDCOLOR, NULL, &WordProps); } -FX_BOOL CFX_Edit::SetRichTextScript(int32_t nScriptType) { +FX_BOOL CFX_Edit::SetRichTextScript(CPDF_VariableText::ScriptType nScriptType) { CPVT_WordProps WordProps; WordProps.nScriptType = nScriptType; return SetRichTextProps(EP_SCRIPTTYPE, NULL, &WordProps); @@ -1190,7 +1193,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 (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { CPVT_WordRange wrTemp = m_SelState.ConvertToWordRange(); m_pVT->UpdateWordPlace(wrTemp.BeginPos); @@ -1266,7 +1269,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 (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { FX_BOOL bSet = FALSE; CPVT_Section secinfo; CPVT_Section OldSecinfo; @@ -1445,7 +1448,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 (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { FX_BOOL bSet = FALSE; CPVT_Word wordinfo; CPVT_Word OldWordinfo; @@ -1461,7 +1464,7 @@ FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps, switch (eProps) { case EP_FONTINDEX: if (wordinfo.WordProps.nFontIndex != pWordProps->nFontIndex) { - if (IFX_Edit_FontMap* pFontMap = GetFontMap()) { + if (IPVT_FontMap* pFontMap = GetFontMap()) { wordinfo.WordProps.nFontIndex = pFontMap->GetWordFontIndex( wordinfo.Word, wordinfo.nCharset, pWordProps->nFontIndex); } @@ -1919,7 +1922,7 @@ void CFX_Edit::ScrollToCaret() { CFX_FloatPoint ptHead(0, 0); CFX_FloatPoint ptFoot(0, 0); - if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { + if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { pIterator->SetAt(m_wpCaret); CPVT_Word word; @@ -1993,7 +1996,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 (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { CPVT_WordPlace wpBegin = wr.BeginPos; m_pVT->UpdateWordPlace(wpBegin); CPVT_WordPlace wpEnd = wr.EndPos; @@ -2021,7 +2024,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 (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { CPVT_WordRange wrTemp = wr; m_pVT->UpdateWordPlace(wrTemp.BeginPos); @@ -2064,7 +2067,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 (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { CPVT_WordRange wrTemp = wr; m_pVT->UpdateWordPlace(wrTemp.BeginPos); @@ -2129,7 +2132,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 (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { pIterator->SetAt(m_wpCaret); CPVT_Word word; CPVT_Line line; @@ -2164,7 +2167,7 @@ void CFX_Edit::SetCaretChange() { CPVT_SecProps SecProps; CPVT_WordProps WordProps; - if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { + if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { pIterator->SetAt(m_wpCaret); CPVT_Word word; CPVT_Section section; @@ -2547,7 +2550,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 (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { pIterator->SetAt(m_wpCaret); pIterator->GetSection(section); pIterator->GetWord(word); @@ -2610,7 +2613,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 (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { pIterator->SetAt(m_pVT->GetNextWordPlace(m_wpCaret)); pIterator->GetSection(section); pIterator->GetWord(word); @@ -2684,7 +2687,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 (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { pIterator->SetAt(range.EndPos); CPVT_Word wordinfo; @@ -2817,7 +2820,7 @@ FX_BOOL CFX_Edit::Undo() { void CFX_Edit::SetCaretOrigin() { if (m_pVT->IsValid()) { - if (IPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { + if (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { pIterator->SetAt(m_wpCaret); CPVT_Word word; CPVT_Line line; @@ -2930,7 +2933,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 (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { CPVT_WordPlace wpOld = pIterator->GetAt(); pIterator->SetAt(place); @@ -2946,7 +2949,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 (CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator()) { CPVT_WordPlace wpOld = pIterator->GetAt(); pIterator->SetAt(place); @@ -2998,7 +3001,7 @@ CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, } int32_t CFX_Edit::GetCharSetFromUnicode(uint16_t word, int32_t nOldCharset) { - if (IFX_Edit_FontMap* pFontMap = GetFontMap()) + if (IPVT_FontMap* pFontMap = GetFontMap()) return pFontMap->CharSetFromUnicode(word, nOldCharset); return nOldCharset; } diff --git a/fpdfsdk/fxedit/fxet_list.cpp b/fpdfsdk/fxedit/fxet_list.cpp index f060d93148..f3db38612c 100644 --- a/fpdfsdk/fxedit/fxet_list.cpp +++ b/fpdfsdk/fxedit/fxet_list.cpp @@ -6,6 +6,7 @@ #include "fpdfsdk/include/fxedit/fxet_list.h" +#include "core/fpdfdoc/include/cpvt_word.h" #include "fpdfsdk/include/fxedit/fxet_edit.h" CFX_ListItem::CFX_ListItem() @@ -22,7 +23,7 @@ CFX_ListItem::~CFX_ListItem() { IFX_Edit::DelEdit(m_pEdit); } -void CFX_ListItem::SetFontMap(IFX_Edit_FontMap* pFontMap) { +void CFX_ListItem::SetFontMap(IPVT_FontMap* pFontMap) { if (m_pEdit) m_pEdit->SetFontMap(pFontMap); } @@ -111,7 +112,7 @@ void CFX_List::Empty() { m_aListItems.RemoveAll(); } -void CFX_List::SetFontMap(IFX_Edit_FontMap* pFontMap) { +void CFX_List::SetFontMap(IPVT_FontMap* pFontMap) { m_pFontMap = pFontMap; } diff --git a/fpdfsdk/fxedit/fxet_module.cpp b/fpdfsdk/fxedit/fxet_module.cpp index 889b0f81a6..330b72bc8b 100644 --- a/fpdfsdk/fxedit/fxet_module.cpp +++ b/fpdfsdk/fxedit/fxet_module.cpp @@ -4,21 +4,17 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "core/fpdfdoc/include/cpdf_variabletext.h" #include "fpdfsdk/include/fxedit/fxet_edit.h" #include "fpdfsdk/include/fxedit/fxet_list.h" IFX_Edit* IFX_Edit::NewEdit() { - if (IPDF_VariableText* pVT = IPDF_VariableText::NewVariableText()) { - return new CFX_Edit(pVT); - } - - return NULL; + return new CFX_Edit(new CPDF_VariableText()); } void IFX_Edit::DelEdit(IFX_Edit* pEdit) { - IPDF_VariableText::DelVariableText(pEdit->GetVariableText()); - - delete (CFX_Edit*)pEdit; + delete pEdit->GetVariableText(); + delete static_cast(pEdit); } IFX_List* IFX_List::NewList() { diff --git a/fpdfsdk/fxedit/fxet_pageobjs.cpp b/fpdfsdk/fxedit/fxet_pageobjs.cpp index 1133cab796..1fe40d98c1 100644 --- a/fpdfsdk/fxedit/fxet_pageobjs.cpp +++ b/fpdfsdk/fxedit/fxet_pageobjs.cpp @@ -10,6 +10,8 @@ #include "core/fpdfapi/fpdf_page/include/cpdf_textobject.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" #include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h" +#include "core/fpdfdoc/include/cpvt_word.h" +#include "core/fpdfdoc/include/ipvt_fontmap.h" #include "core/include/fxge/fx_ge.h" #include "fpdfsdk/include/fx_systemhandler.h" #include "fpdfsdk/include/fxedit/fx_edit.h" @@ -178,7 +180,7 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, } if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { - if (IFX_Edit_FontMap* pFontMap = pEdit->GetFontMap()) { + if (IPVT_FontMap* pFontMap = pEdit->GetFontMap()) { if (pRange) pIterator->SetAt(pRange->BeginPos); else @@ -299,7 +301,7 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, } if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { - if (IFX_Edit_FontMap* pFontMap = pEdit->GetFontMap()) { + if (IPVT_FontMap* pFontMap = pEdit->GetFontMap()) { if (pRange) pIterator->SetAt(pRange->BeginPos); else @@ -473,7 +475,7 @@ void IFX_Edit::GeneratePageObjects( ObjArray.RemoveAll(); if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { - if (IFX_Edit_FontMap* pFontMap = pEdit->GetFontMap()) { + if (IPVT_FontMap* pFontMap = pEdit->GetFontMap()) { if (pRange) pIterator->SetAt(pRange->BeginPos); else @@ -537,7 +539,7 @@ void IFX_Edit::GenerateRichPageObjects( ObjArray.RemoveAll(); if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { - if (IFX_Edit_FontMap* pFontMap = pEdit->GetFontMap()) { + if (IPVT_FontMap* pFontMap = pEdit->GetFontMap()) { if (pRange) pIterator->SetAt(pRange->BeginPos); else diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h index 706880ab72..9d81737f62 100644 --- a/fpdfsdk/include/fsdk_define.h +++ b/fpdfsdk/include/fsdk_define.h @@ -9,7 +9,6 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" #include "core/include/fpdfdoc/fpdf_doc.h" -#include "core/include/fpdfdoc/fpdf_vt.h" #include "core/include/fxge/fx_ge.h" #include "core/include/fxge/fx_ge_win32.h" #include "public/fpdfview.h" diff --git a/fpdfsdk/include/fxedit/fx_edit.h b/fpdfsdk/include/fxedit/fx_edit.h index 2adf97b882..532e96d97f 100644 --- a/fpdfsdk/include/fxedit/fx_edit.h +++ b/fpdfsdk/include/fxedit/fx_edit.h @@ -7,18 +7,18 @@ #ifndef FPDFSDK_INCLUDE_FXEDIT_FX_EDIT_H_ #define FPDFSDK_INCLUDE_FXEDIT_FX_EDIT_H_ +#include "core/fpdfdoc/include/cpdf_variabletext.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; class CPDF_Font; -class CFX_Matrix; class CPDF_PageObjectHolder; -class CFX_FloatPoint; class CPDF_TextObject; +class CFX_FloatPoint; +class CFX_Matrix; +class CFX_RenderDevice; class IFX_Edit; -class IFX_Edit_FontMap; +class IPVT_FontMap; class IFX_Edit_Iterator; class IFX_Edit_Notify; class IFX_Edit_UndoItem; @@ -51,23 +51,6 @@ struct CPVT_WordRange; #define DEFAULT_CHARSET 1 #endif -class IFX_Edit_FontMap { - public: - virtual ~IFX_Edit_FontMap() {} - // map a fontindex to pdf font. - virtual CPDF_Font* GetPDFFont(int32_t nFontIndex) = 0; - // get the alias of a pdf font. - virtual CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) = 0; - // get the index of a font that can show a word. - virtual int32_t GetWordFontIndex(uint16_t word, - int32_t charset, - int32_t nFontIndex) = 0; - // get the charcode of word from unicode - virtual int32_t CharCodeFromUnicode(int32_t nFontIndex, uint16_t word) = 0; - // get the charset of unicode - virtual int32_t CharSetFromUnicode(uint16_t word, int32_t nOldCharset) = 0; -}; - class IFX_Edit_Notify { public: virtual ~IFX_Edit_Notify() {} @@ -183,21 +166,26 @@ class IFX_Edit { static IFX_Edit* NewEdit(); static void DelEdit(IFX_Edit* pEdit); - // set a IFX_Edit_FontMap pointer implemented by user. - virtual void SetFontMap(IFX_Edit_FontMap* pFontMap) = 0; + // set a IPVT_FontMap pointer implemented by user. + virtual void SetFontMap(IPVT_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(CPDF_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; + // get a pointer allocated by CPDF_Edit, by this pointer, user can iterate the // contents of edit, but don't need to release. virtual IFX_Edit_Iterator* GetIterator() = 0; + // get a VT pointer relative to this edit. - virtual IPDF_VariableText* GetVariableText() = 0; - // get the IFX_Edit_FontMap pointer set by user. - virtual IFX_Edit_FontMap* GetFontMap() = 0; + virtual CPDF_VariableText* GetVariableText() = 0; + + // get the IPVT_FontMap pointer set by user. + virtual IPVT_FontMap* GetFontMap() = 0; // initialize the edit. virtual void Initialize() = 0; @@ -205,106 +193,148 @@ class IFX_Edit { // set the bounding box of the text area. virtual void SetPlateRect(const CFX_FloatRect& rect, FX_BOOL bPaint = TRUE) = 0; + // set the scroll origin virtual void SetScrollPos(const CFX_FloatPoint& point) = 0; // set the horizontal text alignment in text box, nFormat (0:left 1:middle // 2:right). virtual void SetAlignmentH(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) = 0; + // set the vertical text alignment in text box, nFormat (0:top 1:center // 2:bottom). virtual void SetAlignmentV(int32_t nFormat = 0, FX_BOOL bPaint = TRUE) = 0; + // if the text is shown in secret , set a character for substitute. virtual void SetPasswordChar(uint16_t wSubWord = '*', FX_BOOL bPaint = TRUE) = 0; + // set the maximal count of words of the text. virtual void SetLimitChar(int32_t nLimitChar = 0, FX_BOOL bPaint = TRUE) = 0; + // if set the count of charArray , then all words is shown in equal space. virtual void SetCharArray(int32_t nCharArray = 0, FX_BOOL bPaint = TRUE) = 0; + // set the space of two characters. virtual void SetCharSpace(FX_FLOAT fCharSpace = 0.0f, FX_BOOL bPaint = TRUE) = 0; + // set the horizontal scale of all characters. virtual void SetHorzScale(int32_t nHorzScale = 100, FX_BOOL bPaint = TRUE) = 0; + // set the leading of all lines virtual void SetLineLeading(FX_FLOAT fLineLeading, FX_BOOL bPaint = TRUE) = 0; + // if set, CRLF is allowed. virtual void SetMultiLine(FX_BOOL bMultiLine = TRUE, FX_BOOL bPaint = TRUE) = 0; + // if set, all words auto fit the width of the bounding box. virtual void SetAutoReturn(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0; + // if set, a font size is calculated to full fit the bounding box. virtual void SetAutoFontSize(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0; + // is set, the text is allowed to scroll. virtual void SetAutoScroll(FX_BOOL bAuto = TRUE, FX_BOOL bPaint = TRUE) = 0; + // set the font size of all words. virtual void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE) = 0; + // the text is allowed to auto-scroll, allow the text overflow? virtual void SetTextOverflow(FX_BOOL bAllowed = FALSE, FX_BOOL bPaint = TRUE) = 0; // query if the edit is richedit. virtual FX_BOOL IsRichText() const = 0; + // set the edit is richedit. virtual void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE) = 0; + // set the fontsize of selected text. virtual FX_BOOL SetRichFontSize(FX_FLOAT fFontSize) = 0; + // set the fontindex of selected text, user can change the font of selected // text. virtual FX_BOOL SetRichFontIndex(int32_t nFontIndex) = 0; + // set the textcolor of selected text. virtual FX_BOOL SetRichTextColor(FX_COLORREF dwColor) = 0; + // set the text script type of selected text. (0:normal 1:superscript // 2:subscript) - virtual FX_BOOL SetRichTextScript(int32_t nScriptType) = 0; + virtual FX_BOOL SetRichTextScript( + CPDF_VariableText::ScriptType nScriptType) = 0; + // set the bold font style of selected text. virtual FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE) = 0; + // set the italic font style of selected text. virtual FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE) = 0; + // set the underline style of selected text. virtual FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE) = 0; + // set the crossout style of selected text. virtual FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE) = 0; + // set the charspace of selected text, in user coordinate. virtual FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace) = 0; + // set the horizontal scale of selected text, default value is 100. virtual FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100) = 0; + // set the leading of selected section, in user coordinate. virtual FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading) = 0; + // set the indent of selected section, in user coordinate. virtual FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent) = 0; + // set the alignment of selected section, nAlignment(0:left 1:middle 2:right) virtual FX_BOOL SetRichTextAlignment(int32_t nAlignment) = 0; // set the selected range of text. // if nStartChar == 0 and nEndChar == -1, select all the text. virtual void SetSel(int32_t nStartChar, int32_t nEndChar) = 0; + // get the selected range of text. virtual void GetSel(int32_t& nStartChar, int32_t& nEndChar) const = 0; + // select all the text. virtual void SelectAll() = 0; + // set text is not selected. virtual void SelectNone() = 0; + // get the caret position. virtual int32_t GetCaret() const = 0; virtual CPVT_WordPlace GetCaretWordPlace() const = 0; + // get the string of selected text. virtual CFX_WideString GetSelText() const = 0; + // get the text conent virtual CFX_WideString GetText() const = 0; + // query if any text is selected. virtual FX_BOOL IsSelected() const = 0; + // get the scroll origin virtual CFX_FloatPoint GetScrollPos() const = 0; + // get the bounding box of the text area. virtual CFX_FloatRect GetPlateRect() const = 0; + // get the fact area of the text. virtual CFX_FloatRect GetContentRect() const = 0; + // get the visible word range virtual CPVT_WordRange GetVisibleWordRange() const = 0; + // get the whole word range virtual CPVT_WordRange GetWholeWordRange() const = 0; + // get the word range of select text virtual CPVT_WordRange GetSelectWordRange() const = 0; @@ -313,20 +343,27 @@ class IFX_Edit { virtual void OnMouseDown(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl) = 0; + // send the mousemove message to edit when mouse down is TRUE. virtual void OnMouseMove(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl) = 0; + // send the UP key message to edit. virtual void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) = 0; + // send the DOWN key message to edit. virtual void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) = 0; + // send the LEFT key message to edit. virtual void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) = 0; + // send the RIGHT key message to edit. virtual void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) = 0; + // send the HOME key message to edit. virtual void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) = 0; + // send the END key message to edit. virtual void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) = 0; @@ -335,29 +372,37 @@ class IFX_Edit { int32_t charset = DEFAULT_CHARSET, const CPVT_SecProps* pSecProps = NULL, const CPVT_WordProps* pWordProps = NULL) = 0; + // insert a word into the edit. virtual FX_BOOL InsertWord(uint16_t word, int32_t charset = DEFAULT_CHARSET, const CPVT_WordProps* pWordProps = NULL) = 0; + // insert a return into the edit. virtual FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = NULL, const CPVT_WordProps* pWordProps = NULL) = 0; + // insert text into the edit. virtual FX_BOOL InsertText(const FX_WCHAR* text, int32_t charset = DEFAULT_CHARSET, const CPVT_SecProps* pSecProps = NULL, const CPVT_WordProps* pWordProps = NULL) = 0; + // do backspace operation. virtual FX_BOOL Backspace() = 0; + // do delete operation. virtual FX_BOOL Delete() = 0; + // delete the selected text. virtual FX_BOOL Clear() = 0; // do Redo operation. virtual FX_BOOL Redo() = 0; + // do Undo operation. virtual FX_BOOL Undo() = 0; + // move caret virtual void SetCaret(int32_t nPos) = 0; @@ -403,22 +448,30 @@ class IFX_Edit { // get the font size of non_rich text or default font size of richtext. virtual FX_FLOAT GetFontSize() const = 0; + // get the mask character. virtual uint16_t GetPasswordChar() const = 0; + // get the count of charArray virtual int32_t GetCharArray() const = 0; + // get the horizontal scale of all characters virtual int32_t GetHorzScale() const = 0; + // get the space of two characters virtual FX_FLOAT GetCharSpace() const = 0; + // get the latin words of specified range virtual CFX_WideString GetRangeText(const CPVT_WordRange& range) const = 0; + // is the text full in bounding box virtual FX_BOOL IsTextFull() const = 0; virtual FX_BOOL CanUndo() const = 0; virtual FX_BOOL CanRedo() const = 0; + // if the content is changed after settext? virtual FX_BOOL IsModified() const = 0; + // get the total words in edit virtual int32_t GetTotalWords() const = 0; @@ -512,7 +565,7 @@ class IFX_List { static IFX_List* NewList(); static void DelList(IFX_List* pList); - virtual void SetFontMap(IFX_Edit_FontMap* pFontMap) = 0; + virtual void SetFontMap(IPVT_FontMap* pFontMap) = 0; virtual void SetNotify(IFX_List_Notify* pNotify) = 0; virtual void SetPlateRect(const CFX_FloatRect& rect) = 0; @@ -568,7 +621,7 @@ class IFX_List { virtual ~IFX_List() {} }; -CFX_ByteString GetPDFWordString(IFX_Edit_FontMap* pFontMap, +CFX_ByteString GetPDFWordString(IPVT_FontMap* pFontMap, int32_t nFontIndex, uint16_t Word, uint16_t SubWord); diff --git a/fpdfsdk/include/fxedit/fxet_edit.h b/fpdfsdk/include/fxedit/fxet_edit.h index a9df992bf2..fb6c917582 100644 --- a/fpdfsdk/include/fxedit/fxet_edit.h +++ b/fpdfsdk/include/fxedit/fxet_edit.h @@ -7,7 +7,8 @@ #ifndef FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_ #define FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_ -#include "core/include/fpdfdoc/fpdf_vt.h" +#include "core/fpdfdoc/include/cpvt_secprops.h" +#include "core/fpdfdoc/include/cpvt_wordprops.h" #include "fpdfsdk/include/fxedit/fx_edit.h" class CFX_Edit; @@ -510,17 +511,17 @@ class CFX_Edit : public IFX_Edit { friend class CFXEU_InsertText; public: - explicit CFX_Edit(IPDF_VariableText* pVT); + explicit CFX_Edit(CPDF_VariableText* pVT); ~CFX_Edit() override; // IFX_Edit - void SetFontMap(IFX_Edit_FontMap* pFontMap) override; - void SetVTProvider(IPDF_VariableText::Provider* pProvider) override; + void SetFontMap(IPVT_FontMap* pFontMap) override; + void SetVTProvider(CPDF_VariableText::Provider* pProvider) override; void SetNotify(IFX_Edit_Notify* pNotify) override; void SetOprNotify(IFX_Edit_OprNotify* pOprNotify) override; IFX_Edit_Iterator* GetIterator() override; - IPDF_VariableText* GetVariableText() override; - IFX_Edit_FontMap* GetFontMap() override; + CPDF_VariableText* GetVariableText() override; + IPVT_FontMap* GetFontMap() override; void Initialize() override; void SetPlateRect(const CFX_FloatRect& rect, FX_BOOL bPaint = TRUE) override; void SetScrollPos(const CFX_FloatPoint& point) override; @@ -544,7 +545,7 @@ class CFX_Edit : public IFX_Edit { FX_BOOL SetRichFontSize(FX_FLOAT fFontSize) override; FX_BOOL SetRichFontIndex(int32_t nFontIndex) override; FX_BOOL SetRichTextColor(FX_COLORREF dwColor) override; - FX_BOOL SetRichTextScript(int32_t nScriptType) override; + FX_BOOL SetRichTextScript(CPDF_VariableText::ScriptType nScriptType) override; FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE) override; FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE) override; FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE) override; @@ -725,7 +726,7 @@ class CFX_Edit : public IFX_Edit { FX_FLOAT GetLineBottom(const CPVT_WordPlace& place) const; private: - IPDF_VariableText* m_pVT; + CPDF_VariableText* m_pVT; IFX_Edit_Notify* m_pNotify; IFX_Edit_OprNotify* m_pOprNotify; CFX_Edit_Provider* m_pVTProvide; @@ -754,7 +755,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, CPDF_VariableText::Iterator* pVTIterator); ~CFX_Edit_Iterator() override; // IFX_Edit_Iterator @@ -774,17 +775,17 @@ class CFX_Edit_Iterator : public IFX_Edit_Iterator { private: CFX_Edit* m_pEdit; - IPDF_VariableText::Iterator* m_pVTIterator; + CPDF_VariableText::Iterator* m_pVTIterator; }; -class CFX_Edit_Provider : public IPDF_VariableText::Provider { +class CFX_Edit_Provider : public CPDF_VariableText::Provider { public: - explicit CFX_Edit_Provider(IFX_Edit_FontMap* pFontMap); + explicit CFX_Edit_Provider(IPVT_FontMap* pFontMap); ~CFX_Edit_Provider() override; - IFX_Edit_FontMap* GetFontMap(); + IPVT_FontMap* GetFontMap(); - // IPDF_VariableText::Provider: + // CPDF_VariableText::Provider: int32_t GetCharWidth(int32_t nFontIndex, uint16_t word, int32_t nWordStyle) override; @@ -797,7 +798,7 @@ class CFX_Edit_Provider : public IPDF_VariableText::Provider { FX_BOOL IsLatinWord(uint16_t word) override; private: - IFX_Edit_FontMap* m_pFontMap; + IPVT_FontMap* m_pFontMap; }; #endif // FPDFSDK_INCLUDE_FXEDIT_FXET_EDIT_H_ diff --git a/fpdfsdk/include/fxedit/fxet_list.h b/fpdfsdk/include/fxedit/fxet_list.h index d86e6ffeee..0018f13b46 100644 --- a/fpdfsdk/include/fxedit/fxet_list.h +++ b/fpdfsdk/include/fxedit/fxet_list.h @@ -118,7 +118,7 @@ class CFX_ListItem { CFX_ListItem(); virtual ~CFX_ListItem(); - void SetFontMap(IFX_Edit_FontMap* pFontMap); + void SetFontMap(IPVT_FontMap* pFontMap); IFX_Edit_Iterator* GetIterator() const; IFX_Edit* GetEdit() const; @@ -210,7 +210,7 @@ class CFX_List : protected CFX_ListContainer, public IFX_List { ~CFX_List() override; // IFX_List: - void SetFontMap(IFX_Edit_FontMap* pFontMap) override; + void SetFontMap(IPVT_FontMap* pFontMap) override; void SetFontSize(FX_FLOAT fFontSize) override; CFX_FloatRect GetPlateRect() const override; CFX_FloatRect GetContentRect() const override; @@ -240,7 +240,7 @@ class CFX_List : protected CFX_ListContainer, public IFX_List { private: CLST_ArrayTemplate m_aListItems; FX_FLOAT m_fFontSize; - IFX_Edit_FontMap* m_pFontMap; + IPVT_FontMap* m_pFontMap; FX_BOOL m_bMultiple; }; diff --git a/fpdfsdk/pdfwindow/DEPS b/fpdfsdk/pdfwindow/DEPS index 8e0928c269..cf99b35f95 100644 --- a/fpdfsdk/pdfwindow/DEPS +++ b/fpdfsdk/pdfwindow/DEPS @@ -1,3 +1,4 @@ include_rules = [ '+core/fpdfapi/fpdf_font/include', + '+core/fpdfdoc/include', ] diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp index 64588f2dff..b5e2093483 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp @@ -9,6 +9,7 @@ #include #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" +#include "core/fpdfdoc/include/cpvt_word.h" #include "core/fxcrt/include/fx_safe_types.h" #include "core/fxcrt/include/fx_xml.h" #include "core/include/fxge/fx_ge.h" @@ -811,7 +812,7 @@ void CPWL_Edit::SetCharArray(int32_t nCharArray) { m_pEdit->SetTextOverflow(TRUE); if (HasFlag(PWS_AUTOFONTSIZE)) { - if (IFX_Edit_FontMap* pFontMap = GetFontMap()) { + if (IPVT_FontMap* pFontMap = GetFontMap()) { FX_FLOAT fFontSize = GetCharArrayAutoFontSize( pFontMap->GetPDFFont(0), GetClientRect(), nCharArray); if (fFontSize > 0.0f) { @@ -978,7 +979,7 @@ FX_BOOL CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { if (bExit) return FALSE; - if (IFX_Edit_FontMap* pFontMap = GetFontMap()) { + if (IPVT_FontMap* pFontMap = GetFontMap()) { int32_t nOldCharSet = GetCharSet(); int32_t nNewCharSet = pFontMap->CharSetFromUnicode(nChar, DEFAULT_CHARSET); if (nOldCharSet != nNewCharSet) { diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp index fe9dab98e0..af7e5837a3 100644 --- a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp +++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp @@ -6,6 +6,8 @@ #include "fpdfsdk/pdfwindow/PWL_EditCtrl.h" +#include "core/fpdfdoc/include/cpvt_section.h" +#include "core/fpdfdoc/include/cpvt_word.h" #include "fpdfsdk/pdfwindow/PWL_Caret.h" #include "fpdfsdk/pdfwindow/PWL_FontMap.h" #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h" @@ -466,7 +468,7 @@ CPDF_Font* CPWL_EditCtrl::GetCaretFont() const { } } - if (IFX_Edit_FontMap* pFontMap = GetFontMap()) + if (IPVT_FontMap* pFontMap = GetFontMap()) return pFontMap->GetPDFFont(nFontIndex); return NULL; diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/pdfwindow/PWL_FontMap.cpp index 3f149e7193..42beab7d21 100644 --- a/fpdfsdk/pdfwindow/PWL_FontMap.cpp +++ b/fpdfsdk/pdfwindow/PWL_FontMap.cpp @@ -10,6 +10,7 @@ #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" +#include "core/fpdfdoc/include/ipvt_fontmap.h" #include "fpdfsdk/pdfwindow/PWL_Wnd.h" namespace { diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.h b/fpdfsdk/pdfwindow/PWL_FontMap.h index b344e4fef2..70806ebdbc 100644 --- a/fpdfsdk/pdfwindow/PWL_FontMap.h +++ b/fpdfsdk/pdfwindow/PWL_FontMap.h @@ -7,6 +7,7 @@ #ifndef FPDFSDK_PDFWINDOW_PWL_FONTMAP_H_ #define FPDFSDK_PDFWINDOW_PWL_FONTMAP_H_ +#include "core/fpdfdoc/include/ipvt_fontmap.h" #include "fpdfsdk/include/fxedit/fx_edit.h" #include "public/fpdf_sysfontinfo.h" @@ -48,12 +49,12 @@ struct CPWL_FontMap_Native { #endif -class CPWL_FontMap : public IFX_Edit_FontMap { +class CPWL_FontMap : public IPVT_FontMap { public: CPWL_FontMap(IFX_SystemHandler* pSystemHandler); ~CPWL_FontMap() override; - // IFX_Edit_FontMap + // IPVT_FontMap CPDF_Font* GetPDFFont(int32_t nFontIndex) override; CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) override; int32_t GetWordFontIndex(uint16_t word, diff --git a/fpdfsdk/pdfwindow/PWL_Label.cpp b/fpdfsdk/pdfwindow/PWL_Label.cpp index 8c5b0676d7..0e9a9f687d 100644 --- a/fpdfsdk/pdfwindow/PWL_Label.cpp +++ b/fpdfsdk/pdfwindow/PWL_Label.cpp @@ -4,6 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "fpdfsdk/include/fxedit/fx_edit.h" #include "fpdfsdk/pdfwindow/PWL_Label.h" #include "fpdfsdk/pdfwindow/PWL_Utils.h" #include "fpdfsdk/pdfwindow/PWL_Wnd.h" diff --git a/fpdfsdk/pdfwindow/PWL_Utils.cpp b/fpdfsdk/pdfwindow/PWL_Utils.cpp index 3622a84912..acd362a29c 100644 --- a/fpdfsdk/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/pdfwindow/PWL_Utils.cpp @@ -8,7 +8,9 @@ #include +#include "core/fpdfdoc/include/cpvt_word.h" #include "core/include/fxge/fx_ge.h" +#include "fpdfsdk/include/fxedit/fx_edit.h" #include "fpdfsdk/pdfwindow/PWL_Icon.h" #include "fpdfsdk/pdfwindow/PWL_Wnd.h" @@ -575,7 +577,7 @@ CFX_ByteString CPWL_Utils::GetSpellCheckAppStream( } CFX_ByteString CPWL_Utils::GetTextAppStream(const CFX_FloatRect& rcBBox, - IFX_Edit_FontMap* pFontMap, + IPVT_FontMap* pFontMap, const CFX_WideString& sText, int32_t nAlignmentH, int32_t nAlignmentV, @@ -613,7 +615,7 @@ CFX_ByteString CPWL_Utils::GetTextAppStream(const CFX_FloatRect& rcBBox, } CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox, - IFX_Edit_FontMap* pFontMap, + IPVT_FontMap* pFontMap, CPDF_Stream* pIconStream, CPDF_IconFit& IconFit, const CFX_WideString& sLabel, diff --git a/fpdfsdk/pdfwindow/PWL_Utils.h b/fpdfsdk/pdfwindow/PWL_Utils.h index 6917083661..76c3c478b7 100644 --- a/fpdfsdk/pdfwindow/PWL_Utils.h +++ b/fpdfsdk/pdfwindow/PWL_Utils.h @@ -7,11 +7,12 @@ #ifndef FPDFSDK_PDFWINDOW_PWL_UTILS_H_ #define FPDFSDK_PDFWINDOW_PWL_UTILS_H_ -#include "core/include/fpdfdoc/fpdf_vt.h" -#include "fpdfsdk/include/fxedit/fx_edit.h" +#include "core/fpdfdoc/include/cpvt_wordrange.h" #include "fpdfsdk/pdfwindow/PWL_Wnd.h" class CFX_PathData; +class IFX_Edit; + struct CPWL_Color; template @@ -153,7 +154,7 @@ class CPWL_Utils { const CPWL_Color& color); static CFX_ByteString GetPushButtonAppStream(const CFX_FloatRect& rcBBox, - IFX_Edit_FontMap* pFontMap, + IPVT_FontMap* pFontMap, CPDF_Stream* pIconStream, CPDF_IconFit& IconFit, const CFX_WideString& sLabel, @@ -182,7 +183,7 @@ class CPWL_Utils { const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange = NULL); static CFX_ByteString GetTextAppStream(const CFX_FloatRect& rcBBox, - IFX_Edit_FontMap* pFontMap, + IPVT_FontMap* pFontMap, const CFX_WideString& sText, int32_t nAlignmentH, int32_t nAlignmentV, diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/pdfwindow/PWL_Wnd.cpp index cb0955cb5f..538651797e 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp +++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp @@ -815,7 +815,7 @@ IPWL_Provider* CPWL_Wnd::GetProvider() const { return m_sPrivateParam.pProvider; } -IFX_Edit_FontMap* CPWL_Wnd::GetFontMap() const { +IPVT_FontMap* CPWL_Wnd::GetFontMap() const { return m_sPrivateParam.pFontMap; } diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.h b/fpdfsdk/pdfwindow/PWL_Wnd.h index d07adba092..f05b1e6784 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.h +++ b/fpdfsdk/pdfwindow/PWL_Wnd.h @@ -18,7 +18,7 @@ class CPWL_ScrollBar; class CPWL_Timer; class CPWL_TimerHandler; class CPWL_Wnd; -class IFX_Edit_FontMap; +class IPVT_FontMap; class IFX_SystemHandler; class IPWL_Provider; class IPWL_SpellCheck; @@ -230,7 +230,7 @@ struct PWL_CREATEPARAM { CFX_FloatRect rcRectWnd; // required IFX_SystemHandler* pSystemHandler; // required - IFX_Edit_FontMap* pFontMap; // required for text window + IPVT_FontMap* pFontMap; // required for text window IPWL_Provider* pProvider; // required for self coordinate IPWL_FocusHandler* pFocusHandler; // optional uint32_t dwFlags; // optional @@ -366,7 +366,7 @@ class CPWL_Wnd : public CPWL_TimerHandler { FX_BOOL IsReadOnly() const; CPWL_ScrollBar* GetVScrollBar() const; - IFX_Edit_FontMap* GetFontMap() const; + IPVT_FontMap* GetFontMap() const; IPWL_Provider* GetProvider() const; IPWL_FocusHandler* GetFocusHandler() const; -- cgit v1.2.3