diff options
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fde/cfde_txtedtbuf.cpp | 2 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtbuf.h | 2 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtdorecord_deleterange.h | 2 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtengine.cpp | 14 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtengine.h | 20 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtpage.cpp | 4 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtpage.h | 4 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedtparag.cpp | 2 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedttextset.cpp | 6 | ||||
-rw-r--r-- | xfa/fde/cfde_txtedttextset.h | 4 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_txtbreak.cpp | 9 | ||||
-rw-r--r-- | xfa/fgas/layout/cfx_txtbreak.h | 4 | ||||
-rw-r--r-- | xfa/fwl/cfwl_comboedit.cpp | 2 | ||||
-rw-r--r-- | xfa/fwl/cfwl_edit.cpp | 8 |
14 files changed, 32 insertions, 51 deletions
diff --git a/xfa/fde/cfde_txtedtbuf.cpp b/xfa/fde/cfde_txtedtbuf.cpp index f1c73a9529..101385b143 100644 --- a/xfa/fde/cfde_txtedtbuf.cpp +++ b/xfa/fde/cfde_txtedtbuf.cpp @@ -344,7 +344,7 @@ bool CFDE_TxtEdtBuf::Iterator::IsEOF(bool bTail) const { } std::unique_ptr<IFX_CharIter> CFDE_TxtEdtBuf::Iterator::Clone() { - auto pIter = pdfium::MakeUnique<CFDE_TxtEdtBuf::Iterator>(m_pBuf); + auto pIter = pdfium::MakeUnique<CFDE_TxtEdtBuf::Iterator>(m_pBuf, 0); pIter->m_nCurChunk = m_nCurChunk; pIter->m_nCurIndex = m_nCurIndex; pIter->m_nIndex = m_nIndex; diff --git a/xfa/fde/cfde_txtedtbuf.h b/xfa/fde/cfde_txtedtbuf.h index 39187f48a3..3fbcd4b9d0 100644 --- a/xfa/fde/cfde_txtedtbuf.h +++ b/xfa/fde/cfde_txtedtbuf.h @@ -19,7 +19,7 @@ class CFDE_TxtEdtBuf { public: class Iterator : public IFX_CharIter { public: - explicit Iterator(CFDE_TxtEdtBuf* pBuf, wchar_t wcAlias = 0); + Iterator(CFDE_TxtEdtBuf* pBuf, wchar_t wcAlias); ~Iterator() override; bool Next(bool bPrev = false) override; diff --git a/xfa/fde/cfde_txtedtdorecord_deleterange.h b/xfa/fde/cfde_txtedtdorecord_deleterange.h index f7d7955940..7e1ab1021a 100644 --- a/xfa/fde/cfde_txtedtdorecord_deleterange.h +++ b/xfa/fde/cfde_txtedtdorecord_deleterange.h @@ -19,7 +19,7 @@ class CFDE_TxtEdtDoRecord_DeleteRange : public IFDE_TxtEdtDoRecord { int32_t nIndex, int32_t nCaret, const CFX_WideString& wsRange, - bool bSel = false); + bool bSel); ~CFDE_TxtEdtDoRecord_DeleteRange() override; bool Undo() const override; diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp index 4701d452aa..1e1f86962d 100644 --- a/xfa/fde/cfde_txtedtengine.cpp +++ b/xfa/fde/cfde_txtedtengine.cpp @@ -186,7 +186,7 @@ CFX_WideString CFDE_TxtEdtEngine::GetText(int32_t nStart, } void CFDE_TxtEdtEngine::ClearText() { - DeleteRange(0, -1); + DeleteRange(0, GetTextBufLength()); } int32_t CFDE_TxtEdtEngine::GetCaretRect(CFX_RectF& rtCaret) const { @@ -430,8 +430,8 @@ int32_t CFDE_TxtEdtEngine::Delete(int32_t nStart, bool bBackspace) { } CFX_WideString wsRange = m_pTxtBuf->GetRange(nStart, nCount); m_Param.pEventSink->OnAddDoRecord( - pdfium::MakeUnique<CFDE_TxtEdtDoRecord_DeleteRange>(this, nStart, - m_nCaret, wsRange)); + pdfium::MakeUnique<CFDE_TxtEdtDoRecord_DeleteRange>( + this, nStart, m_nCaret, wsRange, false)); m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Delete; m_ChangeInfo.wsDelete = GetText(nStart, nCount); @@ -442,11 +442,9 @@ int32_t CFDE_TxtEdtEngine::Delete(int32_t nStart, bool bBackspace) { return FDE_TXTEDT_MODIFY_RET_S_Normal; } -int32_t CFDE_TxtEdtEngine::DeleteRange(int32_t nStart, int32_t nCount) { +int32_t CFDE_TxtEdtEngine::DeleteRange(int32_t nStart, size_t nCount) { if (IsLocked()) return FDE_TXTEDT_MODIFY_RET_F_Locked; - if (nCount == -1) - nCount = GetTextBufLength(); if (nCount == 0) return FDE_TXTEDT_MODIFY_RET_S_Normal; if (m_Param.dwMode & FDE_TEXTEDITMODE_Validate) { @@ -454,7 +452,7 @@ int32_t CFDE_TxtEdtEngine::DeleteRange(int32_t nStart, int32_t nCount) { if (!m_Param.pEventSink->OnValidate(wsText)) return FDE_TXTEDT_MODIFY_RET_F_Invalidate; } - DeleteRange_DoRecord(nStart, nCount); + DeleteRange_DoRecord(nStart, nCount, false); m_Param.pEventSink->OnTextChanged(m_ChangeInfo); SetCaretPos(nStart, true); return FDE_TXTEDT_MODIFY_RET_S_Normal; @@ -903,7 +901,7 @@ void CFDE_TxtEdtEngine::RebuildParagraphs() { wchar_t wChar = L' '; int32_t nParagStart = 0; int32_t nIndex = 0; - auto pIter = pdfium::MakeUnique<CFDE_TxtEdtBuf::Iterator>(m_pTxtBuf.get()); + auto pIter = pdfium::MakeUnique<CFDE_TxtEdtBuf::Iterator>(m_pTxtBuf.get(), 0); pIter->SetAt(0); do { wChar = pIter->GetChar(); diff --git a/xfa/fde/cfde_txtedtengine.h b/xfa/fde/cfde_txtedtengine.h index 2a38e4ea81..0bbbbcee89 100644 --- a/xfa/fde/cfde_txtedtengine.h +++ b/xfa/fde/cfde_txtedtengine.h @@ -110,16 +110,14 @@ class CFDE_TxtEdtEngine { int32_t GetCaretRect(CFX_RectF& rtCaret) const; int32_t GetCaretPos() const; int32_t SetCaretPos(int32_t nIndex, bool bBefore); - int32_t MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret, - bool bShift = false, - bool bCtrl = false); + int32_t MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret, bool bShift, bool bCtrl); void Lock(); void Unlock(); bool IsLocked() const; int32_t Insert(int32_t nStart, const wchar_t* lpText, int32_t nLength); - int32_t Delete(int32_t nStart, bool bBackspace = false); - int32_t DeleteRange(int32_t nStart, int32_t nCount = -1); + int32_t Delete(int32_t nStart, bool bBackspace); + int32_t DeleteRange(int32_t nStart, size_t nCount); int32_t Replace(int32_t nStart, int32_t nLength, const CFX_WideString& wsReplace); @@ -180,8 +178,8 @@ class CFDE_TxtEdtEngine { const wchar_t* lpText, int32_t nLength); - void Inner_DeleteRange(int32_t nStart, int32_t nCount = -1); - void DeleteRange_DoRecord(int32_t nStart, int32_t nCount, bool bSel = false); + void Inner_DeleteRange(int32_t nStart, int32_t nCount); + void DeleteRange_DoRecord(int32_t nStart, int32_t nCount, bool bSel); void ResetEngine(); void RebuildParagraphs(); void RemoveAllParags(); @@ -190,9 +188,7 @@ class CFDE_TxtEdtEngine { void UpdatePages(); void UpdateTxtBreak(); - bool ReplaceParagEnd(wchar_t*& lpText, - int32_t& nLength, - bool bPreIsCR = false); + bool ReplaceParagEnd(wchar_t*& lpText, int32_t& nLength, bool bPreIsCR); void RecoverParagEnd(CFX_WideString& wsText) const; int32_t MovePage2Char(int32_t nIndex); void TextPos2ParagPos(int32_t nIndex, FDE_TXTEDTPARAGPOS& ParagPos) const; @@ -205,11 +201,11 @@ class CFDE_TxtEdtEngine { bool MoveHome(); bool MoveEnd(); bool IsFitArea(CFX_WideString& wsText); - void UpdateCaretRect(int32_t nIndex, bool bBefore = true); + void UpdateCaretRect(int32_t nIndex, bool bBefore); void GetCaretRect(CFX_RectF& rtCaret, int32_t nPageIndex, int32_t nCaret, - bool bBefore = true); + bool bBefore); void UpdateCaretIndex(const CFX_PointF& ptCaret); bool IsSelect(); diff --git a/xfa/fde/cfde_txtedtpage.cpp b/xfa/fde/cfde_txtedtpage.cpp index bfe30baa19..6f86b8a682 100644 --- a/xfa/fde/cfde_txtedtpage.cpp +++ b/xfa/fde/cfde_txtedtpage.cpp @@ -147,7 +147,7 @@ int32_t CFDE_TxtEdtPage::GetDisplayPos(const CFX_RectF& rtClip, if (!rtClip.IntersectWith(m_pTextSet->GetRect(piece))) continue; - int32_t nCount = m_pTextSet->GetDisplayPos(piece, pos, false); + int32_t nCount = m_pTextSet->GetDisplayPos(piece, pos); nCharPosCount += nCount; pos += nCount; } @@ -211,7 +211,7 @@ int32_t CFDE_TxtEdtPage::SelectWord(const CFX_PointF& fPoint, int32_t& nCount) { return -1; } auto pIter = pdfium::MakeUnique<CFX_WordBreak>(); - pIter->Attach(new CFDE_TxtEdtBuf::Iterator(pBuf)); + pIter->Attach(new CFDE_TxtEdtBuf::Iterator(pBuf, 0)); pIter->SetAt(nIndex); nCount = pIter->GetWordLength(); return pIter->GetWordPos(); diff --git a/xfa/fde/cfde_txtedtpage.h b/xfa/fde/cfde_txtedtpage.h index c118fe2fee..e635ac726a 100644 --- a/xfa/fde/cfde_txtedtpage.h +++ b/xfa/fde/cfde_txtedtpage.h @@ -43,9 +43,7 @@ class CFDE_TxtEdtPage { CFX_RectF GetRect(const FDE_TEXTEDITPIECE& pPiece); CFDE_TxtEdtEngine* GetEngine() const; - int32_t GetCharRect(int32_t nIndex, - CFX_RectF& rect, - bool bBBox = false) const; + int32_t GetCharRect(int32_t nIndex, CFX_RectF& rect, bool bBBox) const; int32_t GetCharIndex(const CFX_PointF& fPoint, bool& bBefore); void CalcRangeRectArray(int32_t nStart, int32_t nCount, diff --git a/xfa/fde/cfde_txtedtparag.cpp b/xfa/fde/cfde_txtedtparag.cpp index 31b935759f..3c1c2adbda 100644 --- a/xfa/fde/cfde_txtedtparag.cpp +++ b/xfa/fde/cfde_txtedtparag.cpp @@ -109,7 +109,7 @@ void CFDE_TxtEdtParag::CalcLines() { CFX_BreakType dwBreakStatus = CFX_BreakType::None; int32_t nEndIndex = m_nCharStart + m_nCharCount; auto pIter = pdfium::MakeUnique<CFDE_TxtEdtBuf::Iterator>( - static_cast<CFDE_TxtEdtBuf*>(pTxtBuf)); + static_cast<CFDE_TxtEdtBuf*>(pTxtBuf), 0); pIter->SetAt(m_nCharStart); bool bReload = false; do { diff --git a/xfa/fde/cfde_txtedttextset.cpp b/xfa/fde/cfde_txtedttextset.cpp index 54fedda6a2..a68df2858c 100644 --- a/xfa/fde/cfde_txtedttextset.cpp +++ b/xfa/fde/cfde_txtedttextset.cpp @@ -42,9 +42,7 @@ FX_ARGB CFDE_TxtEdtTextSet::GetFontColor() const { } int32_t CFDE_TxtEdtTextSet::GetDisplayPos(const FDE_TEXTEDITPIECE& piece, - FXTEXT_CHARPOS* pCharPos, - bool bCharCode, - CFX_WideString* pWSForms) const { + FXTEXT_CHARPOS* pCharPos) const { int32_t nLength = piece.nCount; if (nLength < 1) return 0; @@ -64,7 +62,7 @@ int32_t CFDE_TxtEdtTextSet::GetDisplayPos(const FDE_TEXTEDITPIECE& piece, tr.dwCharStyles = piece.dwCharStyles; tr.pRect = &piece.rtPiece; tr.wLineBreakChar = pTextParams->wLineBreakChar; - return pBreak->GetDisplayPos(&tr, pCharPos, bCharCode, pWSForms); + return pBreak->GetDisplayPos(&tr, pCharPos); } std::vector<CFX_RectF> CFDE_TxtEdtTextSet::GetCharRects( diff --git a/xfa/fde/cfde_txtedttextset.h b/xfa/fde/cfde_txtedttextset.h index 71e1169dfb..40c5623382 100644 --- a/xfa/fde/cfde_txtedttextset.h +++ b/xfa/fde/cfde_txtedttextset.h @@ -24,9 +24,7 @@ class CFDE_TxtEdtTextSet { float GetFontSize() const; FX_ARGB GetFontColor() const; int32_t GetDisplayPos(const FDE_TEXTEDITPIECE& pPiece, - FXTEXT_CHARPOS* pCharPos, - bool bCharCode = false, - CFX_WideString* pWSForms = nullptr) const; + FXTEXT_CHARPOS* pCharPos) const; std::vector<CFX_RectF> GetCharRects(const FDE_TEXTEDITPIECE* pPiece, bool bBBox) const; diff --git a/xfa/fgas/layout/cfx_txtbreak.cpp b/xfa/fgas/layout/cfx_txtbreak.cpp index 9e4e445e0a..b2c54e5c6d 100644 --- a/xfa/fgas/layout/cfx_txtbreak.cpp +++ b/xfa/fgas/layout/cfx_txtbreak.cpp @@ -634,9 +634,7 @@ struct FX_FORMCHAR { }; int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, - FXTEXT_CHARPOS* pCharPos, - bool bCharCode, - CFX_WideString* pWSForms) const { + FXTEXT_CHARPOS* pCharPos) const { if (!pTxtRun || pTxtRun->iLength < 1) return 0; @@ -822,14 +820,11 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, wLast = (wchar_t)formChars[j - 1].wForm; } if (!bEmptyChar || (bEmptyChar && !bSkipSpace)) { - pCharPos->m_GlyphIndex = - bCharCode ? wch : pFont->GetGlyphIndex(wForm, false); + pCharPos->m_GlyphIndex = pFont->GetGlyphIndex(wForm, false); #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ pCharPos->m_ExtGID = pCharPos->m_GlyphIndex; #endif pCharPos->m_FontCharWidth = iCharWidth; - if (pWSForms) - *pWSForms += wForm; } int32_t iCharHeight = 1000; diff --git a/xfa/fgas/layout/cfx_txtbreak.h b/xfa/fgas/layout/cfx_txtbreak.h index 0529c2656c..d74ea350fe 100644 --- a/xfa/fgas/layout/cfx_txtbreak.h +++ b/xfa/fgas/layout/cfx_txtbreak.h @@ -66,9 +66,7 @@ class CFX_TxtBreak : public CFX_Break { CFX_BreakType EndBreak(CFX_BreakType dwStatus); int32_t GetDisplayPos(const FX_TXTRUN* pTxtRun, - FXTEXT_CHARPOS* pCharPos, - bool bCharCode = false, - CFX_WideString* pWSForms = nullptr) const; + FXTEXT_CHARPOS* pCharPos) const; std::vector<CFX_RectF> GetCharRects(const FX_TXTRUN* pTxtRun, bool bCharBBox = false) const; CFX_BreakType AppendChar(wchar_t wch); diff --git a/xfa/fwl/cfwl_comboedit.cpp b/xfa/fwl/cfwl_comboedit.cpp index 22ad6bff32..e7a2c6eb8f 100644 --- a/xfa/fwl/cfwl_comboedit.cpp +++ b/xfa/fwl/cfwl_comboedit.cpp @@ -28,7 +28,7 @@ void CFWL_ComboEdit::ClearSelected() { void CFWL_ComboEdit::SetSelected() { FlagFocus(true); - GetTxtEdtEngine()->MoveCaretPos(MC_End); + GetTxtEdtEngine()->MoveCaretPos(MC_End, false, false); AddSelRange(0); } diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp index 526275313f..92d8c0266b 100644 --- a/xfa/fwl/cfwl_edit.cpp +++ b/xfa/fwl/cfwl_edit.cpp @@ -348,7 +348,7 @@ bool CFWL_Edit::Cut(CFX_WideString& wsCut) { wsCut += wsTemp; wsTemp.clear(); } - m_EdtEngine.Delete(0); + m_EdtEngine.Delete(0, false); return true; } @@ -623,13 +623,13 @@ void CFWL_Edit::RenderText(CFX_RenderDevice* pRenderDev, if (!rtDocClip.IntersectWith(pTextSet->GetRect(pText))) continue; - int32_t iCount = pTextSet->GetDisplayPos(pText, nullptr, false); + int32_t iCount = pTextSet->GetDisplayPos(pText, nullptr); if (iCount < 1) continue; if (char_pos.size() < static_cast<size_t>(iCount)) char_pos.resize(iCount, FXTEXT_CHARPOS()); - iCount = pTextSet->GetDisplayPos(pText, char_pos.data(), false); + iCount = pTextSet->GetDisplayPos(pText, char_pos.data()); CFDE_TextOut::DrawString(pRenderDev, pTextSet->GetFontColor(), pFont, char_pos.data(), iCount, pTextSet->GetFontSize(), &mt); @@ -1432,7 +1432,7 @@ void CFWL_Edit::OnKeyDown(CFWL_MessageKey* pMsg) { #if (_FX_OS_ == _FX_MACOSX_) m_EdtEngine.Delete(nCaret, true); #else - m_EdtEngine.Delete(nCaret); + m_EdtEngine.Delete(nCaret, false); #endif break; } |