diff options
Diffstat (limited to 'fpdfsdk/fxedit')
-rw-r--r-- | fpdfsdk/fxedit/fxet_edit.cpp | 314 | ||||
-rw-r--r-- | fpdfsdk/fxedit/fxet_edit.h | 152 | ||||
-rw-r--r-- | fpdfsdk/fxedit/fxet_list.cpp | 100 | ||||
-rw-r--r-- | fpdfsdk/fxedit/fxet_list.h | 50 |
4 files changed, 308 insertions, 308 deletions
diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp index d4b159cf0a..ececa0b9a3 100644 --- a/fpdfsdk/fxedit/fxet_edit.cpp +++ b/fpdfsdk/fxedit/fxet_edit.cpp @@ -164,42 +164,42 @@ CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit* pEdit, CFX_Edit_Iterator::~CFX_Edit_Iterator() {} -FX_BOOL CFX_Edit_Iterator::NextWord() { +bool CFX_Edit_Iterator::NextWord() { return m_pVTIterator->NextWord(); } -FX_BOOL CFX_Edit_Iterator::PrevWord() { +bool CFX_Edit_Iterator::PrevWord() { return m_pVTIterator->PrevWord(); } -FX_BOOL CFX_Edit_Iterator::GetWord(CPVT_Word& word) const { +bool CFX_Edit_Iterator::GetWord(CPVT_Word& word) const { ASSERT(m_pEdit); if (m_pVTIterator->GetWord(word)) { word.ptWord = m_pEdit->VTToEdit(word.ptWord); - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL CFX_Edit_Iterator::GetLine(CPVT_Line& line) const { +bool CFX_Edit_Iterator::GetLine(CPVT_Line& line) const { ASSERT(m_pEdit); if (m_pVTIterator->GetLine(line)) { line.ptLine = m_pEdit->VTToEdit(line.ptLine); - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL CFX_Edit_Iterator::GetSection(CPVT_Section& section) const { +bool CFX_Edit_Iterator::GetSection(CPVT_Section& section) const { ASSERT(m_pEdit); if (m_pVTIterator->GetSection(section)) { section.rcSection = m_pEdit->VTToEdit(section.rcSection); - return TRUE; + return true; } - return FALSE; + return false; } void CFX_Edit_Iterator::SetAt(int32_t nWordIndex) { @@ -265,7 +265,7 @@ int32_t CFX_Edit_Provider::GetDefaultFontIndex() { return 0; } -FX_BOOL CFX_Edit_Provider::IsLatinWord(uint16_t word) { +bool CFX_Edit_Provider::IsLatinWord(uint16_t word) { return FX_EDIT_ISLATINWORD(word); } @@ -312,20 +312,20 @@ void CFX_Edit_Refresh::EndRefresh() { CFX_Edit_Undo::CFX_Edit_Undo(int32_t nBufsize) : m_nCurUndoPos(0), m_nBufSize(nBufsize), - m_bModified(FALSE), - m_bVirgin(TRUE), - m_bWorking(FALSE) {} + m_bModified(false), + m_bVirgin(true), + m_bWorking(false) {} CFX_Edit_Undo::~CFX_Edit_Undo() { Reset(); } -FX_BOOL CFX_Edit_Undo::CanUndo() const { +bool CFX_Edit_Undo::CanUndo() const { return m_nCurUndoPos > 0; } void CFX_Edit_Undo::Undo() { - m_bWorking = TRUE; + m_bWorking = true; if (m_nCurUndoPos > 0) { IFX_Edit_UndoItem* pItem = m_UndoItemStack.GetAt(m_nCurUndoPos - 1); @@ -335,15 +335,15 @@ void CFX_Edit_Undo::Undo() { m_bModified = (m_nCurUndoPos != 0); } - m_bWorking = FALSE; + m_bWorking = false; } -FX_BOOL CFX_Edit_Undo::CanRedo() const { +bool CFX_Edit_Undo::CanRedo() const { return m_nCurUndoPos < m_UndoItemStack.GetSize(); } void CFX_Edit_Undo::Redo() { - m_bWorking = TRUE; + m_bWorking = true; int32_t nStackSize = m_UndoItemStack.GetSize(); @@ -355,7 +355,7 @@ void CFX_Edit_Undo::Redo() { m_bModified = (m_nCurUndoPos != 0); } - m_bWorking = FALSE; + m_bWorking = false; } void CFX_Edit_Undo::AddItem(IFX_Edit_UndoItem* pItem) { @@ -368,7 +368,7 @@ void CFX_Edit_Undo::AddItem(IFX_Edit_UndoItem* pItem) { if (m_UndoItemStack.GetSize() >= m_nBufSize) { RemoveHeads(); - m_bVirgin = FALSE; + m_bVirgin = false; } m_UndoItemStack.Add(pItem); @@ -377,8 +377,8 @@ void CFX_Edit_Undo::AddItem(IFX_Edit_UndoItem* pItem) { m_bModified = (m_nCurUndoPos != 0); } -FX_BOOL CFX_Edit_Undo::IsModified() const { - return m_bVirgin ? m_bModified : TRUE; +bool CFX_Edit_Undo::IsModified() const { + return m_bVirgin ? m_bModified : true; } void CFX_Edit_Undo::RemoveHeads() { @@ -403,7 +403,7 @@ void CFX_Edit_Undo::Reset() { m_UndoItemStack.RemoveAll(); } -CFX_Edit_UndoItem::CFX_Edit_UndoItem() : m_bFirst(TRUE), m_bLast(TRUE) {} +CFX_Edit_UndoItem::CFX_Edit_UndoItem() : m_bFirst(true), m_bLast(true) {} CFX_Edit_UndoItem::~CFX_Edit_UndoItem() {} @@ -411,15 +411,15 @@ CFX_WideString CFX_Edit_UndoItem::GetUndoTitle() { return L""; } -void CFX_Edit_UndoItem::SetFirst(FX_BOOL bFirst) { +void CFX_Edit_UndoItem::SetFirst(bool bFirst) { m_bFirst = bFirst; } -void CFX_Edit_UndoItem::SetLast(FX_BOOL bLast) { +void CFX_Edit_UndoItem::SetLast(bool bLast) { m_bLast = bLast; } -FX_BOOL CFX_Edit_UndoItem::IsLast() { +bool CFX_Edit_UndoItem::IsLast() { return m_bLast; } @@ -435,8 +435,8 @@ CFX_Edit_GroupUndoItem::~CFX_Edit_GroupUndoItem() { } void CFX_Edit_GroupUndoItem::AddUndoItem(CFX_Edit_UndoItem* pUndoItem) { - pUndoItem->SetFirst(FALSE); - pUndoItem->SetLast(FALSE); + pUndoItem->SetFirst(false); + pUndoItem->SetLast(false); m_Items.Add(pUndoItem); @@ -447,10 +447,10 @@ void CFX_Edit_GroupUndoItem::AddUndoItem(CFX_Edit_UndoItem* pUndoItem) { void CFX_Edit_GroupUndoItem::UpdateItems() { if (m_Items.GetSize() > 0) { CFX_Edit_UndoItem* pFirstItem = m_Items[0]; - pFirstItem->SetFirst(TRUE); + pFirstItem->SetFirst(true); CFX_Edit_UndoItem* pLastItem = m_Items[m_Items.GetSize() - 1]; - pLastItem->SetLast(TRUE); + pLastItem->SetLast(true); } } @@ -494,7 +494,7 @@ void CFXEU_InsertWord::Redo() { if (m_pEdit) { 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, &m_WordProps, false, true); } } @@ -502,7 +502,7 @@ void CFXEU_InsertWord::Undo() { if (m_pEdit) { m_pEdit->SelectNone(); m_pEdit->SetCaret(m_wpNew); - m_pEdit->Backspace(FALSE, TRUE); + m_pEdit->Backspace(false, true); } } @@ -528,7 +528,7 @@ void CFXEU_InsertReturn::Redo() { if (m_pEdit) { m_pEdit->SelectNone(); m_pEdit->SetCaret(m_wpOld); - m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, FALSE, TRUE); + m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, false, true); } } @@ -536,7 +536,7 @@ void CFXEU_InsertReturn::Undo() { if (m_pEdit) { m_pEdit->SelectNone(); m_pEdit->SetCaret(m_wpNew); - m_pEdit->Backspace(FALSE, TRUE); + m_pEdit->Backspace(false, true); } } @@ -561,7 +561,7 @@ void CFXEU_Backspace::Redo() { if (m_pEdit) { m_pEdit->SelectNone(); m_pEdit->SetCaret(m_wpOld); - m_pEdit->Backspace(FALSE, TRUE); + m_pEdit->Backspace(false, true); } } @@ -570,9 +570,9 @@ void CFXEU_Backspace::Undo() { m_pEdit->SelectNone(); m_pEdit->SetCaret(m_wpNew); if (m_wpNew.SecCmp(m_wpOld) != 0) { - m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, FALSE, TRUE); + m_pEdit->InsertReturn(&m_SecProps, &m_WordProps, false, true); } else { - m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, FALSE, TRUE); + m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, false, true); } } } @@ -584,7 +584,7 @@ CFXEU_Delete::CFXEU_Delete(CFX_Edit* pEdit, int32_t charset, const CPVT_SecProps& SecProps, const CPVT_WordProps& WordProps, - FX_BOOL bSecEnd) + bool bSecEnd) : m_pEdit(pEdit), m_wpOld(wpOldPlace), m_wpNew(wpNewPlace), @@ -600,7 +600,7 @@ void CFXEU_Delete::Redo() { if (m_pEdit) { m_pEdit->SelectNone(); m_pEdit->SetCaret(m_wpOld); - m_pEdit->Delete(FALSE, TRUE); + m_pEdit->Delete(false, true); } } @@ -609,9 +609,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(&m_SecProps, &m_WordProps, false, true); } else { - m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, FALSE, TRUE); + m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, false, true); } } } @@ -627,7 +627,7 @@ void CFXEU_Clear::Redo() { if (m_pEdit) { m_pEdit->SelectNone(); m_pEdit->SetSel(m_wrSel.BeginPos, m_wrSel.EndPos); - m_pEdit->Clear(FALSE, TRUE); + m_pEdit->Clear(false, true); } } @@ -635,7 +635,7 @@ void CFXEU_Clear::Undo() { if (m_pEdit) { m_pEdit->SelectNone(); m_pEdit->SetCaret(m_wrSel.BeginPos); - m_pEdit->InsertText(m_swText, FXFONT_DEFAULT_CHARSET, FALSE, TRUE); + m_pEdit->InsertText(m_swText, FXFONT_DEFAULT_CHARSET, false, true); m_pEdit->SetSel(m_wrSel.BeginPos, m_wrSel.EndPos); } } @@ -657,7 +657,7 @@ void CFXEU_InsertText::Redo() { if (m_pEdit && IsLast()) { m_pEdit->SelectNone(); m_pEdit->SetCaret(m_wpOld); - m_pEdit->InsertText(m_swText, m_nCharset, FALSE, TRUE); + m_pEdit->InsertText(m_swText, m_nCharset, false, true); } } @@ -665,7 +665,7 @@ void CFXEU_InsertText::Undo() { if (m_pEdit) { m_pEdit->SelectNone(); m_pEdit->SetSel(m_wpOld, m_wpNew); - m_pEdit->Clear(FALSE, TRUE); + m_pEdit->Clear(false, true); } } @@ -673,7 +673,7 @@ void CFXEU_InsertText::Undo() { CFX_ByteString CFX_Edit::GetEditAppearanceStream(CFX_Edit* pEdit, const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange, - FX_BOOL bContinuous, + bool bContinuous, uint16_t SubWord) { CFX_Edit_Iterator* pIterator = pEdit->GetIterator(); if (pRange) @@ -833,7 +833,7 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, FX_COLORREF crCurFill = crTextFill; FX_COLORREF crOldFill = crCurFill; - FX_BOOL bSelect = FALSE; + bool bSelect = false; const FX_COLORREF crWhite = ArgbEncode(255, 255, 255, 255); const FX_COLORREF crSelBK = ArgbEncode(255, 0, 51, 113); @@ -1005,15 +1005,15 @@ CFX_Edit::CFX_Edit() m_wpCaret(-1, -1, -1), m_wpOldCaret(-1, -1, -1), m_SelState(), - m_bEnableScroll(FALSE), + m_bEnableScroll(false), m_Undo(kEditUndoMaxItems), m_nAlignment(0), - m_bNotifyFlag(FALSE), - m_bEnableOverflow(FALSE), - m_bEnableRefresh(TRUE), + m_bNotifyFlag(false), + m_bEnableOverflow(false), + m_bEnableRefresh(true), m_rcOldContent(0.0f, 0.0f, 0.0f, 0.0f), - m_bEnableUndo(TRUE), - m_bOprNotify(FALSE), + m_bEnableUndo(true), + m_bOprNotify(false), m_pGroupUndoItem(nullptr) {} CFX_Edit::~CFX_Edit() { @@ -1057,19 +1057,19 @@ void CFX_Edit::SetPlateRect(const CFX_FloatRect& rect) { Paint(); } -void CFX_Edit::SetAlignmentH(int32_t nFormat, FX_BOOL bPaint) { +void CFX_Edit::SetAlignmentH(int32_t nFormat, bool bPaint) { m_pVT->SetAlignment(nFormat); if (bPaint) Paint(); } -void CFX_Edit::SetAlignmentV(int32_t nFormat, FX_BOOL bPaint) { +void CFX_Edit::SetAlignmentV(int32_t nFormat, bool bPaint) { m_nAlignment = nFormat; if (bPaint) Paint(); } -void CFX_Edit::SetPasswordChar(uint16_t wSubWord, FX_BOOL bPaint) { +void CFX_Edit::SetPasswordChar(uint16_t wSubWord, bool bPaint) { m_pVT->SetPasswordChar(wSubWord); if (bPaint) Paint(); @@ -1090,19 +1090,19 @@ void CFX_Edit::SetCharSpace(FX_FLOAT fCharSpace) { Paint(); } -void CFX_Edit::SetMultiLine(FX_BOOL bMultiLine, FX_BOOL bPaint) { +void CFX_Edit::SetMultiLine(bool bMultiLine, bool bPaint) { m_pVT->SetMultiLine(bMultiLine); if (bPaint) Paint(); } -void CFX_Edit::SetAutoReturn(FX_BOOL bAuto, FX_BOOL bPaint) { +void CFX_Edit::SetAutoReturn(bool bAuto, bool bPaint) { m_pVT->SetAutoReturn(bAuto); if (bPaint) Paint(); } -void CFX_Edit::SetAutoFontSize(FX_BOOL bAuto, FX_BOOL bPaint) { +void CFX_Edit::SetAutoFontSize(bool bAuto, bool bPaint) { m_pVT->SetAutoFontSize(bAuto); if (bPaint) Paint(); @@ -1113,13 +1113,13 @@ void CFX_Edit::SetFontSize(FX_FLOAT fFontSize) { Paint(); } -void CFX_Edit::SetAutoScroll(FX_BOOL bAuto, FX_BOOL bPaint) { +void CFX_Edit::SetAutoScroll(bool bAuto, bool bPaint) { m_bEnableScroll = bAuto; if (bPaint) Paint(); } -void CFX_Edit::SetTextOverflow(FX_BOOL bAllowed, FX_BOOL bPaint) { +void CFX_Edit::SetTextOverflow(bool bAllowed, bool bPaint) { m_bEnableOverflow = bAllowed; if (bPaint) Paint(); @@ -1279,28 +1279,28 @@ void CFX_Edit::SetText(const CFX_WideString& sText) { Paint(); } -FX_BOOL CFX_Edit::InsertWord(uint16_t word, int32_t charset) { - return InsertWord(word, charset, nullptr, TRUE, TRUE); +bool CFX_Edit::InsertWord(uint16_t word, int32_t charset) { + return InsertWord(word, charset, nullptr, true, true); } -FX_BOOL CFX_Edit::InsertReturn() { - return InsertReturn(nullptr, nullptr, TRUE, TRUE); +bool CFX_Edit::InsertReturn() { + return InsertReturn(nullptr, nullptr, true, true); } -FX_BOOL CFX_Edit::Backspace() { - return Backspace(TRUE, TRUE); +bool CFX_Edit::Backspace() { + return Backspace(true, true); } -FX_BOOL CFX_Edit::Delete() { - return Delete(TRUE, TRUE); +bool CFX_Edit::Delete() { + return Delete(true, true); } -FX_BOOL CFX_Edit::Clear() { - return Clear(TRUE, TRUE); +bool CFX_Edit::Clear() { + return Clear(true, true); } -FX_BOOL CFX_Edit::InsertText(const CFX_WideString& sText, int32_t charset) { - return InsertText(sText, charset, TRUE, TRUE); +bool CFX_Edit::InsertText(const CFX_WideString& sText, int32_t charset) { + return InsertText(sText, charset, true, true); } FX_FLOAT CFX_Edit::GetFontSize() const { @@ -1396,9 +1396,9 @@ void CFX_Edit::SetContentChanged() { if (rcContent.Width() != m_rcOldContent.Width() || rcContent.Height() != m_rcOldContent.Height()) { if (!m_bNotifyFlag) { - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; m_pNotify->IOnContentChange(rcContent); - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } m_rcOldContent = rcContent; } @@ -1425,7 +1425,7 @@ void CFX_Edit::SelectNone() { } } -FX_BOOL CFX_Edit::IsSelected() const { +bool CFX_Edit::IsSelected() const { return m_SelState.IsExist(); } @@ -1488,11 +1488,11 @@ void CFX_Edit::SetScrollInfo() { CFX_FloatRect rcContent = m_pVT->GetContentRect(); if (!m_bNotifyFlag) { - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top, rcContent.bottom, rcContent.top, rcPlate.Height() / 3, rcPlate.Height()); - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } } } @@ -1520,9 +1520,9 @@ void CFX_Edit::SetScrollPosY(FX_FLOAT fy) { if (m_pNotify) { if (!m_bNotifyFlag) { - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; m_pNotify->IOnSetScrollPosY(fy); - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } } } @@ -1630,12 +1630,12 @@ void CFX_Edit::Refresh() { if (m_pNotify) { if (!m_bNotifyFlag) { - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; if (const CFX_Edit_RectArray* pRects = m_Refresh.GetRefreshRects()) { for (int32_t i = 0, sz = pRects->GetSize(); i < sz; i++) m_pNotify->IOnInvalidateRect(pRects->GetAt(i)); } - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } } @@ -1700,10 +1700,10 @@ void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) { if (m_pNotify) { if (!m_bNotifyFlag) { - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; CFX_FloatRect rcRefresh = VTToEdit(rcWord); m_pNotify->IOnInvalidateRect(&rcRefresh); - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } } } else { @@ -1714,10 +1714,10 @@ void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) { if (m_pNotify) { if (!m_bNotifyFlag) { - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; CFX_FloatRect rcRefresh = VTToEdit(rcLine); m_pNotify->IOnInvalidateRect(&rcRefresh); - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } } @@ -1753,10 +1753,10 @@ void CFX_Edit::SetCaretInfo() { ptFoot.y = line.ptLine.y + line.fLineDescent; } - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; m_pNotify->IOnSetCaret(!m_SelState.IsExist(), VTToEdit(ptHead), VTToEdit(ptFoot), m_wpCaret); - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } } } @@ -1774,8 +1774,8 @@ void CFX_Edit::SetCaret(int32_t nPos) { } void CFX_Edit::OnMouseDown(const CFX_FloatPoint& point, - FX_BOOL bShift, - FX_BOOL bCtrl) { + bool bShift, + bool bCtrl) { if (m_pVT->IsValid()) { SelectNone(); SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); @@ -1788,8 +1788,8 @@ void CFX_Edit::OnMouseDown(const CFX_FloatPoint& point, } void CFX_Edit::OnMouseMove(const CFX_FloatPoint& point, - FX_BOOL bShift, - FX_BOOL bCtrl) { + bool bShift, + bool bCtrl) { if (m_pVT->IsValid()) { SetCaret(m_pVT->SearchWordPlace(EditToVT(point))); @@ -1804,7 +1804,7 @@ void CFX_Edit::OnMouseMove(const CFX_FloatPoint& point, } } -void CFX_Edit::OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_Edit::OnVK_UP(bool bShift, bool bCtrl) { if (m_pVT->IsValid()) { SetCaret(m_pVT->GetUpWordPlace(m_wpCaret, m_ptCaret)); @@ -1828,7 +1828,7 @@ void CFX_Edit::OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) { } } -void CFX_Edit::OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_Edit::OnVK_DOWN(bool bShift, bool bCtrl) { if (m_pVT->IsValid()) { SetCaret(m_pVT->GetDownWordPlace(m_wpCaret, m_ptCaret)); @@ -1852,7 +1852,7 @@ void CFX_Edit::OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) { } } -void CFX_Edit::OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_Edit::OnVK_LEFT(bool bShift, bool bCtrl) { if (m_pVT->IsValid()) { if (bShift) { if (m_wpCaret == m_pVT->GetLineBeginPlace(m_wpCaret) && @@ -1896,7 +1896,7 @@ void CFX_Edit::OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) { } } -void CFX_Edit::OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_Edit::OnVK_RIGHT(bool bShift, bool bCtrl) { if (m_pVT->IsValid()) { if (bShift) { SetCaret(m_pVT->GetNextWordPlace(m_wpCaret)); @@ -1940,7 +1940,7 @@ void CFX_Edit::OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) { } } -void CFX_Edit::OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_Edit::OnVK_HOME(bool bShift, bool bCtrl) { if (m_pVT->IsValid()) { if (bShift) { if (bCtrl) @@ -1980,7 +1980,7 @@ void CFX_Edit::OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) { } } -void CFX_Edit::OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_Edit::OnVK_END(bool bShift, bool bCtrl) { if (m_pVT->IsValid()) { if (bShift) { if (bCtrl) @@ -2020,13 +2020,13 @@ void CFX_Edit::OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) { } } -FX_BOOL CFX_Edit::InsertWord(uint16_t word, - int32_t charset, - const CPVT_WordProps* pWordProps, - FX_BOOL bAddUndo, - FX_BOOL bPaint) { +bool CFX_Edit::InsertWord(uint16_t word, + int32_t charset, + const CPVT_WordProps* pWordProps, + bool bAddUndo, + bool bPaint) { if (IsTextOverflow()) - return FALSE; + return false; if (m_pVT->IsValid()) { m_pVT->UpdateWordPlace(m_wpCaret); @@ -2047,19 +2047,19 @@ FX_BOOL CFX_Edit::InsertWord(uint16_t word, if (m_bOprNotify && m_pOprNotify) m_pOprNotify->OnInsertWord(m_wpCaret, m_wpOldCaret); - return TRUE; + return true; } } - return FALSE; + return false; } -FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps* pSecProps, - const CPVT_WordProps* pWordProps, - FX_BOOL bAddUndo, - FX_BOOL bPaint) { +bool CFX_Edit::InsertReturn(const CPVT_SecProps* pSecProps, + const CPVT_WordProps* pWordProps, + bool bAddUndo, + bool bPaint) { if (IsTextOverflow()) - return FALSE; + return false; if (m_pVT->IsValid()) { m_pVT->UpdateWordPlace(m_wpCaret); @@ -2083,17 +2083,17 @@ FX_BOOL CFX_Edit::InsertReturn(const CPVT_SecProps* pSecProps, if (m_bOprNotify && m_pOprNotify) m_pOprNotify->OnInsertReturn(m_wpCaret, m_wpOldCaret); - return TRUE; + return true; } } - return FALSE; + return false; } -FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) { +bool CFX_Edit::Backspace(bool bAddUndo, bool bPaint) { if (m_pVT->IsValid()) { if (m_wpCaret == m_pVT->GetBeginWordPlace()) - return FALSE; + return false; CPVT_Section section; CPVT_Word word; @@ -2132,17 +2132,17 @@ FX_BOOL CFX_Edit::Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint) { if (m_bOprNotify && m_pOprNotify) m_pOprNotify->OnBackSpace(m_wpCaret, m_wpOldCaret); - return TRUE; + return true; } } - return FALSE; + return false; } -FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) { +bool CFX_Edit::Delete(bool bAddUndo, bool bPaint) { if (m_pVT->IsValid()) { if (m_wpCaret == m_pVT->GetEndWordPlace()) - return FALSE; + return false; CPVT_Section section; CPVT_Word word; @@ -2155,7 +2155,7 @@ FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) { } m_pVT->UpdateWordPlace(m_wpCaret); - FX_BOOL bSecEnd = (m_wpCaret == m_pVT->GetSectionEndPlace(m_wpCaret)); + bool bSecEnd = (m_wpCaret == m_pVT->GetSectionEndPlace(m_wpCaret)); SetCaret(m_pVT->DeleteWord(m_wpCaret)); m_SelState.Set(m_wpCaret, m_wpCaret); @@ -2182,29 +2182,29 @@ FX_BOOL CFX_Edit::Delete(FX_BOOL bAddUndo, FX_BOOL bPaint) { if (m_bOprNotify && m_pOprNotify) m_pOprNotify->OnDelete(m_wpCaret, m_wpOldCaret); - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL CFX_Edit::Empty() { +bool CFX_Edit::Empty() { if (m_pVT->IsValid()) { m_pVT->DeleteWords(GetWholeWordRange()); SetCaret(m_pVT->GetBeginWordPlace()); - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) { +bool CFX_Edit::Clear(bool bAddUndo, bool bPaint) { if (!m_pVT->IsValid()) - return FALSE; + return false; if (!m_SelState.IsExist()) - return FALSE; + return false; CPVT_WordRange range = m_SelState.ConvertToWordRange(); @@ -2226,21 +2226,21 @@ FX_BOOL CFX_Edit::Clear(FX_BOOL bAddUndo, FX_BOOL bPaint) { if (m_bOprNotify && m_pOprNotify) m_pOprNotify->OnClear(m_wpCaret, m_wpOldCaret); - return TRUE; + return true; } -FX_BOOL CFX_Edit::InsertText(const CFX_WideString& sText, - int32_t charset, - FX_BOOL bAddUndo, - FX_BOOL bPaint) { +bool CFX_Edit::InsertText(const CFX_WideString& sText, + int32_t charset, + bool bAddUndo, + bool bPaint) { if (IsTextOverflow()) - return FALSE; + return false; m_pVT->UpdateWordPlace(m_wpCaret); SetCaret(DoInsertText(m_wpCaret, sText, charset)); m_SelState.Set(m_wpCaret, m_wpCaret); if (m_wpCaret == m_wpOldCaret) - return FALSE; + return false; if (bAddUndo && m_bEnableUndo) { AddEditUndoItem( @@ -2253,7 +2253,7 @@ FX_BOOL CFX_Edit::InsertText(const CFX_WideString& sText, if (m_bOprNotify && m_pOprNotify) m_pOprNotify->OnInsertText(m_wpCaret, m_wpOldCaret); - return TRUE; + return true; } void CFX_Edit::PaintInsertText(const CPVT_WordPlace& wpOld, @@ -2267,26 +2267,26 @@ void CFX_Edit::PaintInsertText(const CPVT_WordPlace& wpOld, } } -FX_BOOL CFX_Edit::Redo() { +bool CFX_Edit::Redo() { if (m_bEnableUndo) { if (m_Undo.CanRedo()) { m_Undo.Redo(); - return TRUE; + return true; } } - return FALSE; + return false; } -FX_BOOL CFX_Edit::Undo() { +bool CFX_Edit::Undo() { if (m_bEnableUndo) { if (m_Undo.CanUndo()) { m_Undo.Undo(); - return TRUE; + return true; } } - return FALSE; + return false; } void CFX_Edit::SetCaretOrigin() { @@ -2320,7 +2320,7 @@ CPVT_WordPlace CFX_Edit::WordIndexToWordPlace(int32_t index) const { return CPVT_WordPlace(); } -FX_BOOL CFX_Edit::IsTextFull() const { +bool CFX_Edit::IsTextFull() const { int32_t nTotalWords = m_pVT->GetTotalWords(); int32_t nLimitChar = m_pVT->GetLimitChar(); int32_t nCharArray = m_pVT->GetCharArray(); @@ -2329,48 +2329,48 @@ FX_BOOL CFX_Edit::IsTextFull() const { (nCharArray > 0 && nTotalWords >= nCharArray); } -FX_BOOL CFX_Edit::IsTextOverflow() const { +bool CFX_Edit::IsTextOverflow() const { if (!m_bEnableScroll && !m_bEnableOverflow) { CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); CFX_FloatRect rcContent = m_pVT->GetContentRect(); if (m_pVT->IsMultiLine() && GetTotalLines() > 1 && IsFloatBigger(rcContent.Height(), rcPlate.Height())) { - return TRUE; + return true; } if (IsFloatBigger(rcContent.Width(), rcPlate.Width())) - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL CFX_Edit::CanUndo() const { +bool CFX_Edit::CanUndo() const { if (m_bEnableUndo) { return m_Undo.CanUndo(); } - return FALSE; + return false; } -FX_BOOL CFX_Edit::CanRedo() const { +bool CFX_Edit::CanRedo() const { if (m_bEnableUndo) { return m_Undo.CanRedo(); } - return FALSE; + return false; } -void CFX_Edit::EnableRefresh(FX_BOOL bRefresh) { +void CFX_Edit::EnableRefresh(bool bRefresh) { m_bEnableRefresh = bRefresh; } -void CFX_Edit::EnableUndo(FX_BOOL bUndo) { +void CFX_Edit::EnableUndo(bool bUndo) { m_bEnableUndo = bUndo; } -void CFX_Edit::EnableOprNotify(FX_BOOL bNotify) { +void CFX_Edit::EnableOprNotify(bool bNotify) { m_bOprNotify = bNotify; } @@ -2495,7 +2495,7 @@ void CFX_Edit_Select::SetEndPos(const CPVT_WordPlace& end) { EndPos = end; } -FX_BOOL CFX_Edit_Select::IsExist() const { +bool CFX_Edit_Select::IsExist() const { return BeginPos != EndPos; } diff --git a/fpdfsdk/fxedit/fxet_edit.h b/fpdfsdk/fxedit/fxet_edit.h index 394a2fd3f3..1c3e955024 100644 --- a/fpdfsdk/fxedit/fxet_edit.h +++ b/fpdfsdk/fxedit/fxet_edit.h @@ -96,7 +96,7 @@ class CFX_Edit_Select { void SetEndPos(const CPVT_WordPlace& end); CPVT_WordRange ConvertToWordRange() const; - FX_BOOL IsExist() const; + bool IsExist() const; CPVT_WordPlace BeginPos, EndPos; }; @@ -111,9 +111,9 @@ class CFX_Edit_Undo { void AddItem(IFX_Edit_UndoItem* pItem); - FX_BOOL CanUndo() const; - FX_BOOL CanRedo() const; - FX_BOOL IsModified() const; + bool CanUndo() const; + bool CanRedo() const; + bool IsModified() const; void Reset(); @@ -126,9 +126,9 @@ class CFX_Edit_Undo { int32_t m_nCurUndoPos; int32_t m_nBufSize; - FX_BOOL m_bModified; - FX_BOOL m_bVirgin; - FX_BOOL m_bWorking; + bool m_bModified; + bool m_bVirgin; + bool m_bWorking; }; class IFX_Edit_UndoItem { @@ -147,13 +147,13 @@ class CFX_Edit_UndoItem : public IFX_Edit_UndoItem { CFX_WideString GetUndoTitle() override; - void SetFirst(FX_BOOL bFirst); - void SetLast(FX_BOOL bLast); - FX_BOOL IsLast(); + void SetFirst(bool bFirst); + void SetLast(bool bLast); + bool IsLast(); private: - FX_BOOL m_bFirst; - FX_BOOL m_bLast; + bool m_bFirst; + bool m_bLast; }; class CFX_Edit_GroupUndoItem : public IFX_Edit_UndoItem { @@ -255,7 +255,7 @@ class CFXEU_Delete : public CFX_Edit_UndoItem { int32_t charset, const CPVT_SecProps& SecProps, const CPVT_WordProps& WordProps, - FX_BOOL bSecEnd); + bool bSecEnd); ~CFXEU_Delete() override; // CFX_Edit_UndoItem @@ -271,7 +271,7 @@ class CFXEU_Delete : public CFX_Edit_UndoItem { int32_t m_nCharset; CPVT_SecProps m_SecProps; CPVT_WordProps m_WordProps; - FX_BOOL m_bSecEnd; + bool m_bSecEnd; }; class CFXEU_Clear : public CFX_Edit_UndoItem { @@ -319,7 +319,7 @@ class CFX_Edit { static CFX_ByteString GetEditAppearanceStream(CFX_Edit* pEdit, const CFX_FloatPoint& ptOffset, const CPVT_WordRange* pRange, - FX_BOOL bContinuous, + bool bContinuous, uint16_t SubWord); static CFX_ByteString GetSelectAppearanceStream( CFX_Edit* pEdit, @@ -360,40 +360,40 @@ class CFX_Edit { void SetScrollPos(const CFX_FloatPoint& point); // Set the horizontal text alignment. (nFormat [0:left, 1:middle, 2:right]) - void SetAlignmentH(int32_t nFormat, FX_BOOL bPaint); + void SetAlignmentH(int32_t nFormat, bool bPaint); // Set the vertical text alignment. (nFormat [0:left, 1:middle, 2:right]) - void SetAlignmentV(int32_t nFormat, FX_BOOL bPaint); + void SetAlignmentV(int32_t nFormat, bool bPaint); // Set the substitution character for hidden text. - void SetPasswordChar(uint16_t wSubWord, FX_BOOL bPaint); + void SetPasswordChar(uint16_t wSubWord, bool bPaint); // Set the maximum number of words in the text. void SetLimitChar(int32_t nLimitChar); void SetCharArray(int32_t nCharArray); void SetCharSpace(FX_FLOAT fCharSpace); - void SetMultiLine(FX_BOOL bMultiLine, FX_BOOL bPaint); - void SetAutoReturn(FX_BOOL bAuto, FX_BOOL bPaint); - void SetAutoFontSize(FX_BOOL bAuto, FX_BOOL bPaint); - void SetAutoScroll(FX_BOOL bAuto, FX_BOOL bPaint); + void SetMultiLine(bool bMultiLine, bool bPaint); + void SetAutoReturn(bool bAuto, bool bPaint); + void SetAutoFontSize(bool bAuto, bool bPaint); + void SetAutoScroll(bool bAuto, bool bPaint); void SetFontSize(FX_FLOAT fFontSize); - void SetTextOverflow(FX_BOOL bAllowed, FX_BOOL bPaint); - 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); - void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl); + void SetTextOverflow(bool bAllowed, bool bPaint); + void OnMouseDown(const CFX_FloatPoint& point, bool bShift, bool bCtrl); + void OnMouseMove(const CFX_FloatPoint& point, bool bShift, bool bCtrl); + void OnVK_UP(bool bShift, bool bCtrl); + void OnVK_DOWN(bool bShift, bool bCtrl); + void OnVK_LEFT(bool bShift, bool bCtrl); + void OnVK_RIGHT(bool bShift, bool bCtrl); + void OnVK_HOME(bool bShift, bool bCtrl); + void OnVK_END(bool bShift, bool bCtrl); void SetText(const CFX_WideString& sText); - FX_BOOL InsertWord(uint16_t word, int32_t charset); - FX_BOOL InsertReturn(); - FX_BOOL Backspace(); - FX_BOOL Delete(); - FX_BOOL Clear(); - FX_BOOL InsertText(const CFX_WideString& sText, int32_t charset); - FX_BOOL Redo(); - FX_BOOL Undo(); + bool InsertWord(uint16_t word, int32_t charset); + bool InsertReturn(); + bool Backspace(); + bool Delete(); + bool Clear(); + bool InsertText(const CFX_WideString& sText, int32_t charset); + bool Redo(); + bool Undo(); int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const; CPVT_WordPlace WordIndexToWordPlace(int32_t index) const; CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const; @@ -414,22 +414,22 @@ class CFX_Edit { void GetSel(int32_t& nStartChar, int32_t& nEndChar) const; void SelectAll(); void SelectNone(); - FX_BOOL IsSelected() const; + bool IsSelected() const; void Paint(); - void EnableRefresh(FX_BOOL bRefresh); + void EnableRefresh(bool bRefresh); void RefreshWordRange(const CPVT_WordRange& wr); void SetCaret(int32_t nPos); CPVT_WordRange GetWholeWordRange() const; CPVT_WordRange GetSelectWordRange() const; - void EnableUndo(FX_BOOL bUndo); - void EnableOprNotify(FX_BOOL bNotify); - FX_BOOL IsTextFull() const; - FX_BOOL IsTextOverflow() const; - FX_BOOL CanUndo() const; - FX_BOOL CanRedo() const; + void EnableUndo(bool bUndo); + void EnableOprNotify(bool bNotify); + bool IsTextFull() const; + bool IsTextOverflow() const; + bool CanUndo() const; + bool CanRedo() const; CPVT_WordRange GetVisibleWordRange() const; - FX_BOOL Empty(); + bool Empty(); CPVT_WordPlace DoInsertText(const CPVT_WordPlace& place, const CFX_WideString& sText, @@ -458,22 +458,22 @@ class CFX_Edit { void SetScrollLimit(); void SetContentChanged(); - FX_BOOL InsertWord(uint16_t word, - int32_t charset, - const CPVT_WordProps* pWordProps, - FX_BOOL bAddUndo, - FX_BOOL bPaint); - FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps, - const CPVT_WordProps* pWordProps, - FX_BOOL bAddUndo, - FX_BOOL bPaint); - FX_BOOL Backspace(FX_BOOL bAddUndo, FX_BOOL bPaint); - FX_BOOL Delete(FX_BOOL bAddUndo, FX_BOOL bPaint); - FX_BOOL Clear(FX_BOOL bAddUndo, FX_BOOL bPaint); - FX_BOOL InsertText(const CFX_WideString& sText, - int32_t charset, - FX_BOOL bAddUndo, - FX_BOOL bPaint); + 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 Backspace(bool bAddUndo, bool bPaint); + bool Delete(bool bAddUndo, bool bPaint); + bool Clear(bool bAddUndo, bool bPaint); + bool InsertText(const CFX_WideString& sText, + int32_t charset, + bool bAddUndo, + bool bPaint); void PaintInsertText(const CPVT_WordPlace& wpOld, const CPVT_WordPlace& wpNew); @@ -502,18 +502,18 @@ class CFX_Edit { CFX_FloatPoint m_ptScrollPos; CFX_FloatPoint m_ptRefreshScrollPos; - FX_BOOL m_bEnableScroll; + bool m_bEnableScroll; std::unique_ptr<CFX_Edit_Iterator> m_pIterator; CFX_Edit_Refresh m_Refresh; CFX_FloatPoint m_ptCaret; CFX_Edit_Undo m_Undo; int32_t m_nAlignment; - FX_BOOL m_bNotifyFlag; - FX_BOOL m_bEnableOverflow; - FX_BOOL m_bEnableRefresh; + bool m_bNotifyFlag; + bool m_bEnableOverflow; + bool m_bEnableRefresh; CFX_FloatRect m_rcOldContent; - FX_BOOL m_bEnableUndo; - FX_BOOL m_bOprNotify; + bool m_bEnableUndo; + bool m_bOprNotify; CFX_Edit_GroupUndoItem* m_pGroupUndoItem; }; @@ -522,11 +522,11 @@ class CFX_Edit_Iterator { CFX_Edit_Iterator(CFX_Edit* pEdit, CPDF_VariableText::Iterator* pVTIterator); ~CFX_Edit_Iterator(); - FX_BOOL NextWord(); - FX_BOOL PrevWord(); - FX_BOOL GetWord(CPVT_Word& word) const; - FX_BOOL GetLine(CPVT_Line& line) const; - FX_BOOL GetSection(CPVT_Section& section) const; + bool NextWord(); + bool PrevWord(); + bool GetWord(CPVT_Word& word) const; + bool GetLine(CPVT_Line& line) const; + bool GetSection(CPVT_Section& section) const; void SetAt(int32_t nWordIndex); void SetAt(const CPVT_WordPlace& place); const CPVT_WordPlace& GetAt() const; @@ -551,7 +551,7 @@ class CFX_Edit_Provider : public CPDF_VariableText::Provider { int32_t charset, int32_t nFontIndex) override; int32_t GetDefaultFontIndex() override; - FX_BOOL IsLatinWord(uint16_t word) override; + bool IsLatinWord(uint16_t word) override; private: IPVT_FontMap* m_pFontMap; diff --git a/fpdfsdk/fxedit/fxet_list.cpp b/fpdfsdk/fxedit/fxet_list.cpp index fa4a154e8c..cf718b9acb 100644 --- a/fpdfsdk/fxedit/fxet_list.cpp +++ b/fpdfsdk/fxedit/fxet_list.cpp @@ -12,9 +12,9 @@ CFX_ListItem::CFX_ListItem() : m_pEdit(new CFX_Edit), - m_bSelected(FALSE), + m_bSelected(false), m_rcListItem(0.0f, 0.0f, 0.0f, 0.0f) { - m_pEdit->SetAlignmentV(1, TRUE); + m_pEdit->SetAlignmentV(1, true); m_pEdit->Initialize(); } @@ -41,11 +41,11 @@ CLST_Rect CFX_ListItem::GetRect() const { return m_rcListItem; } -FX_BOOL CFX_ListItem::IsSelected() const { +bool CFX_ListItem::IsSelected() const { return m_bSelected; } -void CFX_ListItem::SetSelect(FX_BOOL bSelected) { +void CFX_ListItem::SetSelect(bool bSelected) { m_bSelected = bSelected; } @@ -143,7 +143,7 @@ int32_t CPLST_Select::Find(int32_t nItemIndex) const { return -1; } -FX_BOOL CPLST_Select::IsExist(int32_t nItemIndex) const { +bool CPLST_Select::IsExist(int32_t nItemIndex) const { return Find(nItemIndex) >= 0; } @@ -190,14 +190,14 @@ void CPLST_Select::Done() { CFX_ListCtrl::CFX_ListCtrl() : m_pNotify(nullptr), - m_bNotifyFlag(FALSE), + m_bNotifyFlag(false), m_nSelItem(-1), m_nFootIndex(-1), - m_bCtrlSel(FALSE), + m_bCtrlSel(false), m_nCaretIndex(-1), m_fFontSize(0.0f), m_pFontMap(nullptr), - m_bMultiple(FALSE) {} + m_bMultiple(false) {} CFX_ListCtrl::~CFX_ListCtrl() { Empty(); @@ -238,8 +238,8 @@ CFX_FloatRect CFX_ListCtrl::OutToIn(const CFX_FloatRect& rect) const { } void CFX_ListCtrl::OnMouseDown(const CFX_FloatPoint& point, - FX_BOOL bShift, - FX_BOOL bCtrl) { + bool bShift, + bool bCtrl) { int32_t nHitIndex = GetItemIndex(point); if (IsMultipleSel()) { @@ -247,11 +247,11 @@ void CFX_ListCtrl::OnMouseDown(const CFX_FloatPoint& point, if (IsItemSelected(nHitIndex)) { m_aSelItems.Sub(nHitIndex); SelectItems(); - m_bCtrlSel = FALSE; + m_bCtrlSel = false; } else { m_aSelItems.Add(nHitIndex); SelectItems(); - m_bCtrlSel = TRUE; + m_bCtrlSel = true; } m_nFootIndex = nHitIndex; @@ -277,8 +277,8 @@ void CFX_ListCtrl::OnMouseDown(const CFX_FloatPoint& point, } void CFX_ListCtrl::OnMouseMove(const CFX_FloatPoint& point, - FX_BOOL bShift, - FX_BOOL bCtrl) { + bool bShift, + bool bCtrl) { int32_t nHitIndex = GetItemIndex(point); if (IsMultipleSel()) { @@ -304,7 +304,7 @@ void CFX_ListCtrl::OnMouseMove(const CFX_FloatPoint& point, ScrollToListItem(nHitIndex); } -void CFX_ListCtrl::OnVK(int32_t nItemIndex, FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_ListCtrl::OnVK(int32_t nItemIndex, bool bShift, bool bCtrl) { if (IsMultipleSel()) { if (nItemIndex >= 0 && nItemIndex < GetCount()) { if (bCtrl) { @@ -329,39 +329,39 @@ void CFX_ListCtrl::OnVK(int32_t nItemIndex, FX_BOOL bShift, FX_BOOL bCtrl) { ScrollToListItem(nItemIndex); } -void CFX_ListCtrl::OnVK_UP(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_ListCtrl::OnVK_UP(bool bShift, bool bCtrl) { OnVK(IsMultipleSel() ? GetCaret() - 1 : GetSelect() - 1, bShift, bCtrl); } -void CFX_ListCtrl::OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_ListCtrl::OnVK_DOWN(bool bShift, bool bCtrl) { OnVK(IsMultipleSel() ? GetCaret() + 1 : GetSelect() + 1, bShift, bCtrl); } -void CFX_ListCtrl::OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_ListCtrl::OnVK_LEFT(bool bShift, bool bCtrl) { OnVK(0, bShift, bCtrl); } -void CFX_ListCtrl::OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_ListCtrl::OnVK_RIGHT(bool bShift, bool bCtrl) { OnVK(GetCount() - 1, bShift, bCtrl); } -void CFX_ListCtrl::OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_ListCtrl::OnVK_HOME(bool bShift, bool bCtrl) { OnVK(0, bShift, bCtrl); } -void CFX_ListCtrl::OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) { +void CFX_ListCtrl::OnVK_END(bool bShift, bool bCtrl) { OnVK(GetCount() - 1, bShift, bCtrl); } -FX_BOOL CFX_ListCtrl::OnChar(uint16_t nChar, FX_BOOL bShift, FX_BOOL bCtrl) { +bool CFX_ListCtrl::OnChar(uint16_t nChar, bool bShift, bool bCtrl) { int32_t nIndex = GetLastSelected(); int32_t nFindIndex = FindNext(nIndex, nChar); if (nFindIndex != nIndex) { OnVK(nFindIndex, bShift, bCtrl); - return TRUE; + return true; } - return FALSE; + return false; } void CFX_ListCtrl::SetPlateRect(const CFX_FloatRect& rect) { @@ -400,16 +400,16 @@ void CFX_ListCtrl::AddString(const CFX_WideString& str) { ReArrange(GetCount() - 1); } -void CFX_ListCtrl::SetMultipleSelect(int32_t nItemIndex, FX_BOOL bSelected) { +void CFX_ListCtrl::SetMultipleSelect(int32_t nItemIndex, bool bSelected) { if (!IsValid(nItemIndex)) return; if (bSelected != IsItemSelected(nItemIndex)) { if (bSelected) { - SetItemSelect(nItemIndex, TRUE); + SetItemSelect(nItemIndex, true); InvalidateItem(nItemIndex); } else { - SetItemSelect(nItemIndex, FALSE); + SetItemSelect(nItemIndex, false); InvalidateItem(nItemIndex); } } @@ -421,11 +421,11 @@ void CFX_ListCtrl::SetSingleSelect(int32_t nItemIndex) { if (m_nSelItem != nItemIndex) { if (m_nSelItem >= 0) { - SetItemSelect(m_nSelItem, FALSE); + SetItemSelect(m_nSelItem, false); InvalidateItem(m_nSelItem); } - SetItemSelect(nItemIndex, TRUE); + SetItemSelect(nItemIndex, true); InvalidateItem(nItemIndex); m_nSelItem = nItemIndex; } @@ -450,14 +450,14 @@ void CFX_ListCtrl::InvalidateItem(int32_t nItemIndex) { if (m_pNotify) { if (nItemIndex == -1) { if (!m_bNotifyFlag) { - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; CFX_FloatRect rcRefresh = GetPlateRect(); m_pNotify->IOnInvalidateRect(&rcRefresh); - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } } else { if (!m_bNotifyFlag) { - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; CFX_FloatRect rcRefresh = GetItemRect(nItemIndex); rcRefresh.left -= 1.0f; rcRefresh.right += 1.0f; @@ -465,7 +465,7 @@ void CFX_ListCtrl::InvalidateItem(int32_t nItemIndex) { rcRefresh.top += 1.0f; m_pNotify->IOnInvalidateRect(&rcRefresh); - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } } } @@ -478,10 +478,10 @@ void CFX_ListCtrl::SelectItems() { switch (nState) { case 1: - SetMultipleSelect(nItemIndex, TRUE); + SetMultipleSelect(nItemIndex, true); break; case -1: - SetMultipleSelect(nItemIndex, FALSE); + SetMultipleSelect(nItemIndex, false); break; } } @@ -501,7 +501,7 @@ void CFX_ListCtrl::Select(int32_t nItemIndex) { } } -FX_BOOL CFX_ListCtrl::IsItemVisible(int32_t nItemIndex) const { +bool CFX_ListCtrl::IsItemVisible(int32_t nItemIndex) const { CFX_FloatRect rcPlate = GetPlateRect(); CFX_FloatRect rcItem = GetItemRect(nItemIndex); @@ -533,11 +533,11 @@ void CFX_ListCtrl::SetScrollInfo() { CFX_FloatRect rcContent = GetContentRectInternal(); if (!m_bNotifyFlag) { - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; m_pNotify->IOnSetScrollInfoY(rcPlate.bottom, rcPlate.top, rcContent.bottom, rcContent.top, GetFirstHeight(), rcPlate.Height()); - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } } } @@ -566,9 +566,9 @@ void CFX_ListCtrl::SetScrollPosY(FX_FLOAT fy) { if (m_pNotify) { if (!m_bNotifyFlag) { - m_bNotifyFlag = TRUE; + m_bNotifyFlag = true; m_pNotify->IOnSetScrollPosY(fy); - m_bNotifyFlag = FALSE; + m_bNotifyFlag = false; } } } @@ -633,19 +633,19 @@ void CFX_ListCtrl::Cancel() { int32_t CFX_ListCtrl::GetItemIndex(const CFX_FloatPoint& point) const { CFX_FloatPoint pt = OuterToInner(OutToIn(point)); - FX_BOOL bFirst = TRUE; - FX_BOOL bLast = TRUE; + bool bFirst = true; + bool bLast = true; for (int32_t i = 0, sz = m_aListItems.GetSize(); i < sz; i++) { if (CFX_ListItem* pListItem = m_aListItems.GetAt(i)) { CLST_Rect rcListItem = pListItem->GetRect(); if (IsFloatBigger(pt.y, rcListItem.top)) { - bFirst = FALSE; + bFirst = false; } if (IsFloatSmaller(pt.y, rcListItem.bottom)) { - bLast = FALSE; + bLast = false; } if (pt.y >= rcListItem.top && pt.y < rcListItem.bottom) { @@ -755,27 +755,27 @@ int32_t CFX_ListCtrl::FindNext(int32_t nIndex, FX_WCHAR nChar) const { return nCircleIndex; } -FX_BOOL CFX_ListCtrl::IsItemSelected(int32_t nIndex) const { +bool CFX_ListCtrl::IsItemSelected(int32_t nIndex) const { if (CFX_ListItem* pListItem = m_aListItems.GetAt(nIndex)) return pListItem->IsSelected(); - return FALSE; + return false; } -void CFX_ListCtrl::SetItemSelect(int32_t nItemIndex, FX_BOOL bSelected) { +void CFX_ListCtrl::SetItemSelect(int32_t nItemIndex, bool bSelected) { if (CFX_ListItem* pListItem = m_aListItems.GetAt(nItemIndex)) { pListItem->SetSelect(bSelected); } } -void CFX_ListCtrl::SetMultipleSel(FX_BOOL bMultiple) { +void CFX_ListCtrl::SetMultipleSel(bool bMultiple) { m_bMultiple = bMultiple; } -FX_BOOL CFX_ListCtrl::IsMultipleSel() const { +bool CFX_ListCtrl::IsMultipleSel() const { return m_bMultiple; } -FX_BOOL CFX_ListCtrl::IsValid(int32_t nItemIndex) const { +bool CFX_ListCtrl::IsValid(int32_t nItemIndex) const { return nItemIndex >= 0 && nItemIndex < m_aListItems.GetSize(); } diff --git a/fpdfsdk/fxedit/fxet_list.h b/fpdfsdk/fxedit/fxet_list.h index ce7acc4220..f0257056c6 100644 --- a/fpdfsdk/fxedit/fxet_list.h +++ b/fpdfsdk/fxedit/fxet_list.h @@ -104,13 +104,13 @@ class CFX_ListItem final { CFX_Edit* GetEdit() const; void SetRect(const CLST_Rect& rect); - void SetSelect(FX_BOOL bSelected); + void SetSelect(bool bSelected); void SetText(const CFX_WideString& text); void SetFontSize(FX_FLOAT fFontSize); CFX_WideString GetText() const; CLST_Rect GetRect() const; - FX_BOOL IsSelected() const; + bool IsSelected() const; FX_FLOAT GetItemHeight() const; uint16_t GetFirstChar() const; @@ -118,7 +118,7 @@ class CFX_ListItem final { CFX_Edit_Iterator* GetIterator() const; std::unique_ptr<CFX_Edit> m_pEdit; - FX_BOOL m_bSelected; + bool m_bSelected; CLST_Rect m_rcListItem; }; @@ -171,7 +171,7 @@ class CFX_ListContainer { template <class TYPE> class CLST_ArrayTemplate : public CFX_ArrayTemplate<TYPE> { public: - FX_BOOL IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; } + bool IsEmpty() { return CFX_ArrayTemplate<TYPE>::GetSize() <= 0; } TYPE GetAt(int32_t nIndex) const { if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize()) return CFX_ArrayTemplate<TYPE>::GetAt(nIndex); @@ -203,7 +203,7 @@ class CPLST_Select { void Add(int32_t nBeginIndex, int32_t nEndIndex); void Sub(int32_t nItemIndex); void Sub(int32_t nBeginIndex, int32_t nEndIndex); - FX_BOOL IsExist(int32_t nItemIndex) const; + bool IsExist(int32_t nItemIndex) const; int32_t Find(int32_t nItemIndex) const; int32_t GetCount() const; int32_t GetItemIndex(int32_t nIndex) const; @@ -224,16 +224,16 @@ class CFX_ListCtrl : protected CFX_ListContainer { void SetPlateRect(const CFX_FloatRect& rect) override; void SetNotify(CPWL_List_Notify* pNotify); - 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); - void OnVK_DOWN(FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK_LEFT(FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK_RIGHT(FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK_HOME(FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl); - void OnVK(int32_t nItemIndex, FX_BOOL bShift, FX_BOOL bCtrl); - FX_BOOL OnChar(uint16_t nChar, FX_BOOL bShift, FX_BOOL bCtrl); + void OnMouseDown(const CFX_FloatPoint& point, bool bShift, bool bCtrl); + void OnMouseMove(const CFX_FloatPoint& point, bool bShift, bool bCtrl); + void OnVK_UP(bool bShift, bool bCtrl); + void OnVK_DOWN(bool bShift, bool bCtrl); + void OnVK_LEFT(bool bShift, bool bCtrl); + void OnVK_RIGHT(bool bShift, bool bCtrl); + void OnVK_HOME(bool bShift, bool bCtrl); + void OnVK_END(bool bShift, bool bCtrl); + void OnVK(int32_t nItemIndex, bool bShift, bool bCtrl); + bool OnChar(uint16_t nChar, bool bShift, bool bCtrl); void SetScrollPos(const CFX_FloatPoint& point); void ScrollToListItem(int32_t nItemIndex); @@ -257,11 +257,11 @@ class CFX_ListCtrl : protected CFX_ListContainer { FX_FLOAT GetFontSize() const; CFX_Edit* GetItemEdit(int32_t nIndex) const; int32_t GetCount() const; - FX_BOOL IsItemSelected(int32_t nIndex) const; + bool IsItemSelected(int32_t nIndex) const; FX_FLOAT GetFirstHeight() const; - void SetMultipleSel(FX_BOOL bMultiple); - FX_BOOL IsMultipleSel() const; - FX_BOOL IsValid(int32_t nItemIndex) const; + void SetMultipleSel(bool bMultiple); + bool IsMultipleSel() const; + bool IsValid(int32_t nItemIndex) const; int32_t FindNext(int32_t nIndex, FX_WCHAR nChar) const; int32_t GetFirstSelected() const; @@ -274,31 +274,31 @@ class CFX_ListCtrl : protected CFX_ListContainer { void ReArrange(int32_t nItemIndex); CFX_FloatRect GetItemRectInternal(int32_t nIndex) const; CFX_FloatRect GetContentRectInternal() const; - void SetMultipleSelect(int32_t nItemIndex, FX_BOOL bSelected); + void SetMultipleSelect(int32_t nItemIndex, bool bSelected); void SetSingleSelect(int32_t nItemIndex); void InvalidateItem(int32_t nItemIndex); void SelectItems(); - FX_BOOL IsItemVisible(int32_t nItemIndex) const; + bool IsItemVisible(int32_t nItemIndex) const; void SetScrollInfo(); void SetScrollPosY(FX_FLOAT fy); void AddItem(const CFX_WideString& str); CFX_WideString GetItemText(int32_t nIndex) const; - void SetItemSelect(int32_t nItemIndex, FX_BOOL bSelected); + void SetItemSelect(int32_t nItemIndex, bool bSelected); int32_t GetLastSelected() const; FX_WCHAR Toupper(FX_WCHAR c) const; CPWL_List_Notify* m_pNotify; - FX_BOOL m_bNotifyFlag; + bool m_bNotifyFlag; CFX_FloatPoint m_ptScrollPos; CPLST_Select m_aSelItems; // for multiple int32_t m_nSelItem; // for single int32_t m_nFootIndex; // for multiple - FX_BOOL m_bCtrlSel; // for multiple + bool m_bCtrlSel; // for multiple int32_t m_nCaretIndex; // for multiple CLST_ArrayTemplate<CFX_ListItem*> m_aListItems; FX_FLOAT m_fFontSize; IPVT_FontMap* m_pFontMap; - FX_BOOL m_bMultiple; + bool m_bMultiple; }; #endif // FPDFSDK_FXEDIT_FXET_LIST_H_ |