summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/pdfwindow')
-rw-r--r--fpdfsdk/pdfwindow/PWL_ComboBox.cpp1
-rw-r--r--fpdfsdk/pdfwindow/PWL_Edit.cpp32
-rw-r--r--fpdfsdk/pdfwindow/PWL_Edit.h27
-rw-r--r--fpdfsdk/pdfwindow/PWL_EditCtrl.cpp10
-rw-r--r--fpdfsdk/pdfwindow/PWL_EditCtrl.h37
-rw-r--r--fpdfsdk/pdfwindow/PWL_ListBox.cpp28
-rw-r--r--fpdfsdk/pdfwindow/PWL_ListBox.h26
-rw-r--r--fpdfsdk/pdfwindow/PWL_Utils.cpp20
-rw-r--r--fpdfsdk/pdfwindow/PWL_Utils.h6
9 files changed, 83 insertions, 104 deletions
diff --git a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp
index c5560228f1..5184cfe70a 100644
--- a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp
+++ b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp
@@ -7,6 +7,7 @@
#include "fpdfsdk/pdfwindow/PWL_ComboBox.h"
#include "core/fxge/include/fx_ge.h"
+#include "fpdfsdk/fxedit/include/fxet_list.h"
#include "fpdfsdk/pdfwindow/PWL_Edit.h"
#include "fpdfsdk/pdfwindow/PWL_EditCtrl.h"
#include "fpdfsdk/pdfwindow/PWL_ListBox.h"
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp
index e7a4ac9dd3..d729945032 100644
--- a/fpdfsdk/pdfwindow/PWL_Edit.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp
@@ -13,6 +13,7 @@
#include "core/fxcrt/include/fx_safe_types.h"
#include "core/fxcrt/include/fx_xml.h"
#include "core/fxge/include/fx_ge.h"
+#include "fpdfsdk/fxedit/include/fxet_edit.h"
#include "fpdfsdk/pdfwindow/PWL_Caret.h"
#include "fpdfsdk/pdfwindow/PWL_EditCtrl.h"
#include "fpdfsdk/pdfwindow/PWL_FontMap.h"
@@ -258,7 +259,7 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
CPVT_WordRange wrTemp =
CPWL_Utils::OverlapWordRange(GetSelectWordRange(), wrVisible);
CFX_ByteString sEditSel =
- CPWL_Utils::GetEditSelAppStream(m_pEdit, ptOffset, &wrTemp);
+ CPWL_Utils::GetEditSelAppStream(m_pEdit.get(), ptOffset, &wrTemp);
if (sEditSel.GetLength() > 0)
sText << CPWL_Utils::GetColorAppStream(PWL_DEFAULT_SELBACKCOLOR).AsStringC()
@@ -266,7 +267,7 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
wrTemp = CPWL_Utils::OverlapWordRange(wrVisible, wrSelBefore);
CFX_ByteString sEditBefore = CPWL_Utils::GetEditAppStream(
- m_pEdit, ptOffset, &wrTemp, !HasFlag(PES_CHARARRAY),
+ m_pEdit.get(), ptOffset, &wrTemp, !HasFlag(PES_CHARARRAY),
m_pEdit->GetPasswordChar());
if (sEditBefore.GetLength() > 0)
@@ -275,7 +276,7 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
wrTemp = CPWL_Utils::OverlapWordRange(wrVisible, wrSelect);
CFX_ByteString sEditMid = CPWL_Utils::GetEditAppStream(
- m_pEdit, ptOffset, &wrTemp, !HasFlag(PES_CHARARRAY),
+ m_pEdit.get(), ptOffset, &wrTemp, !HasFlag(PES_CHARARRAY),
m_pEdit->GetPasswordChar());
if (sEditMid.GetLength() > 0)
@@ -286,7 +287,7 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
wrTemp = CPWL_Utils::OverlapWordRange(wrVisible, wrSelAfter);
CFX_ByteString sEditAfter = CPWL_Utils::GetEditAppStream(
- m_pEdit, ptOffset, &wrTemp, !HasFlag(PES_CHARARRAY),
+ m_pEdit.get(), ptOffset, &wrTemp, !HasFlag(PES_CHARARRAY),
m_pEdit->GetPasswordChar());
if (sEditAfter.GetLength() > 0)
@@ -395,8 +396,8 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice,
pRange = &wrRange;
}
CFX_SystemHandler* pSysHandler = GetSystemHandler();
- IFX_Edit::DrawEdit(
- pDevice, pUser2Device, m_pEdit,
+ CFX_Edit::DrawEdit(
+ pDevice, pUser2Device, m_pEdit.get(),
CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()),
CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()),
rcClip, CFX_FloatPoint(0.0f, 0.0f), pRange, pSysHandler, m_pFormFiller);
@@ -490,7 +491,7 @@ void CPWL_Edit::SetLineLeading(FX_FLOAT fLineLeading,
CFX_ByteString CPWL_Edit::GetSelectAppearanceStream(
const CFX_FloatPoint& ptOffset) const {
CPVT_WordRange wr = GetSelectWordRange();
- return CPWL_Utils::GetEditSelAppStream(m_pEdit, ptOffset, &wr);
+ return CPWL_Utils::GetEditSelAppStream(m_pEdit.get(), ptOffset, &wr);
}
CPVT_WordRange CPWL_Edit::GetSelectWordRange() const {
@@ -512,7 +513,7 @@ CPVT_WordRange CPWL_Edit::GetSelectWordRange() const {
CFX_ByteString CPWL_Edit::GetTextAppearanceStream(
const CFX_FloatPoint& ptOffset) const {
CFX_ByteTextBuf sRet;
- CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit, ptOffset);
+ CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit.get(), ptOffset);
if (sEdit.GetLength() > 0) {
sRet << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC()
<< sEdit.AsStringC() << "ET\n";
@@ -532,7 +533,7 @@ CFX_FloatPoint CPWL_Edit::GetWordRightBottomPoint(
const CPVT_WordPlace& wpWord) {
CFX_FloatPoint pt(0.0f, 0.0f);
- IFX_Edit_Iterator* pIterator = m_pEdit->GetIterator();
+ CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator();
CPVT_WordPlace wpOld = pIterator->GetAt();
pIterator->SetAt(wpWord);
CPVT_Word word;
@@ -823,9 +824,6 @@ void CPWL_Edit::OnInsertWord(const CPVT_WordPlace& place,
}
}
-void CPWL_Edit::OnSetText(const CPVT_WordPlace& place,
- const CPVT_WordPlace& oldplace) {}
-
void CPWL_Edit::OnInsertText(const CPVT_WordPlace& place,
const CPVT_WordPlace& oldplace) {
if (HasFlag(PES_SPELLCHECK)) {
@@ -886,7 +884,7 @@ CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace& place,
FX_BOOL bArabic) const {
CPVT_WordRange range;
- IFX_Edit_Iterator* pIterator = m_pEdit->GetIterator();
+ CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator();
CPVT_Word wordinfo;
CPVT_WordPlace wpStart(place), wpEnd(place);
pIterator->SetAt(place);
@@ -937,8 +935,8 @@ void CPWL_Edit::GeneratePageObjects(
CPDF_PageObjectHolder* pObjectHolder,
const CFX_FloatPoint& ptOffset,
CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray) {
- IFX_Edit::GeneratePageObjects(
- pObjectHolder, m_pEdit, ptOffset, nullptr,
+ CFX_Edit::GeneratePageObjects(
+ pObjectHolder, m_pEdit.get(), ptOffset, nullptr,
CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()),
ObjArray);
}
@@ -946,8 +944,8 @@ void CPWL_Edit::GeneratePageObjects(
void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder,
const CFX_FloatPoint& ptOffset) {
CFX_ArrayTemplate<CPDF_TextObject*> ObjArray;
- IFX_Edit::GeneratePageObjects(
- pObjectHolder, m_pEdit, ptOffset, nullptr,
+ CFX_Edit::GeneratePageObjects(
+ pObjectHolder, m_pEdit.get(), ptOffset, nullptr,
CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()),
ObjArray);
}
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.h b/fpdfsdk/pdfwindow/PWL_Edit.h
index 8a9d371b28..e1518ef86c 100644
--- a/fpdfsdk/pdfwindow/PWL_Edit.h
+++ b/fpdfsdk/pdfwindow/PWL_Edit.h
@@ -12,6 +12,10 @@
#include "fpdfsdk/pdfwindow/PWL_EditCtrl.h"
#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
+class CPDF_PageObjectHolder;
+class CPDF_TextObject;
+class IFX_Edit_UndoItem;
+
class IPWL_Filler_Notify {
public:
virtual ~IPWL_Filler_Notify() {}
@@ -40,7 +44,7 @@ class IPWL_Filler_Notify {
#endif // PDF_ENABLE_XFA
};
-class CPWL_Edit : public CPWL_EditCtrl, public IFX_Edit_OprNotify {
+class CPWL_Edit : public CPWL_EditCtrl {
public:
CPWL_Edit();
~CPWL_Edit() override;
@@ -113,23 +117,16 @@ class CPWL_Edit : public CPWL_EditCtrl, public IFX_Edit_OprNotify {
FX_BOOL IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag);
void AttachFFLData(void* pData) { m_pFormFiller = pData; }
- protected:
- // IFX_Edit_OprNotify
void OnInsertWord(const CPVT_WordPlace& place,
- const CPVT_WordPlace& oldplace) override;
+ const CPVT_WordPlace& oldplace);
void OnInsertReturn(const CPVT_WordPlace& place,
- const CPVT_WordPlace& oldplace) override;
- void OnBackSpace(const CPVT_WordPlace& place,
- const CPVT_WordPlace& oldplace) override;
- void OnDelete(const CPVT_WordPlace& place,
- const CPVT_WordPlace& oldplace) override;
- void OnClear(const CPVT_WordPlace& place,
- const CPVT_WordPlace& oldplace) override;
- void OnSetText(const CPVT_WordPlace& place,
- const CPVT_WordPlace& oldplace) override;
+ const CPVT_WordPlace& oldplace);
+ void OnBackSpace(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
+ void OnDelete(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
+ void OnClear(const CPVT_WordPlace& place, const CPVT_WordPlace& oldplace);
void OnInsertText(const CPVT_WordPlace& place,
- const CPVT_WordPlace& oldplace) override;
- void OnAddUndo(IFX_Edit_UndoItem* pUndoItem) override;
+ const CPVT_WordPlace& oldplace);
+ void OnAddUndo(IFX_Edit_UndoItem* pUndoItem);
private:
CPVT_WordRange GetSelectWordRange() const;
diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
index 4802c78fdb..dd1094a868 100644
--- a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
+++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
@@ -8,6 +8,7 @@
#include "core/fpdfdoc/include/cpvt_section.h"
#include "core/fpdfdoc/include/cpvt_word.h"
+#include "fpdfsdk/fxedit/include/fxet_edit.h"
#include "fpdfsdk/pdfwindow/PWL_Caret.h"
#include "fpdfsdk/pdfwindow/PWL_FontMap.h"
#include "fpdfsdk/pdfwindow/PWL_ScrollBar.h"
@@ -21,7 +22,7 @@
#define IsFloatEqual(fa, fb) IsFloatZero((fa) - (fb))
CPWL_EditCtrl::CPWL_EditCtrl()
- : m_pEdit(IFX_Edit::NewEdit()),
+ : m_pEdit(new CFX_Edit),
m_pEditCaret(nullptr),
m_bMouseDown(FALSE),
m_pEditNotify(nullptr),
@@ -29,7 +30,6 @@ CPWL_EditCtrl::CPWL_EditCtrl()
m_nCodePage(0) {}
CPWL_EditCtrl::~CPWL_EditCtrl() {
- IFX_Edit::DelEdit(m_pEdit);
}
void CPWL_EditCtrl::OnCreate(PWL_CREATEPARAM& cp) {
@@ -347,7 +347,7 @@ void CPWL_EditCtrl::SetEditCaret(FX_BOOL bVisible) {
void CPWL_EditCtrl::GetCaretInfo(CFX_FloatPoint& ptHead,
CFX_FloatPoint& ptFoot) const {
- IFX_Edit_Iterator* pIterator = m_pEdit->GetIterator();
+ CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator();
pIterator->SetAt(m_pEdit->GetCaret());
CPVT_Word word;
CPVT_Line line;
@@ -435,7 +435,7 @@ CFX_FloatPoint CPWL_EditCtrl::GetScrollPos() const {
CPDF_Font* CPWL_EditCtrl::GetCaretFont() const {
int32_t nFontIndex = 0;
- IFX_Edit_Iterator* pIterator = m_pEdit->GetIterator();
+ CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator();
pIterator->SetAt(m_pEdit->GetCaret());
CPVT_Word word;
CPVT_Section section;
@@ -456,7 +456,7 @@ CPDF_Font* CPWL_EditCtrl::GetCaretFont() const {
FX_FLOAT CPWL_EditCtrl::GetCaretFontSize() const {
FX_FLOAT fFontSize = GetFontSize();
- IFX_Edit_Iterator* pIterator = m_pEdit->GetIterator();
+ CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator();
pIterator->SetAt(m_pEdit->GetCaret());
CPVT_Word word;
CPVT_Section section;
diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.h b/fpdfsdk/pdfwindow/PWL_EditCtrl.h
index b21c480b7d..028c41bcfd 100644
--- a/fpdfsdk/pdfwindow/PWL_EditCtrl.h
+++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.h
@@ -11,12 +11,15 @@
#include "fpdfsdk/fxedit/include/fx_edit.h"
#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
+class CFX_Edit;
class CPWL_Caret;
class CPWL_Edit;
class CPWL_EditCtrl;
-class IFX_Edit;
class IPWL_Edit_Notify;
+struct CPVT_SecProps;
struct CPVT_WordPlace;
+struct CPVT_WordProps;
+struct CPVT_WordRange;
enum PWL_EDIT_ALIGNFORMAT_H { PEAH_LEFT = 0, PEAH_MIDDLE, PEAH_RIGHT };
@@ -52,7 +55,7 @@ class IPWL_Edit_Notify {
virtual void OnAddUndo(CPWL_Edit* pEdit) {}
};
-class CPWL_EditCtrl : public CPWL_Wnd, public IFX_Edit_Notify {
+class CPWL_EditCtrl : public CPWL_Wnd {
friend class CPWL_Edit_Notify;
public:
@@ -118,29 +121,23 @@ class CPWL_EditCtrl : public CPWL_Wnd, public IFX_Edit_Notify {
FX_FLOAT GetFontSize() const override;
void SetCursor() override;
- protected:
- // IFX_Edit_Notify
- void IOnSetScrollInfoX(FX_FLOAT fPlateMin,
- FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin,
- FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep,
- FX_FLOAT fBigStep) override {}
void IOnSetScrollInfoY(FX_FLOAT fPlateMin,
FX_FLOAT fPlateMax,
FX_FLOAT fContentMin,
FX_FLOAT fContentMax,
FX_FLOAT fSmallStep,
- FX_FLOAT fBigStep) override;
- void IOnSetScrollPosX(FX_FLOAT fx) override {}
- void IOnSetScrollPosY(FX_FLOAT fy) override;
+ FX_FLOAT fBigStep);
+ void IOnSetScrollPosY(FX_FLOAT fy);
void IOnSetCaret(FX_BOOL bVisible,
const CFX_FloatPoint& ptHead,
const CFX_FloatPoint& ptFoot,
- const CPVT_WordPlace& place) override;
- void IOnContentChange(const CFX_FloatRect& rcContent) override;
- void IOnInvalidateRect(CFX_FloatRect* pRect) override;
+ const CPVT_WordPlace& place);
+ void IOnCaretChange(const CPVT_SecProps& secProps,
+ const CPVT_WordProps& wordProps);
+ void IOnContentChange(const CFX_FloatRect& rcContent);
+ void IOnInvalidateRect(CFX_FloatRect* pRect);
+ protected:
void InsertText(const FX_WCHAR* csText);
void SetText(const FX_WCHAR* csText);
void CopyText();
@@ -162,16 +159,14 @@ class CPWL_EditCtrl : public CPWL_Wnd, public IFX_Edit_Notify {
void SetEditCaret(FX_BOOL bVisible);
- private:
- void CreateEditCaret(const PWL_CREATEPARAM& cp);
-
- protected:
- IFX_Edit* m_pEdit;
+ std::unique_ptr<CFX_Edit> m_pEdit;
CPWL_Caret* m_pEditCaret;
FX_BOOL m_bMouseDown;
IPWL_Edit_Notify* m_pEditNotify;
private:
+ void CreateEditCaret(const PWL_CREATEPARAM& cp);
+
int32_t m_nCharSet;
int32_t m_nCodePage;
};
diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
index 84d2614804..e8c1f82bde 100644
--- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp
+++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
@@ -6,6 +6,8 @@
#include "fpdfsdk/pdfwindow/PWL_ListBox.h"
+#include "fpdfsdk/fxedit/include/fxet_edit.h"
+#include "fpdfsdk/fxedit/include/fxet_list.h"
#include "fpdfsdk/pdfwindow/PWL_Edit.h"
#include "fpdfsdk/pdfwindow/PWL_EditCtrl.h"
#include "fpdfsdk/pdfwindow/PWL_ScrollBar.h"
@@ -65,18 +67,12 @@ void CPWL_List_Notify::IOnInvalidateRect(CFX_FloatRect* pRect) {
}
CPWL_ListBox::CPWL_ListBox()
- : m_pList(nullptr),
- m_pListNotify(nullptr),
+ : m_pList(new CFX_ListCtrl),
m_bMouseDown(FALSE),
m_bHoverSel(FALSE),
- m_pFillerNotify(nullptr) {
- m_pList = IFX_List::NewList();
-}
+ m_pFillerNotify(nullptr) {}
CPWL_ListBox::~CPWL_ListBox() {
- IFX_List::DelList(m_pList);
- delete m_pListNotify;
- m_pListNotify = nullptr;
}
CFX_ByteString CPWL_ListBox::GetClassName() const {
@@ -85,10 +81,9 @@ CFX_ByteString CPWL_ListBox::GetClassName() const {
void CPWL_ListBox::OnCreated() {
if (m_pList) {
- delete m_pListNotify;
-
m_pList->SetFontMap(GetFontMap());
- m_pList->SetNotify(m_pListNotify = new CPWL_List_Notify(this));
+ m_pListNotify.reset(new CPWL_List_Notify(this));
+ m_pList->SetNotify(m_pListNotify.get());
SetHoverSel(HasFlag(PLBS_HOVERSEL));
m_pList->SetMultipleSel(HasFlag(PLBS_MULTIPLESEL));
@@ -99,8 +94,7 @@ void CPWL_ListBox::OnCreated() {
}
void CPWL_ListBox::OnDestroy() {
- delete m_pListNotify;
- m_pListNotify = nullptr;
+ m_pListNotify.reset();
}
void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
@@ -172,7 +166,7 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice,
continue;
CFX_FloatPoint ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f);
- if (IFX_Edit* pEdit = m_pList->GetItemEdit(i)) {
+ if (CFX_Edit* pEdit = m_pList->GetItemEdit(i)) {
CFX_FloatRect rcContent = pEdit->GetContentRect();
if (rcContent.Width() > rcClient.Width())
rcItem.Intersect(rcList);
@@ -183,7 +177,7 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice,
if (m_pList->IsItemSelected(i)) {
CFX_SystemHandler* pSysHandler = GetSystemHandler();
if (pSysHandler && pSysHandler->IsSelectionImplemented()) {
- IFX_Edit::DrawEdit(
+ CFX_Edit::DrawEdit(
pDevice, pUser2Device, m_pList->GetItemEdit(i),
CPWL_Utils::PWLColorToFXColor(GetTextColor()),
CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()), rcList,
@@ -192,13 +186,13 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice,
} else {
CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcItem,
ArgbEncode(255, 0, 51, 113));
- IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
+ CFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
ArgbEncode(255, 255, 255, 255), 0, rcList,
ptOffset, nullptr, pSysHandler, m_pFormFiller);
}
} else {
CFX_SystemHandler* pSysHandler = GetSystemHandler();
- IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
+ CFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
CPWL_Utils::PWLColorToFXColor(GetTextColor()),
CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()),
rcList, ptOffset, nullptr, pSysHandler, nullptr);
diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.h b/fpdfsdk/pdfwindow/PWL_ListBox.h
index eea0862a8b..91ab7f768f 100644
--- a/fpdfsdk/pdfwindow/PWL_ListBox.h
+++ b/fpdfsdk/pdfwindow/PWL_ListBox.h
@@ -10,31 +10,27 @@
#include "fpdfsdk/fxedit/include/fx_edit.h"
#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
+class CFX_ListCtrl;
class CPWL_List_Notify;
class CPWL_ListBox;
class IPWL_Filler_Notify;
+struct CPVT_SecProps;
+struct CPVT_WordPlace;
+struct CPVT_WordProps;
-class CPWL_List_Notify : public IFX_List_Notify {
+class CPWL_List_Notify {
public:
CPWL_List_Notify(CPWL_ListBox* pList);
- ~CPWL_List_Notify() override;
+ ~CPWL_List_Notify();
- // IFX_List_Notify
- void IOnSetScrollInfoX(FX_FLOAT fPlateMin,
- FX_FLOAT fPlateMax,
- FX_FLOAT fContentMin,
- FX_FLOAT fContentMax,
- FX_FLOAT fSmallStep,
- FX_FLOAT fBigStep) override {}
void IOnSetScrollInfoY(FX_FLOAT fPlateMin,
FX_FLOAT fPlateMax,
FX_FLOAT fContentMin,
FX_FLOAT fContentMax,
FX_FLOAT fSmallStep,
- FX_FLOAT fBigStep) override;
- void IOnSetScrollPosX(FX_FLOAT fx) override {}
- void IOnSetScrollPosY(FX_FLOAT fy) override;
- void IOnInvalidateRect(CFX_FloatRect* pRect) override;
+ FX_FLOAT fBigStep);
+ void IOnSetScrollPosY(FX_FLOAT fy);
+ void IOnInvalidateRect(CFX_FloatRect* pRect);
void IOnSetCaret(FX_BOOL bVisible,
const CFX_FloatPoint& ptHead,
@@ -104,8 +100,8 @@ class CPWL_ListBox : public CPWL_Wnd {
}
protected:
- IFX_List* m_pList;
- CPWL_List_Notify* m_pListNotify;
+ std::unique_ptr<CFX_ListCtrl> m_pList;
+ std::unique_ptr<CPWL_List_Notify> m_pListNotify;
FX_BOOL m_bMouseDown;
FX_BOOL m_bHoverSel;
IPWL_Filler_Notify* m_pFillerNotify;
diff --git a/fpdfsdk/pdfwindow/PWL_Utils.cpp b/fpdfsdk/pdfwindow/PWL_Utils.cpp
index f5d30b2d14..c8b2239a36 100644
--- a/fpdfsdk/pdfwindow/PWL_Utils.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Utils.cpp
@@ -10,7 +10,7 @@
#include "core/fpdfdoc/include/cpvt_word.h"
#include "core/fxge/include/fx_ge.h"
-#include "fpdfsdk/fxedit/include/fx_edit.h"
+#include "fpdfsdk/fxedit/include/fxet_edit.h"
#include "fpdfsdk/pdfwindow/PWL_Icon.h"
#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
@@ -412,19 +412,19 @@ CFX_FloatRect CPWL_Utils::GetCenterSquare(const CFX_FloatRect& rect) {
fCenterX + fRadius, fCenterY + fRadius);
}
-CFX_ByteString CPWL_Utils::GetEditAppStream(IFX_Edit* pEdit,
+CFX_ByteString CPWL_Utils::GetEditAppStream(CFX_Edit* pEdit,
const CFX_FloatPoint& ptOffset,
const CPVT_WordRange* pRange,
FX_BOOL bContinuous,
uint16_t SubWord) {
- return IFX_Edit::GetEditAppearanceStream(pEdit, ptOffset, pRange, bContinuous,
+ return CFX_Edit::GetEditAppearanceStream(pEdit, ptOffset, pRange, bContinuous,
SubWord);
}
-CFX_ByteString CPWL_Utils::GetEditSelAppStream(IFX_Edit* pEdit,
+CFX_ByteString CPWL_Utils::GetEditSelAppStream(CFX_Edit* pEdit,
const CFX_FloatPoint& ptOffset,
const CPVT_WordRange* pRange) {
- return IFX_Edit::GetSelectAppearanceStream(pEdit, ptOffset, pRange);
+ return CFX_Edit::GetSelectAppearanceStream(pEdit, ptOffset, pRange);
}
CFX_ByteString CPWL_Utils::GetTextAppStream(const CFX_FloatRect& rcBBox,
@@ -438,7 +438,7 @@ CFX_ByteString CPWL_Utils::GetTextAppStream(const CFX_FloatRect& rcBBox,
const CPWL_Color& crText) {
CFX_ByteTextBuf sRet;
- IFX_Edit* pEdit = IFX_Edit::NewEdit();
+ std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit);
pEdit->SetFontMap(pFontMap);
pEdit->SetPlateRect(rcBBox);
pEdit->SetAlignmentH(nAlignmentH);
@@ -454,10 +454,9 @@ CFX_ByteString CPWL_Utils::GetTextAppStream(const CFX_FloatRect& rcBBox,
pEdit->SetText(sText.c_str());
CFX_ByteString sEdit =
- CPWL_Utils::GetEditAppStream(pEdit, CFX_FloatPoint(0.0f, 0.0f));
+ CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint(0.0f, 0.0f));
if (sEdit.GetLength() > 0)
sRet << "BT\n" << CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n";
- IFX_Edit::DelEdit(pEdit);
return sRet.MakeString();
}
@@ -472,7 +471,7 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
int32_t nLayOut) {
const FX_FLOAT fAutoFontScale = 1.0f / 3.0f;
- IFX_Edit* pEdit = IFX_Edit::NewEdit();
+ std::unique_ptr<CFX_Edit> pEdit(new CFX_Edit);
pEdit->SetFontMap(pFontMap);
pEdit->SetAlignmentH(1);
pEdit->SetAlignmentV(1);
@@ -667,14 +666,13 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox,
if (!rcLabel.IsEmpty()) {
pEdit->SetPlateRect(rcLabel);
CFX_ByteString sEdit =
- CPWL_Utils::GetEditAppStream(pEdit, CFX_FloatPoint(0.0f, 0.0f));
+ CPWL_Utils::GetEditAppStream(pEdit.get(), CFX_FloatPoint(0.0f, 0.0f));
if (sEdit.GetLength() > 0) {
sTemp << "BT\n"
<< CPWL_Utils::GetColorAppStream(crText) << sEdit << "ET\n";
}
}
- IFX_Edit::DelEdit(pEdit);
if (sTemp.GetSize() > 0) {
sAppStream << "q\n"
<< rcBBox.left << " " << rcBBox.bottom << " "
diff --git a/fpdfsdk/pdfwindow/PWL_Utils.h b/fpdfsdk/pdfwindow/PWL_Utils.h
index db79cf77e2..c3acc59918 100644
--- a/fpdfsdk/pdfwindow/PWL_Utils.h
+++ b/fpdfsdk/pdfwindow/PWL_Utils.h
@@ -10,8 +10,8 @@
#include "core/fpdfdoc/include/cpvt_wordrange.h"
#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
+class CFX_Edit;
class CFX_PathData;
-class IFX_Edit;
struct CPWL_Color;
@@ -166,13 +166,13 @@ class CPWL_Utils {
int32_t nStyle,
const CPWL_Color& crText);
- static CFX_ByteString GetEditAppStream(IFX_Edit* pEdit,
+ static CFX_ByteString GetEditAppStream(CFX_Edit* pEdit,
const CFX_FloatPoint& ptOffset,
const CPVT_WordRange* pRange = nullptr,
FX_BOOL bContinuous = TRUE,
uint16_t SubWord = 0);
static CFX_ByteString GetEditSelAppStream(
- IFX_Edit* pEdit,
+ CFX_Edit* pEdit,
const CFX_FloatPoint& ptOffset,
const CPVT_WordRange* pRange = nullptr);
static CFX_ByteString GetTextAppStream(const CFX_FloatRect& rcBBox,