summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpdfsdk/pwl/cpwl_edit_impl.cpp74
-rw-r--r--fpdfsdk/pwl/cpwl_edit_impl.h27
2 files changed, 26 insertions, 75 deletions
diff --git a/fpdfsdk/pwl/cpwl_edit_impl.cpp b/fpdfsdk/pwl/cpwl_edit_impl.cpp
index 7da5cddc4a..7ed38f1ce2 100644
--- a/fpdfsdk/pwl/cpwl_edit_impl.cpp
+++ b/fpdfsdk/pwl/cpwl_edit_impl.cpp
@@ -265,17 +265,13 @@ CFXEU_InsertWord::CFXEU_InsertWord(CPWL_EditImpl* pEdit,
const CPVT_WordPlace& wpOldPlace,
const CPVT_WordPlace& wpNewPlace,
uint16_t word,
- int32_t charset,
- const CPVT_WordProps* pWordProps)
+ int32_t charset)
: m_pEdit(pEdit),
m_wpOld(wpOldPlace),
m_wpNew(wpNewPlace),
m_Word(word),
- m_nCharset(charset),
- m_WordProps() {
+ m_nCharset(charset) {
ASSERT(m_pEdit);
- if (pWordProps)
- m_WordProps = *pWordProps;
}
CFXEU_InsertWord::~CFXEU_InsertWord() {}
@@ -283,7 +279,7 @@ CFXEU_InsertWord::~CFXEU_InsertWord() {}
void CFXEU_InsertWord::Redo() {
m_pEdit->SelectNone();
m_pEdit->SetCaret(m_wpOld);
- m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, false, true);
+ m_pEdit->InsertWord(m_Word, m_nCharset, false, true);
}
void CFXEU_InsertWord::Undo() {
@@ -294,19 +290,9 @@ void CFXEU_InsertWord::Undo() {
CFXEU_InsertReturn::CFXEU_InsertReturn(CPWL_EditImpl* pEdit,
const CPVT_WordPlace& wpOldPlace,
- const CPVT_WordPlace& wpNewPlace,
- const CPVT_SecProps* pSecProps,
- const CPVT_WordProps* pWordProps)
- : m_pEdit(pEdit),
- m_wpOld(wpOldPlace),
- m_wpNew(wpNewPlace),
- m_SecProps(),
- m_WordProps() {
+ const CPVT_WordPlace& wpNewPlace)
+ : m_pEdit(pEdit), m_wpOld(wpOldPlace), m_wpNew(wpNewPlace) {
ASSERT(m_pEdit);
- if (pSecProps)
- m_SecProps = *pSecProps;
- if (pWordProps)
- m_WordProps = *pWordProps;
}
CFXEU_InsertReturn::~CFXEU_InsertReturn() {}
@@ -314,7 +300,7 @@ CFXEU_InsertReturn::~CFXEU_InsertReturn() {}
void CFXEU_InsertReturn::Redo() {
m_pEdit->SelectNone();
m_pEdit->SetCaret(m_wpOld);
- m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, false, true);
+ m_pEdit->InsertReturn(false, true);
}
void CFXEU_InsertReturn::Undo() {
@@ -327,16 +313,12 @@ CFXEU_Backspace::CFXEU_Backspace(CPWL_EditImpl* pEdit,
const CPVT_WordPlace& wpOldPlace,
const CPVT_WordPlace& wpNewPlace,
uint16_t word,
- int32_t charset,
- const CPVT_SecProps& SecProps,
- const CPVT_WordProps& WordProps)
+ int32_t charset)
: m_pEdit(pEdit),
m_wpOld(wpOldPlace),
m_wpNew(wpNewPlace),
m_Word(word),
- m_nCharset(charset),
- m_SecProps(SecProps),
- m_WordProps(WordProps) {
+ m_nCharset(charset) {
ASSERT(m_pEdit);
}
@@ -352,9 +334,9 @@ void CFXEU_Backspace::Undo() {
m_pEdit->SelectNone();
m_pEdit->SetCaret(m_wpNew);
if (m_wpNew.nSecIndex != m_wpOld.nSecIndex)
- m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, false, true);
+ m_pEdit->InsertReturn(false, true);
else
- m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, false, true);
+ m_pEdit->InsertWord(m_Word, m_nCharset, false, true);
}
CFXEU_Delete::CFXEU_Delete(CPWL_EditImpl* pEdit,
@@ -362,16 +344,12 @@ CFXEU_Delete::CFXEU_Delete(CPWL_EditImpl* pEdit,
const CPVT_WordPlace& wpNewPlace,
uint16_t word,
int32_t charset,
- const CPVT_SecProps& SecProps,
- const CPVT_WordProps& WordProps,
bool bSecEnd)
: m_pEdit(pEdit),
m_wpOld(wpOldPlace),
m_wpNew(wpNewPlace),
m_Word(word),
m_nCharset(charset),
- m_SecProps(SecProps),
- m_WordProps(WordProps),
m_bSecEnd(bSecEnd) {
ASSERT(m_pEdit);
}
@@ -388,9 +366,9 @@ void CFXEU_Delete::Undo() {
m_pEdit->SelectNone();
m_pEdit->SetCaret(m_wpNew);
if (m_bSecEnd)
- m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, false, true);
+ m_pEdit->InsertReturn(false, true);
else
- m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, false, true);
+ m_pEdit->InsertWord(m_Word, m_nCharset, false, true);
}
CFXEU_Clear::CFXEU_Clear(CPWL_EditImpl* pEdit,
@@ -810,11 +788,11 @@ void CPWL_EditImpl::SetText(const WideString& sText) {
}
bool CPWL_EditImpl::InsertWord(uint16_t word, int32_t charset) {
- return InsertWord(word, charset, nullptr, true, true);
+ return InsertWord(word, charset, true, true);
}
bool CPWL_EditImpl::InsertReturn() {
- return InsertReturn(nullptr, nullptr, true, true);
+ return InsertReturn(true, true);
}
bool CPWL_EditImpl::Backspace() {
@@ -1528,7 +1506,6 @@ void CPWL_EditImpl::OnVK_END(bool bShift, bool bCtrl) {
bool CPWL_EditImpl::InsertWord(uint16_t word,
int32_t charset,
- const CPVT_WordProps* pWordProps,
bool bAddUndo,
bool bPaint) {
if (IsTextOverflow() || !m_pVT->IsValid())
@@ -1543,7 +1520,7 @@ bool CPWL_EditImpl::InsertWord(uint16_t word,
if (bAddUndo && m_bEnableUndo) {
AddEditUndoItem(pdfium::MakeUnique<CFXEU_InsertWord>(
- this, m_wpOldCaret, m_wpCaret, word, charset, pWordProps));
+ this, m_wpOldCaret, m_wpCaret, word, charset));
}
if (bPaint)
PaintInsertText(m_wpOldCaret, m_wpCaret);
@@ -1554,10 +1531,7 @@ bool CPWL_EditImpl::InsertWord(uint16_t word,
return true;
}
-bool CPWL_EditImpl::InsertReturn(const CPVT_SecProps* pSecProps,
- const CPVT_WordProps* pWordProps,
- bool bAddUndo,
- bool bPaint) {
+bool CPWL_EditImpl::InsertReturn(bool bAddUndo, bool bPaint) {
if (IsTextOverflow() || !m_pVT->IsValid())
return false;
@@ -1568,8 +1542,8 @@ bool CPWL_EditImpl::InsertReturn(const CPVT_SecProps* pSecProps,
return false;
if (bAddUndo && m_bEnableUndo) {
- AddEditUndoItem(pdfium::MakeUnique<CFXEU_InsertReturn>(
- this, m_wpOldCaret, m_wpCaret, pSecProps, pWordProps));
+ AddEditUndoItem(
+ pdfium::MakeUnique<CFXEU_InsertReturn>(this, m_wpOldCaret, m_wpCaret));
}
if (bPaint) {
RearrangePart(CPVT_WordRange(m_wpOldCaret, m_wpCaret));
@@ -1605,12 +1579,10 @@ bool CPWL_EditImpl::Backspace(bool bAddUndo, bool bPaint) {
if (bAddUndo && m_bEnableUndo) {
if (m_wpCaret.nSecIndex != m_wpOldCaret.nSecIndex) {
AddEditUndoItem(pdfium::MakeUnique<CFXEU_Backspace>(
- this, m_wpOldCaret, m_wpCaret, word.Word, word.nCharset,
- section.SecProps, section.WordProps));
+ this, m_wpOldCaret, m_wpCaret, word.Word, word.nCharset));
} else {
AddEditUndoItem(pdfium::MakeUnique<CFXEU_Backspace>(
- this, m_wpOldCaret, m_wpCaret, word.Word, word.nCharset,
- section.SecProps, word.WordProps));
+ this, m_wpOldCaret, m_wpCaret, word.Word, word.nCharset));
}
}
if (bPaint) {
@@ -1645,12 +1617,10 @@ bool CPWL_EditImpl::Delete(bool bAddUndo, bool bPaint) {
if (bAddUndo && m_bEnableUndo) {
if (bSecEnd) {
AddEditUndoItem(pdfium::MakeUnique<CFXEU_Delete>(
- this, m_wpOldCaret, m_wpCaret, word.Word, word.nCharset,
- section.SecProps, section.WordProps, bSecEnd));
+ this, m_wpOldCaret, m_wpCaret, word.Word, word.nCharset, bSecEnd));
} else {
AddEditUndoItem(pdfium::MakeUnique<CFXEU_Delete>(
- this, m_wpOldCaret, m_wpCaret, word.Word, word.nCharset,
- section.SecProps, word.WordProps, bSecEnd));
+ this, m_wpOldCaret, m_wpCaret, word.Word, word.nCharset, bSecEnd));
}
}
if (bPaint) {
diff --git a/fpdfsdk/pwl/cpwl_edit_impl.h b/fpdfsdk/pwl/cpwl_edit_impl.h
index 76f756eb1c..b7dc0327c5 100644
--- a/fpdfsdk/pwl/cpwl_edit_impl.h
+++ b/fpdfsdk/pwl/cpwl_edit_impl.h
@@ -11,7 +11,6 @@
#include <memory>
#include <vector>
-#include "core/fpdfdoc/cpvt_secprops.h"
#include "core/fpdfdoc/cpvt_wordprops.h"
#include "core/fxcrt/unowned_ptr.h"
@@ -135,8 +134,7 @@ class CFXEU_InsertWord : public IFX_Edit_UndoItem {
const CPVT_WordPlace& wpOldPlace,
const CPVT_WordPlace& wpNewPlace,
uint16_t word,
- int32_t charset,
- const CPVT_WordProps* pWordProps);
+ int32_t charset);
~CFXEU_InsertWord() override;
// IFX_Edit_UndoItem:
@@ -150,16 +148,13 @@ class CFXEU_InsertWord : public IFX_Edit_UndoItem {
CPVT_WordPlace m_wpNew;
uint16_t m_Word;
int32_t m_nCharset;
- CPVT_WordProps m_WordProps;
};
class CFXEU_InsertReturn : public IFX_Edit_UndoItem {
public:
CFXEU_InsertReturn(CPWL_EditImpl* pEdit,
const CPVT_WordPlace& wpOldPlace,
- const CPVT_WordPlace& wpNewPlace,
- const CPVT_SecProps* pSecProps,
- const CPVT_WordProps* pWordProps);
+ const CPVT_WordPlace& wpNewPlace);
~CFXEU_InsertReturn() override;
// IFX_Edit_UndoItem:
@@ -171,8 +166,6 @@ class CFXEU_InsertReturn : public IFX_Edit_UndoItem {
CPVT_WordPlace m_wpOld;
CPVT_WordPlace m_wpNew;
- CPVT_SecProps m_SecProps;
- CPVT_WordProps m_WordProps;
};
class CFXEU_Backspace : public IFX_Edit_UndoItem {
@@ -181,9 +174,7 @@ class CFXEU_Backspace : public IFX_Edit_UndoItem {
const CPVT_WordPlace& wpOldPlace,
const CPVT_WordPlace& wpNewPlace,
uint16_t word,
- int32_t charset,
- const CPVT_SecProps& SecProps,
- const CPVT_WordProps& WordProps);
+ int32_t charset);
~CFXEU_Backspace() override;
// IFX_Edit_UndoItem:
@@ -197,8 +188,6 @@ class CFXEU_Backspace : public IFX_Edit_UndoItem {
CPVT_WordPlace m_wpNew;
uint16_t m_Word;
int32_t m_nCharset;
- CPVT_SecProps m_SecProps;
- CPVT_WordProps m_WordProps;
};
class CFXEU_Delete : public IFX_Edit_UndoItem {
@@ -208,8 +197,6 @@ class CFXEU_Delete : public IFX_Edit_UndoItem {
const CPVT_WordPlace& wpNewPlace,
uint16_t word,
int32_t charset,
- const CPVT_SecProps& SecProps,
- const CPVT_WordProps& WordProps,
bool bSecEnd);
~CFXEU_Delete() override;
@@ -224,8 +211,6 @@ class CFXEU_Delete : public IFX_Edit_UndoItem {
CPVT_WordPlace m_wpNew;
uint16_t m_Word;
int32_t m_nCharset;
- CPVT_SecProps m_SecProps;
- CPVT_WordProps m_WordProps;
bool m_bSecEnd;
};
@@ -398,13 +383,9 @@ class CPWL_EditImpl {
bool InsertWord(uint16_t word,
int32_t charset,
- const CPVT_WordProps* pWordProps,
bool bAddUndo,
bool bPaint);
- bool InsertReturn(const CPVT_SecProps* pSecProps,
- const CPVT_WordProps* pWordProps,
- bool bAddUndo,
- bool bPaint);
+ bool InsertReturn(bool bAddUndo, bool bPaint);
bool Backspace(bool bAddUndo, bool bPaint);
bool Delete(bool bAddUndo, bool bPaint);
bool Clear(bool bAddUndo, bool bPaint);