summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xfa/fde/cfde_txtedtengine.cpp34
-rw-r--r--xfa/fwl/cfwl_edit.cpp18
-rw-r--r--xfa/fwl/cfwl_edit.h2
3 files changed, 21 insertions, 33 deletions
diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp
index 38e43df257..e3815e7de4 100644
--- a/xfa/fde/cfde_txtedtengine.cpp
+++ b/xfa/fde/cfde_txtedtengine.cpp
@@ -595,7 +595,9 @@ void CFDE_TxtEdtEngine::Inner_Insert(int32_t nStart,
ASSERT(nLength > 0);
FDE_TXTEDTPARAGPOS ParagPos;
TextPos2ParagPos(nStart, ParagPos);
- m_Param.pEventSink->OnPageUnload(m_nCaretPage);
+
+ GetPage(m_nCaretPage)->UnloadPage();
+
int32_t nParagCount = pdfium::CollectionSize<int32_t>(m_ParagPtrArray);
for (int32_t i = ParagPos.nParagIndex + 1; i < nParagCount; i++)
m_ParagPtrArray[i]->IncrementStartIndex(nLength);
@@ -649,7 +651,8 @@ void CFDE_TxtEdtEngine::Inner_Insert(int32_t nStart,
nTotalLineCount += pParag->GetLineCount();
}
m_nLineCount += nTotalLineCount - nReserveLineCount;
- m_Param.pEventSink->OnPageLoad(m_nCaretPage);
+
+ GetPage(m_nCaretPage)->LoadPage();
UpdatePages();
}
@@ -659,7 +662,9 @@ void CFDE_TxtEdtEngine::Inner_DeleteRange(int32_t nStart, int32_t nCount) {
}
int32_t nEnd = nStart + nCount - 1;
ASSERT(nStart >= 0 && nEnd < m_pTxtBuf->GetTextLength());
- m_Param.pEventSink->OnPageUnload(m_nCaretPage);
+
+ GetPage(m_nCaretPage)->UnloadPage();
+
FDE_TXTEDTPARAGPOS ParagPosBgn, ParagPosEnd;
TextPos2ParagPos(nStart, ParagPosBgn);
TextPos2ParagPos(nEnd, ParagPosEnd);
@@ -705,7 +710,8 @@ void CFDE_TxtEdtEngine::Inner_DeleteRange(int32_t nStart, int32_t nCount) {
if (m_nCaretPage >= nPageCount) {
m_nCaretPage = nPageCount - 1;
}
- m_Param.pEventSink->OnPageLoad(m_nCaretPage);
+
+ GetPage(m_nCaret)->LoadPage();
}
void CFDE_TxtEdtEngine::DeleteRange_DoRecord(int32_t nStart,
@@ -927,15 +933,16 @@ int32_t CFDE_TxtEdtEngine::MovePage2Char(int32_t nIndex) {
ASSERT(nIndex <= m_pTxtBuf->GetTextLength());
if (m_nCaretPage >= 0) {
CFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage].get();
- m_Param.pEventSink->OnPageLoad(m_nCaretPage);
+ pPage->LoadPage();
+
int32_t nPageCharStart = pPage->GetCharStart();
int32_t nPageCharCount = pPage->GetCharCount();
- if (nIndex >= nPageCharStart && nIndex < nPageCharStart + nPageCharCount) {
- m_Param.pEventSink->OnPageUnload(m_nCaretPage);
+
+ pPage->UnloadPage();
+ if (nIndex >= nPageCharStart && nIndex < nPageCharStart + nPageCharCount)
return m_nCaretPage;
- }
- m_Param.pEventSink->OnPageUnload(m_nCaretPage);
}
+
CFDE_TxtEdtParag* pParag = nullptr;
int32_t nLineCount = 0;
int32_t nParagCount = pdfium::CollectionSize<int32_t>(m_ParagPtrArray);
@@ -1172,7 +1179,7 @@ void CFDE_TxtEdtEngine::GetCaretRect(CFX_RectF& rtCaret,
int32_t nCaret,
bool bBefore) {
CFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage].get();
- m_Param.pEventSink->OnPageLoad(m_nCaretPage);
+ pPage->LoadPage();
bool bCombText = !!(m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_CombText);
int32_t nIndexInpage = nCaret - pPage->GetCharStart();
@@ -1190,12 +1197,13 @@ void CFDE_TxtEdtEngine::GetCaretRect(CFX_RectF& rtCaret,
rtCaret.width = 1.0f;
- m_Param.pEventSink->OnPageUnload(m_nCaretPage);
+ GetPage(m_nCaretPage)->UnloadPage();
}
void CFDE_TxtEdtEngine::UpdateCaretIndex(const CFX_PointF& ptCaret) {
CFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage].get();
- m_Param.pEventSink->OnPageLoad(m_nCaretPage);
+ pPage->LoadPage();
+
m_nCaret = pPage->GetCharIndex(ptCaret, m_bBefore);
GetCaretRect(m_rtCaret, m_nCaretPage, m_nCaret, m_bBefore);
if (!m_bBefore) {
@@ -1203,7 +1211,7 @@ void CFDE_TxtEdtEngine::UpdateCaretIndex(const CFX_PointF& ptCaret) {
m_bBefore = true;
}
m_Param.pEventSink->OnCaretChanged();
- m_Param.pEventSink->OnPageUnload(m_nCaretPage);
+ GetPage(m_nCaretPage)->UnloadPage();
}
void CFDE_TxtEdtEngine::DeleteSelect() {
diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp
index 6e56ab2485..5ec9378f09 100644
--- a/xfa/fwl/cfwl_edit.cpp
+++ b/xfa/fwl/cfwl_edit.cpp
@@ -425,24 +425,6 @@ void CFWL_Edit::OnSelChanged() {
RepaintRect(GetClientRect());
}
-bool CFWL_Edit::OnPageLoad(int32_t nPageIndex) {
- CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(nPageIndex);
- if (!pPage)
- return false;
-
- pPage->LoadPage();
- return true;
-}
-
-bool CFWL_Edit::OnPageUnload(int32_t nPageIndex) {
- CFDE_TxtEdtPage* pPage = m_EdtEngine.GetPage(nPageIndex);
- if (!pPage)
- return false;
-
- pPage->UnloadPage();
- return true;
-}
-
void CFWL_Edit::OnAddDoRecord(std::unique_ptr<IFDE_TxtEdtDoRecord> pRecord) {
AddDoRecord(std::move(pRecord));
}
diff --git a/xfa/fwl/cfwl_edit.h b/xfa/fwl/cfwl_edit.h
index c0583cd7af..4a30904b0a 100644
--- a/xfa/fwl/cfwl_edit.h
+++ b/xfa/fwl/cfwl_edit.h
@@ -94,8 +94,6 @@ class CFWL_Edit : public CFWL_Widget {
void OnCaretChanged();
void OnTextChanged(const CFX_WideString& prevText);
void OnSelChanged();
- bool OnPageLoad(int32_t nPageIndex);
- bool OnPageUnload(int32_t nPageIndex);
void OnAddDoRecord(std::unique_ptr<IFDE_TxtEdtDoRecord> pRecord);
bool OnValidate(const CFX_WideString& wsText);
void SetScrollOffset(float fScrollOffset);