From 55a1eb01db6ceadf9c180931b2663338b8cbc2fd Mon Sep 17 00:00:00 2001 From: npm Date: Fri, 9 Sep 2016 14:11:11 -0700 Subject: Delete unused methods and definitions from fxet_edit Review-Url: https://codereview.chromium.org/2331453002 --- fpdfsdk/fxedit/fxet_edit.cpp | 524 ------------------------------------- fpdfsdk/fxedit/include/fxet_edit.h | 114 -------- 2 files changed, 638 deletions(-) diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp index 7aa8534a0a..8912fa5fd8 100644 --- a/fpdfsdk/fxedit/fxet_edit.cpp +++ b/fpdfsdk/fxedit/fxet_edit.cpp @@ -28,11 +28,6 @@ #include "fpdfsdk/pdfwindow/PWL_Edit.h" #include "fpdfsdk/pdfwindow/PWL_EditCtrl.h" -#define PVTWORD_STYLE_UNDERLINE 0x0002L -#define PVTWORD_STYLE_CROSSOUT 0x0004L -#define PVTWORD_STYLE_BOLD 0x0020L -#define PVTWORD_STYLE_ITALIC 0x0040L - namespace { const int kEditUndoMaxItems = 10000; @@ -58,20 +53,6 @@ CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap, return sRet.MakeString(); } -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, @@ -133,25 +114,6 @@ void DrawTextString(CFX_RenderDevice* pDevice, } } -void AddRectToPageObjects(CPDF_PageObjectHolder* pObjectHolder, - FX_COLORREF crFill, - const CFX_FloatRect& rcFill) { - std::unique_ptr pPathObj(new CPDF_PathObject); - pPathObj->m_Path.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, @@ -202,26 +164,10 @@ FX_BOOL CFX_Edit_Iterator::NextWord() { return m_pVTIterator->NextWord(); } -FX_BOOL CFX_Edit_Iterator::NextLine() { - return m_pVTIterator->NextLine(); -} - -FX_BOOL CFX_Edit_Iterator::NextSection() { - return m_pVTIterator->NextSection(); -} - FX_BOOL CFX_Edit_Iterator::PrevWord() { return m_pVTIterator->PrevWord(); } -FX_BOOL CFX_Edit_Iterator::PrevLine() { - return m_pVTIterator->PrevLine(); -} - -FX_BOOL CFX_Edit_Iterator::PrevSection() { - return m_pVTIterator->PrevSection(); -} - FX_BOOL CFX_Edit_Iterator::GetWord(CPVT_Word& word) const { ASSERT(m_pEdit); @@ -264,10 +210,6 @@ const CPVT_WordPlace& CFX_Edit_Iterator::GetAt() const { return m_pVTIterator->GetAt(); } -CFX_Edit* CFX_Edit_Iterator::GetEdit() const { - return m_pEdit; -} - CFX_Edit_Provider::CFX_Edit_Provider(IPVT_FontMap* pFontMap) : CPDF_VariableText::Provider(pFontMap), m_pFontMap(pFontMap) { ASSERT(m_pFontMap); @@ -414,10 +356,6 @@ void CFX_Edit_Undo::Redo() { m_bWorking = FALSE; } -FX_BOOL CFX_Edit_Undo::IsWorking() const { - return m_bWorking; -} - void CFX_Edit_Undo::AddItem(IFX_Edit_UndoItem* pItem) { ASSERT(!m_bWorking); ASSERT(pItem); @@ -441,13 +379,6 @@ FX_BOOL CFX_Edit_Undo::IsModified() const { return m_bVirgin ? m_bModified : TRUE; } -IFX_Edit_UndoItem* CFX_Edit_Undo::GetItem(int32_t nIndex) { - if (nIndex >= 0 && nIndex < m_UndoItemStack.GetSize()) - return m_UndoItemStack.GetAt(nIndex); - - return nullptr; -} - void CFX_Edit_Undo::RemoveHeads() { ASSERT(m_UndoItemStack.GetSize() > 1); @@ -482,10 +413,6 @@ void CFX_Edit_UndoItem::SetFirst(FX_BOOL bFirst) { m_bFirst = bFirst; } -FX_BOOL CFX_Edit_UndoItem::IsFirst() { - return m_bFirst; -} - void CFX_Edit_UndoItem::SetLast(FX_BOOL bLast) { m_bLast = bLast; } @@ -883,54 +810,6 @@ CFX_ByteString CFX_Edit::GetSelectAppearanceStream( return sRet.MakeString(); } -// static -void CFX_Edit::DrawUnderline(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device, - CFX_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()); - } - - CFX_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); -} - // static void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, @@ -1056,132 +935,6 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, pDevice->RestoreState(false); } -// static -void CFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device, - CFX_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()); - } - - CFX_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); -} - // static void CFX_Edit::GeneratePageObjects( CPDF_PageObjectHolder* pObjectHolder, @@ -1245,132 +998,6 @@ void CFX_Edit::GeneratePageObjects( } } -// static -void CFX_Edit::GenerateRichPageObjects( - CPDF_PageObjectHolder* pObjectHolder, - CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, - const CPVT_WordRange* pRange, - CFX_ArrayTemplate& 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(); - - CFX_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())); - } - } -} - -// static -void CFX_Edit::GenerateUnderlineObjects(CPDF_PageObjectHolder* pObjectHolder, - CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, - const CPVT_WordRange* pRange, - FX_COLORREF color) { - CFX_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); - } - } - } -} - CFX_Edit::CFX_Edit() : m_pVT(new CPDF_VariableText), m_pNotify(nullptr), @@ -1421,10 +1048,6 @@ CFX_Edit_Iterator* CFX_Edit::GetIterator() { return m_pIterator.get(); } -CPDF_VariableText* CFX_Edit::GetVariableText() { - return m_pVT.get(); -} - IPVT_FontMap* CFX_Edit::GetFontMap() { return m_pVTProvider ? m_pVTProvider->GetFontMap() : nullptr; } @@ -1651,25 +1274,6 @@ CPVT_WordRange CFX_Edit::GetSelectWordRange() const { return m_SelState.ConvertToWordRange(); } -CPVT_WordRange CFX_Edit::CombineWordRange(const CPVT_WordRange& wr1, - const CPVT_WordRange& wr2) { - CPVT_WordRange wrRet; - - if (wr1.BeginPos.WordCmp(wr2.BeginPos) < 0) { - wrRet.BeginPos = wr1.BeginPos; - } else { - wrRet.BeginPos = wr2.BeginPos; - } - - if (wr1.EndPos.WordCmp(wr2.EndPos) < 0) { - wrRet.EndPos = wr2.EndPos; - } else { - wrRet.EndPos = wr1.EndPos; - } - - return wrRet; -} - void CFX_Edit::SetText(const CFX_WideString& sText) { Empty(); DoInsertText(CPVT_WordPlace(0, 0, -1), sText, DEFAULT_CHARSET); @@ -1712,10 +1316,6 @@ int32_t CFX_Edit::GetCharArray() const { return m_pVT->GetCharArray(); } -CFX_FloatRect CFX_Edit::GetPlateRect() const { - return m_pVT->GetPlateRect(); -} - CFX_FloatRect CFX_Edit::GetContentRect() const { return VTToEdit(m_pVT->GetContentRect()); } @@ -1883,15 +1483,6 @@ CFX_FloatRect CFX_Edit::VTToEdit(const CFX_FloatRect& rect) const { ptRightTop.y); } -CFX_FloatRect CFX_Edit::EditToVT(const CFX_FloatRect& rect) const { - CFX_FloatPoint ptLeftBottom = - EditToVT(CFX_FloatPoint(rect.left, rect.bottom)); - CFX_FloatPoint ptRightTop = EditToVT(CFX_FloatPoint(rect.right, rect.top)); - - return CFX_FloatRect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, - ptRightTop.y); -} - void CFX_Edit::SetScrollInfo() { if (m_pNotify) { CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); @@ -2084,50 +1675,6 @@ void CFX_Edit::RefreshPushLineRects(const CPVT_WordRange& wr) { } while (pIterator->NextLine()); } -void CFX_Edit::RefreshPushRandomRects(const CPVT_WordRange& wr) { - if (!m_pVT->IsValid()) - return; - - CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator(); - CPVT_WordRange wrTemp = wr; - - m_pVT->UpdateWordPlace(wrTemp.BeginPos); - m_pVT->UpdateWordPlace(wrTemp.EndPos); - pIterator->SetAt(wrTemp.BeginPos); - - CPVT_Word wordinfo; - CPVT_Line lineinfo; - CPVT_WordPlace place; - - while (pIterator->NextWord()) { - place = pIterator->GetAt(); - if (place.WordCmp(wrTemp.EndPos) > 0) - break; - - pIterator->GetWord(wordinfo); - pIterator->GetLine(lineinfo); - - if (place.LineCmp(wrTemp.BeginPos) == 0 || - place.LineCmp(wrTemp.EndPos) == 0) { - CFX_FloatRect rcWord(wordinfo.ptWord.x, - lineinfo.ptLine.y + lineinfo.fLineDescent, - wordinfo.ptWord.x + wordinfo.fWidth, - lineinfo.ptLine.y + lineinfo.fLineAscent); - - m_Refresh.AddRefresh(VTToEdit(rcWord)); - } else { - CFX_FloatRect rcLine(lineinfo.ptLine.x, - lineinfo.ptLine.y + lineinfo.fLineDescent, - lineinfo.ptLine.x + lineinfo.fLineWidth, - lineinfo.ptLine.y + lineinfo.fLineAscent); - - m_Refresh.AddRefresh(VTToEdit(rcLine)); - - pIterator->NextLine(); - } - } -} - void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) { CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator(); CPVT_WordRange wrTemp = wr; @@ -2802,23 +2349,6 @@ FX_BOOL CFX_Edit::IsTextOverflow() const { return FALSE; } -CPVT_WordPlace CFX_Edit::GetLineBeginPlace(const CPVT_WordPlace& place) const { - return m_pVT->GetLineBeginPlace(place); -} - -CPVT_WordPlace CFX_Edit::GetLineEndPlace(const CPVT_WordPlace& place) const { - return m_pVT->GetLineEndPlace(place); -} - -CPVT_WordPlace CFX_Edit::GetSectionBeginPlace( - const CPVT_WordPlace& place) const { - return m_pVT->GetSectionBeginPlace(place); -} - -CPVT_WordPlace CFX_Edit::GetSectionEndPlace(const CPVT_WordPlace& place) const { - return m_pVT->GetSectionEndPlace(place); -} - FX_BOOL CFX_Edit::CanUndo() const { if (m_bEnableUndo) { return m_Undo.CanUndo(); @@ -2835,14 +2365,6 @@ FX_BOOL CFX_Edit::CanRedo() const { return FALSE; } -FX_BOOL CFX_Edit::IsModified() const { - if (m_bEnableUndo) { - return m_Undo.IsModified(); - } - - return FALSE; -} - void CFX_Edit::EnableRefresh(FX_BOOL bRefresh) { m_bEnableRefresh = bRefresh; } @@ -2855,32 +2377,6 @@ void CFX_Edit::EnableOprNotify(FX_BOOL bNotify) { m_bOprNotify = bNotify; } -FX_FLOAT CFX_Edit::GetLineTop(const CPVT_WordPlace& place) const { - CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator(); - CPVT_WordPlace wpOld = pIterator->GetAt(); - - pIterator->SetAt(place); - CPVT_Line line; - pIterator->GetLine(line); - - pIterator->SetAt(wpOld); - - return line.ptLine.y + line.fLineAscent; -} - -FX_FLOAT CFX_Edit::GetLineBottom(const CPVT_WordPlace& place) const { - CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator(); - CPVT_WordPlace wpOld = pIterator->GetAt(); - - pIterator->SetAt(place); - CPVT_Line line; - pIterator->GetLine(line); - - pIterator->SetAt(wpOld); - - return line.ptLine.y + line.fLineDescent; -} - CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, const CFX_WideString& sText, int32_t charset) { @@ -2919,18 +2415,6 @@ int32_t CFX_Edit::GetCharSetFromUnicode(uint16_t word, int32_t nOldCharset) { return nOldCharset; } -void CFX_Edit::BeginGroupUndo(const CFX_WideString& sTitle) { - ASSERT(!m_pGroupUndoItem); - - m_pGroupUndoItem = new CFX_Edit_GroupUndoItem(sTitle); -} - -void CFX_Edit::EndGroupUndo() { - m_pGroupUndoItem->UpdateItems(); - m_Undo.AddItem(m_pGroupUndoItem); - m_pGroupUndoItem = nullptr; -} - void CFX_Edit::AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem) { if (m_pGroupUndoItem) { m_pGroupUndoItem->AddUndoItem(pEditUndoItem); @@ -2939,10 +2423,6 @@ void CFX_Edit::AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem) { } } -void CFX_Edit::AddUndoItem(IFX_Edit_UndoItem* pUndoItem) { - m_Undo.AddItem(pUndoItem); -} - CFX_Edit_LineRectArray::CFX_Edit_LineRectArray() {} CFX_Edit_LineRectArray::~CFX_Edit_LineRectArray() { @@ -3022,10 +2502,6 @@ FX_BOOL CFX_Edit_Select::IsExist() const { return BeginPos != EndPos; } -FX_BOOL CFX_Edit_Select::operator!=(const CPVT_WordRange& wr) const { - return wr.BeginPos != BeginPos || wr.EndPos != EndPos; -} - CFX_Edit_RectArray::CFX_Edit_RectArray() {} CFX_Edit_RectArray::~CFX_Edit_RectArray() { diff --git a/fpdfsdk/fxedit/include/fxet_edit.h b/fpdfsdk/fxedit/include/fxet_edit.h index e0fca92dd2..9ef2e64fc3 100644 --- a/fpdfsdk/fxedit/include/fxet_edit.h +++ b/fpdfsdk/fxedit/include/fxet_edit.h @@ -24,47 +24,10 @@ class CFX_RenderDevice; class CFX_SystemHandler; class IFX_Edit_UndoItem; -enum EDIT_PROPS_E { - EP_LINELEADING, - EP_LINEINDENT, - EP_ALIGNMENT, - EP_FONTINDEX, - EP_FONTSIZE, - EP_WORDCOLOR, - EP_SCRIPTTYPE, - EP_UNDERLINE, - EP_CROSSOUT, - EP_CHARSPACE, - EP_HORZSCALE, - EP_BOLD, - EP_ITALIC -}; - struct CFX_Edit_LineRect { CFX_Edit_LineRect(const CPVT_WordRange& wrLine, const CFX_FloatRect& rcLine) : m_wrLine(wrLine), m_rcLine(rcLine) {} - FX_BOOL operator!=(const CFX_Edit_LineRect& linerect) const { - return FXSYS_memcmp(this, &linerect, sizeof(CFX_Edit_LineRect)) != 0; - } - - FX_BOOL IsSameHeight(const CFX_Edit_LineRect& linerect) const { - return IsFloatZero((m_rcLine.top - m_rcLine.bottom) - - (linerect.m_rcLine.top - linerect.m_rcLine.bottom)); - } - - FX_BOOL IsSameTop(const CFX_Edit_LineRect& linerect) const { - return IsFloatZero(m_rcLine.top - linerect.m_rcLine.top); - } - - FX_BOOL IsSameLeft(const CFX_Edit_LineRect& linerect) const { - return IsFloatZero(m_rcLine.left - linerect.m_rcLine.left); - } - - FX_BOOL IsSameRight(const CFX_Edit_LineRect& linerect) const { - return IsFloatZero(m_rcLine.right - linerect.m_rcLine.right); - } - CPVT_WordRange m_wrLine; CFX_FloatRect m_rcLine; }; @@ -132,7 +95,6 @@ class CFX_Edit_Select { CPVT_WordRange ConvertToWordRange() const; FX_BOOL IsExist() const; - FX_BOOL operator!=(const CPVT_WordRange& wr) const; CPVT_WordPlace BeginPos, EndPos; }; @@ -150,18 +112,10 @@ class CFX_Edit_Undo { FX_BOOL CanUndo() const; FX_BOOL CanRedo() const; FX_BOOL IsModified() const; - FX_BOOL IsWorking() const; void Reset(); - IFX_Edit_UndoItem* GetItem(int32_t nIndex); - int32_t GetItemCount() { return m_UndoItemStack.GetSize(); } - int32_t GetCurUndoPos() { return m_nCurUndoPos; } - private: - void SetBufSize(int32_t nSize) { m_nBufSize = nSize; } - int32_t GetBufSize() { return m_nBufSize; } - void RemoveHeads(); void RemoveTails(); @@ -192,7 +146,6 @@ class CFX_Edit_UndoItem : public IFX_Edit_UndoItem { CFX_WideString GetUndoTitle() override; void SetFirst(FX_BOOL bFirst); - FX_BOOL IsFirst(); void SetLast(FX_BOOL bLast); FX_BOOL IsLast(); @@ -380,19 +333,6 @@ class CFX_Edit { const CPVT_WordRange* pRange, CFX_SystemHandler* pSystemHandler, void* pFFLData); - static void DrawUnderline(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device, - CFX_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, - CFX_Edit* pEdit, - const CFX_FloatRect& rcClip, - const CFX_FloatPoint& ptOffset, - const CPVT_WordRange* pRange); static void GeneratePageObjects( CPDF_PageObjectHolder* pObjectHolder, CFX_Edit* pEdit, @@ -400,17 +340,6 @@ class CFX_Edit { const CPVT_WordRange* pRange, FX_COLORREF crText, CFX_ArrayTemplate& ObjArray); - static void GenerateRichPageObjects( - CPDF_PageObjectHolder* pObjectHolder, - CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, - const CPVT_WordRange* pRange, - CFX_ArrayTemplate& ObjArray); - static void GenerateUnderlineObjects(CPDF_PageObjectHolder* pObjectHolder, - CFX_Edit* pEdit, - const CFX_FloatPoint& ptOffset, - const CPVT_WordRange* pRange, - FX_COLORREF color); CFX_Edit(); ~CFX_Edit(); @@ -421,7 +350,6 @@ class CFX_Edit { // Returns an iterator for the contents. Should not be released. CFX_Edit_Iterator* GetIterator(); - CPDF_VariableText* GetVariableText(); IPVT_FontMap* GetFontMap(); void Initialize(); @@ -447,21 +375,6 @@ class CFX_Edit { void SetAutoScroll(FX_BOOL bAuto, FX_BOOL bPaint); void SetFontSize(FX_FLOAT fFontSize); void SetTextOverflow(FX_BOOL bAllowed, FX_BOOL bPaint); - FX_BOOL IsRichText() const; - void SetRichText(FX_BOOL bRichText = TRUE, FX_BOOL bPaint = TRUE); - FX_BOOL SetRichFontSize(FX_FLOAT fFontSize); - FX_BOOL SetRichFontIndex(int32_t nFontIndex); - FX_BOOL SetRichTextColor(FX_COLORREF dwColor); - FX_BOOL SetRichTextScript(CPDF_VariableText::ScriptType nScriptType); - FX_BOOL SetRichTextBold(FX_BOOL bBold = TRUE); - FX_BOOL SetRichTextItalic(FX_BOOL bItalic = TRUE); - FX_BOOL SetRichTextUnderline(FX_BOOL bUnderline = TRUE); - FX_BOOL SetRichTextCrossout(FX_BOOL bCrossout = TRUE); - FX_BOOL SetRichTextCharSpace(FX_FLOAT fCharSpace); - FX_BOOL SetRichTextHorzScale(int32_t nHorzScale = 100); - FX_BOOL SetRichTextLineLeading(FX_FLOAT fLineLeading); - FX_BOOL SetRichTextLineIndent(FX_FLOAT fLineIndent); - FX_BOOL SetRichTextAlignment(int32_t nAlignment); void OnMouseDown(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl); void OnMouseMove(const CFX_FloatPoint& point, FX_BOOL bShift, FX_BOOL bCtrl); void OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl); @@ -481,10 +394,6 @@ class CFX_Edit { FX_BOOL Undo(); int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const; CPVT_WordPlace WordIndexToWordPlace(int32_t index) const; - CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace& place) const; - CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const; - CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace& place) const; - CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const; CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const; int32_t GetCaret() const; CPVT_WordPlace GetCaretWordPlace() const; @@ -494,7 +403,6 @@ class CFX_Edit { uint16_t GetPasswordChar() const; CFX_FloatPoint GetScrollPos() const; int32_t GetCharArray() const; - CFX_FloatRect GetPlateRect() const; CFX_FloatRect GetContentRect() const; CFX_WideString GetRangeText(const CPVT_WordRange& range) const; int32_t GetHorzScale() const; @@ -506,7 +414,6 @@ class CFX_Edit { void SelectNone(); FX_BOOL IsSelected() const; void Paint(); - void EnableNotify(FX_BOOL bNotify); void EnableRefresh(FX_BOOL bRefresh); void RefreshWordRange(const CPVT_WordRange& wr); void SetCaret(int32_t nPos); @@ -518,9 +425,7 @@ class CFX_Edit { FX_BOOL IsTextOverflow() const; FX_BOOL CanUndo() const; FX_BOOL CanRedo() const; - FX_BOOL IsModified() const; CPVT_WordRange GetVisibleWordRange() const; - void AddUndoItem(IFX_Edit_UndoItem* pUndoItem); FX_BOOL Empty(); @@ -573,30 +478,16 @@ class CFX_Edit { inline CFX_FloatPoint VTToEdit(const CFX_FloatPoint& point) const; inline CFX_FloatPoint EditToVT(const CFX_FloatPoint& point) const; inline CFX_FloatRect VTToEdit(const CFX_FloatRect& rect) const; - inline CFX_FloatRect EditToVT(const CFX_FloatRect& rect) const; void Refresh(); void RefreshPushLineRects(const CPVT_WordRange& wr); - void RefreshPushRandomRects(const CPVT_WordRange& wr); void SetCaret(const CPVT_WordPlace& place); void SetCaretInfo(); void SetCaretOrigin(); - CPVT_WordRange GetLatinWordsRange(const CPVT_WordPlace& place) const; - CPVT_WordRange CombineWordRange(const CPVT_WordRange& wr1, - const CPVT_WordRange& wr2); - - void BeginGroupUndo(const CFX_WideString& sTitle); - void EndGroupUndo(); void AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem); - void SetPageInfo(const CPVT_WordPlace& place); - CPVT_WordPlace SearchPageEndPlace(const CPVT_WordPlace& wpPageBegin, - const CFX_FloatPoint& point) const; - FX_FLOAT GetLineTop(const CPVT_WordPlace& place) const; - FX_FLOAT GetLineBottom(const CPVT_WordPlace& place) const; - private: std::unique_ptr m_pVT; CPWL_EditCtrl* m_pNotify; @@ -630,18 +521,13 @@ class CFX_Edit_Iterator { ~CFX_Edit_Iterator(); FX_BOOL NextWord(); - FX_BOOL NextLine(); - FX_BOOL NextSection(); FX_BOOL PrevWord(); - FX_BOOL PrevLine(); - FX_BOOL PrevSection(); FX_BOOL GetWord(CPVT_Word& word) const; FX_BOOL GetLine(CPVT_Line& line) const; FX_BOOL GetSection(CPVT_Section& section) const; void SetAt(int32_t nWordIndex); void SetAt(const CPVT_WordPlace& place); const CPVT_WordPlace& GetAt() const; - CFX_Edit* GetEdit() const; private: CFX_Edit* m_pEdit; -- cgit v1.2.3