summaryrefslogtreecommitdiff
path: root/fpdfsdk/fxedit
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-07-13 10:55:48 -0700
committerCommit bot <commit-bot@chromium.org>2016-07-13 10:55:49 -0700
commita2919b31197737d35e4e1df53b02f7ee7cb4cf5e (patch)
tree18cf18a9081ba48d35e218279d017a6be688f029 /fpdfsdk/fxedit
parent38506d3334fe114fb386ea9b719d432ff1760e42 (diff)
downloadpdfium-a2919b31197737d35e4e1df53b02f7ee7cb4cf5e.tar.xz
Remove RichText support from fpdfsdk/fxedit.
This CL removes the support code for RichText from fxedit as it is currently unused. Review-Url: https://codereview.chromium.org/2146503002
Diffstat (limited to 'fpdfsdk/fxedit')
-rw-r--r--fpdfsdk/fxedit/fxet_edit.cpp693
-rw-r--r--fpdfsdk/fxedit/fxet_pageobjs.cpp329
-rw-r--r--fpdfsdk/fxedit/include/fx_edit.h79
-rw-r--r--fpdfsdk/fxedit/include/fxet_edit.h116
4 files changed, 10 insertions, 1207 deletions
diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp
index 1a3289b26d..550dd1d78f 100644
--- a/fpdfsdk/fxedit/fxet_edit.cpp
+++ b/fpdfsdk/fxedit/fxet_edit.cpp
@@ -606,49 +606,6 @@ void CFXEU_Clear::Undo() {
}
}
-CFXEU_ClearRich::CFXEU_ClearRich(CFX_Edit* pEdit,
- const CPVT_WordPlace& wpOldPlace,
- const CPVT_WordPlace& wpNewPlace,
- const CPVT_WordRange& wrSel,
- uint16_t word,
- int32_t charset,
- const CPVT_SecProps& SecProps,
- const CPVT_WordProps& WordProps)
- : m_pEdit(pEdit),
- m_wpOld(wpOldPlace),
- m_wpNew(wpNewPlace),
- m_wrSel(wrSel),
- m_Word(word),
- m_nCharset(charset),
- m_SecProps(SecProps),
- m_WordProps(WordProps) {}
-
-CFXEU_ClearRich::~CFXEU_ClearRich() {}
-
-void CFXEU_ClearRich::Redo() {
- if (m_pEdit && IsLast()) {
- m_pEdit->SelectNone();
- m_pEdit->SetSel(m_wrSel.BeginPos, m_wrSel.EndPos);
- m_pEdit->Clear(FALSE, TRUE);
- }
-}
-
-void CFXEU_ClearRich::Undo() {
- if (m_pEdit) {
- m_pEdit->SelectNone();
- m_pEdit->SetCaret(m_wpOld);
- if (m_wpNew.SecCmp(m_wpOld) != 0) {
- m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, FALSE, FALSE);
- } else {
- m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, FALSE, FALSE);
- }
-
- if (IsFirst()) {
- m_pEdit->PaintInsertText(m_wrSel.BeginPos, m_wrSel.EndPos);
- m_pEdit->SetSel(m_wrSel.BeginPos, m_wrSel.EndPos);
- }
- }
-}
CFXEU_InsertText::CFXEU_InsertText(CFX_Edit* pEdit,
const CPVT_WordPlace& wpOldPlace,
const CPVT_WordPlace& wpNewPlace,
@@ -688,88 +645,6 @@ void CFXEU_InsertText::Undo() {
}
}
-CFXEU_SetSecProps::CFXEU_SetSecProps(CFX_Edit* pEdit,
- const CPVT_WordPlace& place,
- EDIT_PROPS_E ep,
- const CPVT_SecProps& oldsecprops,
- const CPVT_WordProps& oldwordprops,
- const CPVT_SecProps& newsecprops,
- const CPVT_WordProps& newwordprops,
- const CPVT_WordRange& range)
- : m_pEdit(pEdit),
- m_wpPlace(place),
- m_wrPlace(range),
- m_eProps(ep),
- m_OldSecProps(oldsecprops),
- m_NewSecProps(newsecprops),
- m_OldWordProps(oldwordprops),
- m_NewWordProps(newwordprops) {}
-
-CFXEU_SetSecProps::~CFXEU_SetSecProps() {}
-
-void CFXEU_SetSecProps::Redo() {
- if (m_pEdit) {
- m_pEdit->SetSecProps(m_eProps, m_wpPlace, &m_NewSecProps, &m_NewWordProps,
- m_wrPlace, FALSE);
- if (IsLast()) {
- m_pEdit->SelectNone();
- m_pEdit->PaintSetProps(m_eProps, m_wrPlace);
- m_pEdit->SetSel(m_wrPlace.BeginPos, m_wrPlace.EndPos);
- }
- }
-}
-
-void CFXEU_SetSecProps::Undo() {
- if (m_pEdit) {
- m_pEdit->SetSecProps(m_eProps, m_wpPlace, &m_OldSecProps, &m_OldWordProps,
- m_wrPlace, FALSE);
- if (IsFirst()) {
- m_pEdit->SelectNone();
- m_pEdit->PaintSetProps(m_eProps, m_wrPlace);
- m_pEdit->SetSel(m_wrPlace.BeginPos, m_wrPlace.EndPos);
- }
- }
-}
-
-CFXEU_SetWordProps::CFXEU_SetWordProps(CFX_Edit* pEdit,
- const CPVT_WordPlace& place,
- EDIT_PROPS_E ep,
- const CPVT_WordProps& oldprops,
- const CPVT_WordProps& newprops,
- const CPVT_WordRange& range)
- : m_pEdit(pEdit),
- m_wpPlace(place),
- m_wrPlace(range),
- m_eProps(ep),
- m_OldWordProps(oldprops),
- m_NewWordProps(newprops) {}
-
-CFXEU_SetWordProps::~CFXEU_SetWordProps() {}
-
-void CFXEU_SetWordProps::Redo() {
- if (m_pEdit) {
- m_pEdit->SetWordProps(m_eProps, m_wpPlace, &m_NewWordProps, m_wrPlace,
- FALSE);
- if (IsLast()) {
- m_pEdit->SelectNone();
- m_pEdit->PaintSetProps(m_eProps, m_wrPlace);
- m_pEdit->SetSel(m_wrPlace.BeginPos, m_wrPlace.EndPos);
- }
- }
-}
-
-void CFXEU_SetWordProps::Undo() {
- if (m_pEdit) {
- m_pEdit->SetWordProps(m_eProps, m_wpPlace, &m_OldWordProps, m_wrPlace,
- FALSE);
- if (IsFirst()) {
- m_pEdit->SelectNone();
- m_pEdit->PaintSetProps(m_eProps, m_wrPlace);
- m_pEdit->SetSel(m_wrPlace.BeginPos, m_wrPlace.EndPos);
- }
- }
-}
-
CFX_Edit::CFX_Edit(CPDF_VariableText* pVT)
: m_pVT(pVT),
m_pNotify(nullptr),
@@ -788,7 +663,6 @@ CFX_Edit::CFX_Edit(CPDF_VariableText* pVT)
m_bEnableRefresh(TRUE),
m_rcOldContent(0.0f, 0.0f, 0.0f, 0.0f),
m_bEnableUndo(TRUE),
- m_bNotify(TRUE),
m_bOprNotify(FALSE),
m_pGroupUndoItem(nullptr) {
ASSERT(pVT);
@@ -1090,481 +964,6 @@ CPVT_WordRange CFX_Edit::CombineWordRange(const CPVT_WordRange& wr1,
return wrRet;
}
-FX_BOOL CFX_Edit::IsRichText() const {
- return m_pVT->IsRichText();
-}
-
-void CFX_Edit::SetRichText(FX_BOOL bRichText, FX_BOOL bPaint) {
- m_pVT->SetRichText(bRichText);
- if (bPaint)
- Paint();
-}
-
-FX_BOOL CFX_Edit::SetRichFontIndex(int32_t nFontIndex) {
- CPVT_WordProps WordProps;
- WordProps.nFontIndex = nFontIndex;
- return SetRichTextProps(EP_FONTINDEX, nullptr, &WordProps);
-}
-
-FX_BOOL CFX_Edit::SetRichFontSize(FX_FLOAT fFontSize) {
- CPVT_WordProps WordProps;
- WordProps.fFontSize = fFontSize;
- return SetRichTextProps(EP_FONTSIZE, nullptr, &WordProps);
-}
-
-FX_BOOL CFX_Edit::SetRichTextColor(FX_COLORREF dwColor) {
- CPVT_WordProps WordProps;
- WordProps.dwWordColor = dwColor;
- return SetRichTextProps(EP_WORDCOLOR, nullptr, &WordProps);
-}
-
-FX_BOOL CFX_Edit::SetRichTextScript(CPDF_VariableText::ScriptType nScriptType) {
- CPVT_WordProps WordProps;
- WordProps.nScriptType = nScriptType;
- return SetRichTextProps(EP_SCRIPTTYPE, nullptr, &WordProps);
-}
-
-FX_BOOL CFX_Edit::SetRichTextBold(FX_BOOL bBold) {
- CPVT_WordProps WordProps;
- if (bBold)
- WordProps.nWordStyle |= PVTWORD_STYLE_BOLD;
- return SetRichTextProps(EP_BOLD, nullptr, &WordProps);
-}
-
-FX_BOOL CFX_Edit::SetRichTextItalic(FX_BOOL bItalic) {
- CPVT_WordProps WordProps;
- if (bItalic)
- WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC;
- return SetRichTextProps(EP_ITALIC, nullptr, &WordProps);
-}
-
-FX_BOOL CFX_Edit::SetRichTextUnderline(FX_BOOL bUnderline) {
- CPVT_WordProps WordProps;
- if (bUnderline)
- WordProps.nWordStyle |= PVTWORD_STYLE_UNDERLINE;
- return SetRichTextProps(EP_UNDERLINE, nullptr, &WordProps);
-}
-
-FX_BOOL CFX_Edit::SetRichTextCrossout(FX_BOOL bCrossout) {
- CPVT_WordProps WordProps;
- if (bCrossout)
- WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT;
- return SetRichTextProps(EP_CROSSOUT, nullptr, &WordProps);
-}
-
-FX_BOOL CFX_Edit::SetRichTextCharSpace(FX_FLOAT fCharSpace) {
- CPVT_WordProps WordProps;
- WordProps.fCharSpace = fCharSpace;
- return SetRichTextProps(EP_CHARSPACE, nullptr, &WordProps);
-}
-
-FX_BOOL CFX_Edit::SetRichTextHorzScale(int32_t nHorzScale) {
- CPVT_WordProps WordProps;
- WordProps.nHorzScale = nHorzScale;
- return SetRichTextProps(EP_HORZSCALE, nullptr, &WordProps);
-}
-
-FX_BOOL CFX_Edit::SetRichTextLineLeading(FX_FLOAT fLineLeading) {
- CPVT_SecProps SecProps;
- SecProps.fLineLeading = fLineLeading;
- return SetRichTextProps(EP_LINELEADING, &SecProps, nullptr);
-}
-
-FX_BOOL CFX_Edit::SetRichTextLineIndent(FX_FLOAT fLineIndent) {
- CPVT_SecProps SecProps;
- SecProps.fLineIndent = fLineIndent;
- return SetRichTextProps(EP_LINEINDENT, &SecProps, nullptr);
-}
-
-FX_BOOL CFX_Edit::SetRichTextAlignment(int32_t nAlignment) {
- CPVT_SecProps SecProps;
- SecProps.nAlignment = nAlignment;
- return SetRichTextProps(EP_ALIGNMENT, &SecProps, nullptr);
-}
-
-FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps,
- const CPVT_SecProps* pSecProps,
- const CPVT_WordProps* pWordProps) {
- if (!m_pVT->IsValid() || !m_pVT->IsRichText())
- return FALSE;
-
- CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator();
- CPVT_WordRange wrTemp = m_SelState.ConvertToWordRange();
-
- m_pVT->UpdateWordPlace(wrTemp.BeginPos);
- m_pVT->UpdateWordPlace(wrTemp.EndPos);
- pIterator->SetAt(wrTemp.BeginPos);
-
- BeginGroupUndo(L"");
- FX_BOOL bSet =
- SetSecProps(eProps, wrTemp.BeginPos, pSecProps, pWordProps, wrTemp, TRUE);
-
- while (pIterator->NextWord()) {
- CPVT_WordPlace place = pIterator->GetAt();
- if (place.WordCmp(wrTemp.EndPos) > 0)
- break;
- FX_BOOL bSet1 =
- SetSecProps(eProps, place, pSecProps, pWordProps, wrTemp, TRUE);
- FX_BOOL bSet2 = SetWordProps(eProps, place, pWordProps, wrTemp, TRUE);
-
- if (!bSet)
- bSet = (bSet1 || bSet2);
- }
-
- EndGroupUndo();
-
- if (bSet)
- PaintSetProps(eProps, wrTemp);
-
- return bSet;
-}
-
-void CFX_Edit::PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange& wr) {
- switch (eProps) {
- case EP_LINELEADING:
- case EP_LINEINDENT:
- case EP_ALIGNMENT:
- RearrangePart(wr);
- ScrollToCaret();
- Refresh(RP_ANALYSE);
- SetCaretOrigin();
- SetCaretInfo();
- break;
- case EP_WORDCOLOR:
- case EP_UNDERLINE:
- case EP_CROSSOUT:
- Refresh(RP_OPTIONAL, &wr);
- break;
- case EP_FONTINDEX:
- case EP_FONTSIZE:
- case EP_SCRIPTTYPE:
- case EP_CHARSPACE:
- case EP_HORZSCALE:
- case EP_BOLD:
- case EP_ITALIC:
- RearrangePart(wr);
- ScrollToCaret();
-
- CPVT_WordRange wrRefresh(m_pVT->GetSectionBeginPlace(wr.BeginPos),
- m_pVT->GetSectionEndPlace(wr.EndPos));
- Refresh(RP_ANALYSE, &wrRefresh);
-
- SetCaretOrigin();
- SetCaretInfo();
- break;
- }
-}
-
-FX_BOOL CFX_Edit::SetSecProps(EDIT_PROPS_E eProps,
- const CPVT_WordPlace& place,
- const CPVT_SecProps* pSecProps,
- const CPVT_WordProps* pWordProps,
- const CPVT_WordRange& wr,
- FX_BOOL bAddUndo) {
- if (!m_pVT->IsValid() || !m_pVT->IsRichText())
- return FALSE;
-
- CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator();
- FX_BOOL bSet = FALSE;
- CPVT_Section secinfo;
- CPVT_Section OldSecinfo;
-
- CPVT_WordPlace oldplace = pIterator->GetAt();
-
- if (eProps == EP_LINELEADING || eProps == EP_LINEINDENT ||
- eProps == EP_ALIGNMENT) {
- if (pSecProps) {
- pIterator->SetAt(place);
- if (pIterator->GetSection(secinfo)) {
- if (bAddUndo)
- OldSecinfo = secinfo;
-
- switch (eProps) {
- case EP_LINELEADING:
- if (!FX_EDIT_IsFloatEqual(secinfo.SecProps.fLineLeading,
- pSecProps->fLineLeading)) {
- secinfo.SecProps.fLineLeading = pSecProps->fLineLeading;
- bSet = TRUE;
- }
- break;
- case EP_LINEINDENT:
- if (!FX_EDIT_IsFloatEqual(secinfo.SecProps.fLineIndent,
- pSecProps->fLineIndent)) {
- secinfo.SecProps.fLineIndent = pSecProps->fLineIndent;
- bSet = TRUE;
- }
- break;
- case EP_ALIGNMENT:
- if (secinfo.SecProps.nAlignment != pSecProps->nAlignment) {
- secinfo.SecProps.nAlignment = pSecProps->nAlignment;
- bSet = TRUE;
- }
- break;
- default:
- break;
- }
- }
- }
- } else {
- if (pWordProps && place == m_pVT->GetSectionBeginPlace(place)) {
- pIterator->SetAt(place);
- if (pIterator->GetSection(secinfo)) {
- if (bAddUndo)
- OldSecinfo = secinfo;
-
- switch (eProps) {
- case EP_FONTINDEX:
- if (secinfo.WordProps.nFontIndex != pWordProps->nFontIndex) {
- secinfo.WordProps.nFontIndex = pWordProps->nFontIndex;
- bSet = TRUE;
- }
- break;
- case EP_FONTSIZE:
- if (!FX_EDIT_IsFloatEqual(secinfo.WordProps.fFontSize,
- pWordProps->fFontSize)) {
- secinfo.WordProps.fFontSize = pWordProps->fFontSize;
- bSet = TRUE;
- }
- break;
- case EP_WORDCOLOR:
- if (secinfo.WordProps.dwWordColor != pWordProps->dwWordColor) {
- secinfo.WordProps.dwWordColor = pWordProps->dwWordColor;
- bSet = TRUE;
- }
- break;
- case EP_SCRIPTTYPE:
- if (secinfo.WordProps.nScriptType != pWordProps->nScriptType) {
- secinfo.WordProps.nScriptType = pWordProps->nScriptType;
- bSet = TRUE;
- }
- break;
- case EP_CHARSPACE:
- if (!FX_EDIT_IsFloatEqual(secinfo.WordProps.fCharSpace,
- pWordProps->fCharSpace)) {
- secinfo.WordProps.fCharSpace = pWordProps->fCharSpace;
- bSet = TRUE;
- }
- break;
- case EP_HORZSCALE:
- if (secinfo.WordProps.nHorzScale != pWordProps->nHorzScale) {
- secinfo.WordProps.nHorzScale = pWordProps->nHorzScale;
- bSet = TRUE;
- }
- break;
- case EP_UNDERLINE:
- if (pWordProps->nWordStyle & PVTWORD_STYLE_UNDERLINE) {
- if ((secinfo.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) ==
- 0) {
- secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_UNDERLINE;
- bSet = TRUE;
- }
- } else {
- if ((secinfo.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) !=
- 0) {
- secinfo.WordProps.nWordStyle &= ~PVTWORD_STYLE_UNDERLINE;
- bSet = TRUE;
- }
- }
- break;
- case EP_CROSSOUT:
- if (pWordProps->nWordStyle & PVTWORD_STYLE_CROSSOUT) {
- if ((secinfo.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) ==
- 0) {
- secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT;
- bSet = TRUE;
- }
- } else {
- if ((secinfo.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) !=
- 0) {
- secinfo.WordProps.nWordStyle &= ~PVTWORD_STYLE_CROSSOUT;
- bSet = TRUE;
- }
- }
- break;
- case EP_BOLD:
- if (pWordProps->nWordStyle & PVTWORD_STYLE_BOLD) {
- if ((secinfo.WordProps.nWordStyle & PVTWORD_STYLE_BOLD) == 0) {
- secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_BOLD;
- bSet = TRUE;
- }
- } else {
- if ((secinfo.WordProps.nWordStyle & PVTWORD_STYLE_BOLD) != 0) {
- secinfo.WordProps.nWordStyle &= ~PVTWORD_STYLE_BOLD;
- bSet = TRUE;
- }
- }
- break;
- case EP_ITALIC:
- if (pWordProps->nWordStyle & PVTWORD_STYLE_ITALIC) {
- if ((secinfo.WordProps.nWordStyle & PVTWORD_STYLE_ITALIC) == 0) {
- secinfo.WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC;
- bSet = TRUE;
- }
- } else {
- if ((secinfo.WordProps.nWordStyle & PVTWORD_STYLE_ITALIC) != 0) {
- secinfo.WordProps.nWordStyle &= ~PVTWORD_STYLE_ITALIC;
- bSet = TRUE;
- }
- }
- break;
- default:
- break;
- }
- }
- }
- }
-
- if (bSet) {
- pIterator->SetSection(secinfo);
-
- if (bAddUndo && m_bEnableUndo) {
- AddEditUndoItem(new CFXEU_SetSecProps(
- this, place, eProps, OldSecinfo.SecProps, OldSecinfo.WordProps,
- secinfo.SecProps, secinfo.WordProps, wr));
- }
- }
-
- pIterator->SetAt(oldplace);
-
- return bSet;
-}
-
-FX_BOOL CFX_Edit::SetWordProps(EDIT_PROPS_E eProps,
- const CPVT_WordPlace& place,
- const CPVT_WordProps* pWordProps,
- const CPVT_WordRange& wr,
- FX_BOOL bAddUndo) {
- if (!m_pVT->IsValid() || !m_pVT->IsRichText())
- return FALSE;
-
- CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator();
- FX_BOOL bSet = FALSE;
- CPVT_Word wordinfo;
- CPVT_Word OldWordinfo;
-
- CPVT_WordPlace oldplace = pIterator->GetAt();
-
- if (pWordProps) {
- pIterator->SetAt(place);
- if (pIterator->GetWord(wordinfo)) {
- if (bAddUndo)
- OldWordinfo = wordinfo;
-
- switch (eProps) {
- case EP_FONTINDEX:
- if (wordinfo.WordProps.nFontIndex != pWordProps->nFontIndex) {
- if (IPVT_FontMap* pFontMap = GetFontMap()) {
- wordinfo.WordProps.nFontIndex = pFontMap->GetWordFontIndex(
- wordinfo.Word, wordinfo.nCharset, pWordProps->nFontIndex);
- }
- bSet = TRUE;
- }
- break;
- case EP_FONTSIZE:
- if (!FX_EDIT_IsFloatEqual(wordinfo.WordProps.fFontSize,
- pWordProps->fFontSize)) {
- wordinfo.WordProps.fFontSize = pWordProps->fFontSize;
- bSet = TRUE;
- }
- break;
- case EP_WORDCOLOR:
- if (wordinfo.WordProps.dwWordColor != pWordProps->dwWordColor) {
- wordinfo.WordProps.dwWordColor = pWordProps->dwWordColor;
- bSet = TRUE;
- }
- break;
- case EP_SCRIPTTYPE:
- if (wordinfo.WordProps.nScriptType != pWordProps->nScriptType) {
- wordinfo.WordProps.nScriptType = pWordProps->nScriptType;
- bSet = TRUE;
- }
- break;
- case EP_CHARSPACE:
- if (!FX_EDIT_IsFloatEqual(wordinfo.WordProps.fCharSpace,
- pWordProps->fCharSpace)) {
- wordinfo.WordProps.fCharSpace = pWordProps->fCharSpace;
- bSet = TRUE;
- }
- break;
- case EP_HORZSCALE:
- if (wordinfo.WordProps.nHorzScale != pWordProps->nHorzScale) {
- wordinfo.WordProps.nHorzScale = pWordProps->nHorzScale;
- bSet = TRUE;
- }
- break;
- case EP_UNDERLINE:
- if (pWordProps->nWordStyle & PVTWORD_STYLE_UNDERLINE) {
- if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) ==
- 0) {
- wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_UNDERLINE;
- bSet = TRUE;
- }
- } else {
- if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) !=
- 0) {
- wordinfo.WordProps.nWordStyle &= ~PVTWORD_STYLE_UNDERLINE;
- bSet = TRUE;
- }
- }
- break;
- case EP_CROSSOUT:
- if (pWordProps->nWordStyle & PVTWORD_STYLE_CROSSOUT) {
- if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) == 0) {
- wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT;
- bSet = TRUE;
- }
- } else {
- if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) != 0) {
- wordinfo.WordProps.nWordStyle &= ~PVTWORD_STYLE_CROSSOUT;
- bSet = TRUE;
- }
- }
- break;
- case EP_BOLD:
- if (pWordProps->nWordStyle & PVTWORD_STYLE_BOLD) {
- if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_BOLD) == 0) {
- wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_BOLD;
- bSet = TRUE;
- }
- } else {
- if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_BOLD) != 0) {
- wordinfo.WordProps.nWordStyle &= ~PVTWORD_STYLE_BOLD;
- bSet = TRUE;
- }
- }
- break;
- case EP_ITALIC:
- if (pWordProps->nWordStyle & PVTWORD_STYLE_ITALIC) {
- if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_ITALIC) == 0) {
- wordinfo.WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC;
- bSet = TRUE;
- }
- } else {
- if ((wordinfo.WordProps.nWordStyle & PVTWORD_STYLE_ITALIC) != 0) {
- wordinfo.WordProps.nWordStyle &= ~PVTWORD_STYLE_ITALIC;
- bSet = TRUE;
- }
- }
- break;
- default:
- break;
- }
- }
- }
-
- if (bSet) {
- pIterator->SetWord(wordinfo);
-
- if (bAddUndo && m_bEnableUndo) {
- AddEditUndoItem(new CFXEU_SetWordProps(
- this, place, eProps, OldWordinfo.WordProps, wordinfo.WordProps, wr));
- }
- }
-
- pIterator->SetAt(oldplace);
- return bSet;
-}
-
void CFX_Edit::SetText(const FX_WCHAR* text,
int32_t charset,
const CPVT_SecProps* pSecProps,
@@ -1694,7 +1093,7 @@ void CFX_Edit::RearrangePart(const CPVT_WordRange& range) {
}
void CFX_Edit::SetContentChanged() {
- if (m_bNotify && m_pNotify) {
+ if (m_pNotify) {
CFX_FloatRect rcContent = m_pVT->GetContentRect();
if (rcContent.Width() != m_rcOldContent.Width() ||
rcContent.Height() != m_rcOldContent.Height()) {
@@ -1797,7 +1196,7 @@ CFX_FloatRect CFX_Edit::EditToVT(const CFX_FloatRect& rect) const {
}
void CFX_Edit::SetScrollInfo() {
- if (m_bNotify && m_pNotify) {
+ if (m_pNotify) {
CFX_FloatRect rcPlate = m_pVT->GetPlateRect();
CFX_FloatRect rcContent = m_pVT->GetContentRect();
@@ -1824,7 +1223,7 @@ void CFX_Edit::SetScrollPosX(FX_FLOAT fx) {
m_ptScrollPos.x = fx;
Refresh(RP_NOANALYSE);
- if (m_bNotify && m_pNotify) {
+ if (m_pNotify) {
if (!m_bNotifyFlag) {
m_bNotifyFlag = TRUE;
m_pNotify->IOnSetScrollPosX(fx);
@@ -1844,7 +1243,7 @@ void CFX_Edit::SetScrollPosY(FX_FLOAT fy) {
m_ptScrollPos.y = fy;
Refresh(RP_NOANALYSE);
- if (m_bNotify && m_pNotify) {
+ if (m_pNotify) {
if (!m_bNotifyFlag) {
m_bNotifyFlag = TRUE;
m_pNotify->IOnSetScrollPosY(fy);
@@ -1959,7 +1358,7 @@ void CFX_Edit::Refresh(REFRESH_PLAN_E ePlan,
m_Refresh.NoAnalyse();
m_ptRefreshScrollPos = m_ptScrollPos;
- if (m_bNotify && m_pNotify) {
+ if (m_pNotify) {
if (!m_bNotifyFlag) {
m_bNotifyFlag = TRUE;
if (const CFX_Edit_RectArray* pRects = m_Refresh.GetRefreshRects()) {
@@ -2073,7 +1472,7 @@ void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) {
wordinfo.ptWord.x + wordinfo.fWidth,
lineinfo.ptLine.y + lineinfo.fLineAscent);
- if (m_bNotify && m_pNotify) {
+ if (m_pNotify) {
if (!m_bNotifyFlag) {
m_bNotifyFlag = TRUE;
CFX_FloatRect rcRefresh = VTToEdit(rcWord);
@@ -2087,7 +1486,7 @@ void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) {
lineinfo.ptLine.x + lineinfo.fLineWidth,
lineinfo.ptLine.y + lineinfo.fLineAscent);
- if (m_bNotify && m_pNotify) {
+ if (m_pNotify) {
if (!m_bNotifyFlag) {
m_bNotifyFlag = TRUE;
CFX_FloatRect rcRefresh = VTToEdit(rcLine);
@@ -2107,7 +1506,7 @@ void CFX_Edit::SetCaret(const CPVT_WordPlace& place) {
}
void CFX_Edit::SetCaretInfo() {
- if (m_bNotify && m_pNotify) {
+ if (m_pNotify) {
if (!m_bNotifyFlag) {
CFX_FloatPoint ptHead(0.0f, 0.0f), ptFoot(0.0f, 0.0f);
@@ -2133,38 +1532,6 @@ void CFX_Edit::SetCaretInfo() {
m_bNotifyFlag = FALSE;
}
}
-
- SetCaretChange();
-}
-
-void CFX_Edit::SetCaretChange() {
- if (m_wpCaret == m_wpOldCaret)
- return;
-
- if (!m_bNotify || !m_pVT->IsRichText() || !m_pNotify)
- return;
-
- CPVT_SecProps SecProps;
- CPVT_WordProps WordProps;
-
- CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator();
- pIterator->SetAt(m_wpCaret);
- CPVT_Word word;
- CPVT_Section section;
-
- if (pIterator->GetSection(section)) {
- SecProps = section.SecProps;
- WordProps = section.WordProps;
- }
-
- if (pIterator->GetWord(word))
- WordProps = word.WordProps;
-
- if (!m_bNotifyFlag) {
- m_bNotifyFlag = TRUE;
- m_pNotify->IOnCaretChange(SecProps, WordProps);
- m_bNotifyFlag = FALSE;
- }
}
void CFX_Edit::SetCaret(int32_t nPos) {
@@ -2662,44 +2029,8 @@ FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) {
CPVT_WordRange range = m_SelState.ConvertToWordRange();
- if (bAddUndo && m_bEnableUndo) {
- if (m_pVT->IsRichText()) {
- BeginGroupUndo(L"");
-
- CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator();
- pIterator->SetAt(range.EndPos);
-
- CPVT_Word wordinfo;
- CPVT_Section secinfo;
- do {
- CPVT_WordPlace place = pIterator->GetAt();
- if (place.WordCmp(range.BeginPos) <= 0)
- break;
-
- CPVT_WordPlace oldplace = m_pVT->GetPrevWordPlace(place);
-
- if (oldplace.SecCmp(place) != 0) {
- if (pIterator->GetSection(secinfo)) {
- AddEditUndoItem(new CFXEU_ClearRich(
- this, oldplace, place, range, wordinfo.Word, wordinfo.nCharset,
- secinfo.SecProps, secinfo.WordProps));
- }
- } else {
- if (pIterator->GetWord(wordinfo)) {
- oldplace = m_pVT->AdjustLineHeader(oldplace, TRUE);
- place = m_pVT->AdjustLineHeader(place, TRUE);
-
- AddEditUndoItem(new CFXEU_ClearRich(
- this, oldplace, place, range, wordinfo.Word, wordinfo.nCharset,
- secinfo.SecProps, wordinfo.WordProps));
- }
- }
- } while (pIterator->PrevWord());
- EndGroupUndo();
- } else {
- AddEditUndoItem(new CFXEU_Clear(this, range, GetSelText()));
- }
- }
+ if (bAddUndo && m_bEnableUndo)
+ AddEditUndoItem(new CFXEU_Clear(this, range, GetSelText()));
SelectNone();
SetCaret(m_pVT->DeleteWords(range));
@@ -2898,10 +2229,6 @@ void CFX_Edit::EnableUndo(FX_BOOL bUndo) {
m_bEnableUndo = bUndo;
}
-void CFX_Edit::EnableNotify(FX_BOOL bNotify) {
- m_bNotify = bNotify;
-}
-
void CFX_Edit::EnableOprNotify(FX_BOOL bNotify) {
m_bOprNotify = bNotify;
}
diff --git a/fpdfsdk/fxedit/fxet_pageobjs.cpp b/fpdfsdk/fxedit/fxet_pageobjs.cpp
index 29ad135bca..98ec6f5318 100644
--- a/fpdfsdk/fxedit/fxet_pageobjs.cpp
+++ b/fpdfsdk/fxedit/fxet_pageobjs.cpp
@@ -19,20 +19,6 @@
namespace {
-CFX_FloatRect GetUnderLineRect(const CPVT_Word& word) {
- return CFX_FloatRect(word.ptWord.x, word.ptWord.y + word.fDescent * 0.5f,
- word.ptWord.x + word.fWidth,
- word.ptWord.y + word.fDescent * 0.25f);
-}
-
-CFX_FloatRect GetCrossoutRect(const CPVT_Word& word) {
- return CFX_FloatRect(word.ptWord.x,
- word.ptWord.y + (word.fAscent + word.fDescent) * 0.5f +
- word.fDescent * 0.25f,
- word.ptWord.x + word.fWidth,
- word.ptWord.y + (word.fAscent + word.fDescent) * 0.5f);
-}
-
void DrawTextString(CFX_RenderDevice* pDevice,
const CFX_FloatPoint& pt,
CPDF_Font* pFont,
@@ -94,25 +80,6 @@ void DrawTextString(CFX_RenderDevice* pDevice,
}
}
-void AddRectToPageObjects(CPDF_PageObjectHolder* pObjectHolder,
- FX_COLORREF crFill,
- const CFX_FloatRect& rcFill) {
- std::unique_ptr<CPDF_PathObject> pPathObj(new CPDF_PathObject);
- CFX_PathData* pPathData = pPathObj->m_Path.GetModify();
- pPathData->AppendRect(rcFill.left, rcFill.bottom, rcFill.right, rcFill.top);
-
- FX_FLOAT rgb[3];
- rgb[0] = FXARGB_R(crFill) / 255.0f;
- rgb[1] = FXARGB_G(crFill) / 255.0f;
- rgb[2] = FXARGB_B(crFill) / 255.0f;
- pPathObj->m_ColorState.SetFillColor(
- CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3);
-
- pPathObj->m_FillType = FXFILL_ALTERNATE;
- pPathObj->m_bStroke = FALSE;
- pObjectHolder->GetPageObjectList()->push_back(std::move(pPathObj));
-}
-
CPDF_TextObject* AddTextObjToPageObjects(CPDF_PageObjectHolder* pObjectHolder,
FX_COLORREF crText,
CPDF_Font* pFont,
@@ -152,53 +119,6 @@ CPDF_TextObject* AddTextObjToPageObjects(CPDF_PageObjectHolder* pObjectHolder,
} // namespace
-void IFX_Edit::DrawUnderline(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
- IFX_Edit* pEdit,
- FX_COLORREF color,
- const CFX_FloatRect& rcClip,
- const CFX_FloatPoint& ptOffset,
- const CPVT_WordRange* pRange) {
- pDevice->SaveState();
-
- if (!rcClip.IsEmpty()) {
- CFX_FloatRect rcTemp = rcClip;
- pUser2Device->TransformRect(rcTemp);
- pDevice->SetClip_Rect(rcTemp.ToFxRect());
- }
-
- IFX_Edit_Iterator* pIterator = pEdit->GetIterator();
- if (pEdit->GetFontMap()) {
- if (pRange)
- pIterator->SetAt(pRange->BeginPos);
- else
- pIterator->SetAt(0);
-
- while (pIterator->NextWord()) {
- CPVT_WordPlace place = pIterator->GetAt();
- if (pRange && place.WordCmp(pRange->EndPos) > 0)
- break;
-
- CPVT_Word word;
- if (pIterator->GetWord(word)) {
- CFX_PathData pathUnderline;
- CFX_FloatRect rcUnderline = GetUnderLineRect(word);
- rcUnderline.left += ptOffset.x;
- rcUnderline.right += ptOffset.x;
- rcUnderline.top += ptOffset.y;
- rcUnderline.bottom += ptOffset.y;
- pathUnderline.AppendRect(rcUnderline.left, rcUnderline.bottom,
- rcUnderline.right, rcUnderline.top);
-
- pDevice->DrawPath(&pathUnderline, pUser2Device, nullptr, color, 0,
- FXFILL_WINDING);
- }
- }
- }
-
- pDevice->RestoreState(false);
-}
-
void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
IFX_Edit* pEdit,
@@ -323,131 +243,6 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice,
pDevice->RestoreState(false);
}
-void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
- IFX_Edit* pEdit,
- const CFX_FloatRect& rcClip,
- const CFX_FloatPoint& ptOffset,
- const CPVT_WordRange* pRange) {
- CPVT_WordRange wrSelect = pEdit->GetSelectWordRange();
-
- FX_COLORREF crCurText = ArgbEncode(255, 0, 0, 0);
- FX_COLORREF crOld = crCurText;
- FX_BOOL bSelect = FALSE;
- const FX_COLORREF crWhite = ArgbEncode(255, 255, 255, 255);
- const FX_COLORREF crSelBK = ArgbEncode(255, 0, 51, 113);
-
- CFX_ByteTextBuf sTextBuf;
- CPVT_WordProps wp;
- CFX_FloatPoint ptBT(0.0f, 0.0f);
-
- pDevice->SaveState();
-
- if (!rcClip.IsEmpty()) {
- CFX_FloatRect rcTemp = rcClip;
- pUser2Device->TransformRect(rcTemp);
- pDevice->SetClip_Rect(rcTemp.ToFxRect());
- }
-
- IFX_Edit_Iterator* pIterator = pEdit->GetIterator();
- if (IPVT_FontMap* pFontMap = pEdit->GetFontMap()) {
- if (pRange)
- pIterator->SetAt(pRange->BeginPos);
- else
- pIterator->SetAt(0);
-
- CPVT_WordPlace oldplace;
-
- while (pIterator->NextWord()) {
- CPVT_WordPlace place = pIterator->GetAt();
- if (pRange && place.WordCmp(pRange->EndPos) > 0)
- break;
-
- CPVT_Word word;
- if (pIterator->GetWord(word)) {
- word.WordProps.fFontSize = word.fFontSize;
-
- crCurText = ArgbEncode(255, word.WordProps.dwWordColor);
-
- if (wrSelect.IsExist()) {
- bSelect = place.WordCmp(wrSelect.BeginPos) > 0 &&
- place.WordCmp(wrSelect.EndPos) <= 0;
- if (bSelect) {
- crCurText = crWhite;
- }
- }
-
- if (bSelect) {
- CPVT_Line line;
- pIterator->GetLine(line);
-
- CFX_PathData pathSelBK;
- pathSelBK.AppendRect(word.ptWord.x + ptOffset.x,
- line.ptLine.y + line.fLineDescent + ptOffset.y,
- word.ptWord.x + word.fWidth + ptOffset.x,
- line.ptLine.y + line.fLineAscent + ptOffset.y);
-
- pDevice->DrawPath(&pathSelBK, pUser2Device, nullptr, crSelBK, 0,
- FXFILL_WINDING);
- }
-
- if (place.LineCmp(oldplace) != 0 || word.WordProps.fCharSpace > 0.0f ||
- word.WordProps.nHorzScale != 100 ||
- FXSYS_memcmp(&word.WordProps, &wp, sizeof(CPVT_WordProps)) != 0 ||
- crOld != crCurText) {
- if (sTextBuf.GetLength() > 0) {
- DrawTextString(
- pDevice,
- CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
- pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, pUser2Device,
- sTextBuf.MakeString(), crOld, 0, wp.nHorzScale);
-
- sTextBuf.Clear();
- }
- wp = word.WordProps;
- ptBT = word.ptWord;
- crOld = crCurText;
- }
-
- sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex,
- word.Word, 0)
- .AsStringC();
-
- if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) {
- CFX_PathData pathUnderline;
- CFX_FloatRect rcUnderline = GetUnderLineRect(word);
- pathUnderline.AppendRect(rcUnderline.left, rcUnderline.bottom,
- rcUnderline.right, rcUnderline.top);
-
- pDevice->DrawPath(&pathUnderline, pUser2Device, nullptr, crCurText, 0,
- FXFILL_WINDING);
- }
-
- if (word.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) {
- CFX_PathData pathCrossout;
- CFX_FloatRect rcCrossout = GetCrossoutRect(word);
- pathCrossout.AppendRect(rcCrossout.left, rcCrossout.bottom,
- rcCrossout.right, rcCrossout.top);
-
- pDevice->DrawPath(&pathCrossout, pUser2Device, nullptr, crCurText, 0,
- FXFILL_WINDING);
- }
-
- oldplace = place;
- }
- }
-
- if (sTextBuf.GetLength() > 0) {
- DrawTextString(
- pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
- pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, pUser2Device,
- sTextBuf.MakeString(), crOld, 0, wp.nHorzScale);
- }
- }
-
- pDevice->RestoreState(false);
-}
-
void IFX_Edit::GeneratePageObjects(
CPDF_PageObjectHolder* pObjectHolder,
IFX_Edit* pEdit,
@@ -509,127 +304,3 @@ void IFX_Edit::GeneratePageObjects(
}
}
}
-
-void IFX_Edit::GenerateRichPageObjects(
- CPDF_PageObjectHolder* pObjectHolder,
- IFX_Edit* pEdit,
- const CFX_FloatPoint& ptOffset,
- const CPVT_WordRange* pRange,
- CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray) {
- FX_COLORREF crCurText = ArgbEncode(255, 0, 0, 0);
- FX_COLORREF crOld = crCurText;
-
- CFX_ByteTextBuf sTextBuf;
- CPVT_WordProps wp;
- CFX_FloatPoint ptBT(0.0f, 0.0f);
-
- ObjArray.RemoveAll();
-
- IFX_Edit_Iterator* pIterator = pEdit->GetIterator();
- if (IPVT_FontMap* pFontMap = pEdit->GetFontMap()) {
- if (pRange)
- pIterator->SetAt(pRange->BeginPos);
- else
- pIterator->SetAt(0);
-
- CPVT_WordPlace oldplace;
-
- while (pIterator->NextWord()) {
- CPVT_WordPlace place = pIterator->GetAt();
- if (pRange && place.WordCmp(pRange->EndPos) > 0)
- break;
-
- CPVT_Word word;
- if (pIterator->GetWord(word)) {
- word.WordProps.fFontSize = word.fFontSize;
-
- crCurText = ArgbEncode(255, word.WordProps.dwWordColor);
-
- if (place.LineCmp(oldplace) != 0 || word.WordProps.fCharSpace > 0.0f ||
- word.WordProps.nHorzScale != 100 ||
- FXSYS_memcmp(&word.WordProps, &wp, sizeof(CPVT_WordProps)) != 0 ||
- crOld != crCurText) {
- if (sTextBuf.GetLength() > 0) {
- ObjArray.Add(AddTextObjToPageObjects(
- pObjectHolder, crOld, pFontMap->GetPDFFont(wp.nFontIndex),
- wp.fFontSize, wp.fCharSpace, wp.nHorzScale,
- CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
- sTextBuf.MakeString()));
-
- sTextBuf.Clear();
- }
-
- wp = word.WordProps;
- ptBT = word.ptWord;
- crOld = crCurText;
- }
-
- sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex,
- word.Word, 0)
- .AsStringC();
-
- if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) {
- CFX_FloatRect rcUnderline = GetUnderLineRect(word);
- rcUnderline.left += ptOffset.x;
- rcUnderline.right += ptOffset.x;
- rcUnderline.top += ptOffset.y;
- rcUnderline.bottom += ptOffset.y;
-
- AddRectToPageObjects(pObjectHolder, crCurText, rcUnderline);
- }
-
- if (word.WordProps.nWordStyle & PVTWORD_STYLE_CROSSOUT) {
- CFX_FloatRect rcCrossout = GetCrossoutRect(word);
- rcCrossout.left += ptOffset.x;
- rcCrossout.right += ptOffset.x;
- rcCrossout.top += ptOffset.y;
- rcCrossout.bottom += ptOffset.y;
-
- AddRectToPageObjects(pObjectHolder, crCurText, rcCrossout);
- }
-
- oldplace = place;
- }
- }
-
- if (sTextBuf.GetLength() > 0) {
- ObjArray.Add(AddTextObjToPageObjects(
- pObjectHolder, crOld, pFontMap->GetPDFFont(wp.nFontIndex),
- wp.fFontSize, wp.fCharSpace, wp.nHorzScale,
- CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
- sTextBuf.MakeString()));
- }
- }
-}
-
-void IFX_Edit::GenerateUnderlineObjects(CPDF_PageObjectHolder* pObjectHolder,
- IFX_Edit* pEdit,
- const CFX_FloatPoint& ptOffset,
- const CPVT_WordRange* pRange,
- FX_COLORREF color) {
- IFX_Edit_Iterator* pIterator = pEdit->GetIterator();
- if (pEdit->GetFontMap()) {
- if (pRange)
- pIterator->SetAt(pRange->BeginPos);
- else
- pIterator->SetAt(0);
-
- CPVT_WordPlace oldplace;
-
- while (pIterator->NextWord()) {
- CPVT_WordPlace place = pIterator->GetAt();
- if (pRange && place.WordCmp(pRange->EndPos) > 0)
- break;
-
- CPVT_Word word;
- if (pIterator->GetWord(word)) {
- CFX_FloatRect rcUnderline = GetUnderLineRect(word);
- rcUnderline.left += ptOffset.x;
- rcUnderline.right += ptOffset.x;
- rcUnderline.top += ptOffset.y;
- rcUnderline.bottom += ptOffset.y;
- AddRectToPageObjects(pObjectHolder, color, rcUnderline);
- }
- }
- }
-}
diff --git a/fpdfsdk/fxedit/include/fx_edit.h b/fpdfsdk/fxedit/include/fx_edit.h
index 710c06f809..cface7daa5 100644
--- a/fpdfsdk/fxedit/include/fx_edit.h
+++ b/fpdfsdk/fxedit/include/fx_edit.h
@@ -77,10 +77,6 @@ class IFX_Edit_Notify {
const CFX_FloatPoint& ptHead,
const CFX_FloatPoint& ptFoot,
const CPVT_WordPlace& place) = 0;
- // if the caret position is changed ,send the information of current postion
- // to user.
- virtual void IOnCaretChange(const CPVT_SecProps& secProps,
- const CPVT_WordProps& wordProps) = 0;
// if the text area is changed, send the information to user.
virtual void IOnContentChange(const CFX_FloatRect& rcContent) = 0;
// Invalidate the rectangle relative to the bounding box of edit.
@@ -242,54 +238,6 @@ class IFX_Edit {
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(
- 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;
@@ -413,9 +361,6 @@ class IFX_Edit {
// allow undo/redo?
virtual void EnableUndo(FX_BOOL bUndo) = 0;
- // allow notify?
- virtual void EnableNotify(FX_BOOL bNotify) = 0;
-
// allow opr notify?
virtual void EnableOprNotify(FX_BOOL bNotify) = 0;
@@ -493,19 +438,6 @@ class IFX_Edit {
const CPVT_WordRange* pRange,
CFX_SystemHandler* pSystemHandler,
void* pFFLData);
- static void DrawUnderline(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
- IFX_Edit* pEdit,
- FX_COLORREF color,
- const CFX_FloatRect& rcClip,
- const CFX_FloatPoint& ptOffset,
- const CPVT_WordRange* pRange);
- static void DrawRichEdit(CFX_RenderDevice* pDevice,
- CFX_Matrix* pUser2Device,
- IFX_Edit* pEdit,
- const CFX_FloatRect& rcClip,
- const CFX_FloatPoint& ptOffset,
- const CPVT_WordRange* pRange);
static void GeneratePageObjects(
CPDF_PageObjectHolder* pObjectHolder,
IFX_Edit* pEdit,
@@ -513,17 +445,6 @@ class IFX_Edit {
const CPVT_WordRange* pRange,
FX_COLORREF crText,
CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
- static void GenerateRichPageObjects(
- CPDF_PageObjectHolder* pObjectHolder,
- IFX_Edit* pEdit,
- const CFX_FloatPoint& ptOffset,
- const CPVT_WordRange* pRange,
- CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray);
- static void GenerateUnderlineObjects(CPDF_PageObjectHolder* pObjectHolder,
- IFX_Edit* pEdit,
- const CFX_FloatPoint& ptOffset,
- const CPVT_WordRange* pRange,
- FX_COLORREF color);
protected:
virtual ~IFX_Edit() {}
diff --git a/fpdfsdk/fxedit/include/fxet_edit.h b/fpdfsdk/fxedit/include/fxet_edit.h
index aab26556b8..6f1a6d6530 100644
--- a/fpdfsdk/fxedit/include/fxet_edit.h
+++ b/fpdfsdk/fxedit/include/fxet_edit.h
@@ -331,34 +331,6 @@ class CFXEU_Clear : public CFX_Edit_UndoItem {
CFX_WideString m_swText;
};
-class CFXEU_ClearRich : public CFX_Edit_UndoItem {
- public:
- CFXEU_ClearRich(CFX_Edit* pEdit,
- const CPVT_WordPlace& wpOldPlace,
- const CPVT_WordPlace& wpNewPlace,
- const CPVT_WordRange& wrSel,
- uint16_t word,
- int32_t charset,
- const CPVT_SecProps& SecProps,
- const CPVT_WordProps& WordProps);
- ~CFXEU_ClearRich() override;
-
- // CFX_Edit_UndoItem
- void Redo() override;
- void Undo() override;
-
- private:
- CFX_Edit* m_pEdit;
-
- CPVT_WordPlace m_wpOld;
- CPVT_WordPlace m_wpNew;
- CPVT_WordRange m_wrSel;
- uint16_t m_Word;
- int32_t m_nCharset;
- CPVT_SecProps m_SecProps;
- CPVT_WordProps m_WordProps;
-};
-
class CFXEU_InsertText : public CFX_Edit_UndoItem {
public:
CFXEU_InsertText(CFX_Edit* pEdit,
@@ -385,58 +357,6 @@ class CFXEU_InsertText : public CFX_Edit_UndoItem {
CPVT_WordProps m_WordProps;
};
-class CFXEU_SetSecProps : public CFX_Edit_UndoItem {
- public:
- CFXEU_SetSecProps(CFX_Edit* pEdit,
- const CPVT_WordPlace& place,
- EDIT_PROPS_E ep,
- const CPVT_SecProps& oldsecprops,
- const CPVT_WordProps& oldwordprops,
- const CPVT_SecProps& newsecprops,
- const CPVT_WordProps& newwordprops,
- const CPVT_WordRange& range);
- ~CFXEU_SetSecProps() override;
-
- // CFX_Edit_UndoItem
- void Redo() override;
- void Undo() override;
-
- private:
- CFX_Edit* m_pEdit;
- CPVT_WordPlace m_wpPlace;
- CPVT_WordRange m_wrPlace;
- EDIT_PROPS_E m_eProps;
-
- CPVT_SecProps m_OldSecProps;
- CPVT_SecProps m_NewSecProps;
- CPVT_WordProps m_OldWordProps;
- CPVT_WordProps m_NewWordProps;
-};
-
-class CFXEU_SetWordProps : public CFX_Edit_UndoItem {
- public:
- CFXEU_SetWordProps(CFX_Edit* pEdit,
- const CPVT_WordPlace& place,
- EDIT_PROPS_E ep,
- const CPVT_WordProps& oldprops,
- const CPVT_WordProps& newprops,
- const CPVT_WordRange& range);
- ~CFXEU_SetWordProps() override;
-
- // CFX_Edit_UndoItem
- void Redo() override;
- void Undo() override;
-
- private:
- CFX_Edit* m_pEdit;
- CPVT_WordPlace m_wpPlace;
- CPVT_WordRange m_wrPlace;
- EDIT_PROPS_E m_eProps;
-
- CPVT_WordProps m_OldWordProps;
- CPVT_WordProps m_NewWordProps;
-};
-
class CFX_Edit : public IFX_Edit {
friend class CFX_Edit_Iterator;
friend class CFXEU_InsertWord;
@@ -444,9 +364,6 @@ class CFX_Edit : public IFX_Edit {
friend class CFXEU_Backspace;
friend class CFXEU_Delete;
friend class CFXEU_Clear;
- friend class CFXEU_ClearRich;
- friend class CFXEU_SetSecProps;
- friend class CFXEU_SetWordProps;
friend class CFXEU_InsertText;
public:
@@ -478,21 +395,6 @@ class CFX_Edit : public IFX_Edit {
void SetFontSize(FX_FLOAT fFontSize, FX_BOOL bPaint = TRUE) override;
void SetTextOverflow(FX_BOOL bAllowed = FALSE,
FX_BOOL bPaint = TRUE) override;
- FX_BOOL IsRichText() const override;
- void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE) override;
- FX_BOOL SetRichFontSize(FX_FLOAT fFontSize) override;
- FX_BOOL SetRichFontIndex(int32_t nFontIndex) override;
- FX_BOOL SetRichTextColor(FX_COLORREF dwColor) 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;
- FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE) override;
- FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace) override;
- FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100) override;
- FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading) override;
- FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent) override;
- FX_BOOL SetRichTextAlignment(int32_t nAlignment) override;
void OnMouseDown(const CFX_FloatPoint& point,
FX_BOOL bShift,
FX_BOOL bCtrl) override;
@@ -551,7 +453,6 @@ class CFX_Edit : public IFX_Edit {
void SelectNone() override;
FX_BOOL IsSelected() const override;
void Paint() override;
- void EnableNotify(FX_BOOL bNotify) override;
void EnableRefresh(FX_BOOL bRefresh) override;
void RefreshWordRange(const CPVT_WordRange& wr) override;
void SetCaret(int32_t nPos) override;
@@ -614,21 +515,6 @@ class CFX_Edit : public IFX_Edit {
const CPVT_WordProps* pWordProps,
FX_BOOL bAddUndo,
FX_BOOL bPaint);
- FX_BOOL SetRichTextProps(EDIT_PROPS_E eProps,
- const CPVT_SecProps* pSecProps,
- const CPVT_WordProps* pWordProps);
- FX_BOOL SetSecProps(EDIT_PROPS_E eProps,
- const CPVT_WordPlace& place,
- const CPVT_SecProps* pSecProps,
- const CPVT_WordProps* pWordProps,
- const CPVT_WordRange& wr,
- FX_BOOL bAddUndo);
- FX_BOOL SetWordProps(EDIT_PROPS_E eProps,
- const CPVT_WordPlace& place,
- const CPVT_WordProps* pWordProps,
- const CPVT_WordRange& wr,
- FX_BOOL bAddUndo);
- void PaintSetProps(EDIT_PROPS_E eProps, const CPVT_WordRange& wr);
void PaintInsertText(const CPVT_WordPlace& wpOld,
const CPVT_WordPlace& wpNew);
@@ -646,7 +532,6 @@ class CFX_Edit : public IFX_Edit {
void SetCaret(const CPVT_WordPlace& place);
void SetCaretInfo();
void SetCaretOrigin();
- void SetCaretChange();
CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace& place) const;
CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1,
@@ -685,7 +570,6 @@ class CFX_Edit : public IFX_Edit {
FX_BOOL m_bEnableRefresh;
CFX_FloatRect m_rcOldContent;
FX_BOOL m_bEnableUndo;
- FX_BOOL m_bNotify;
FX_BOOL m_bOprNotify;
CFX_Edit_GroupUndoItem* m_pGroupUndoItem;
};