diff options
author | tsepez <tsepez@chromium.org> | 2016-11-02 14:37:54 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-02 14:37:55 -0700 |
commit | 4cf551577856f89103e162edc761def44ffb96fc (patch) | |
tree | 452684db6c2dd2b9aa697415ff4b752e59123b77 /fpdfsdk/pdfwindow/PWL_Edit.cpp | |
parent | 66bd67023f747c489d7144aaf4ca6222c686cd26 (diff) | |
download | pdfium-4cf551577856f89103e162edc761def44ffb96fc.tar.xz |
Remove FX_BOOL from fpdfsdk.
Review-Url: https://codereview.chromium.org/2453683011
Diffstat (limited to 'fpdfsdk/pdfwindow/PWL_Edit.cpp')
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Edit.cpp | 172 |
1 files changed, 86 insertions, 86 deletions
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp index c8de0d2deb..153e9ab4b7 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp @@ -27,10 +27,10 @@ #include "third_party/base/stl_util.h" CPWL_Edit::CPWL_Edit() - : m_pFillerNotify(nullptr), m_bFocus(FALSE), m_pFormFiller(nullptr) {} + : m_pFillerNotify(nullptr), m_bFocus(false), m_pFormFiller(nullptr) {} CPWL_Edit::~CPWL_Edit() { - ASSERT(m_bFocus == FALSE); + ASSERT(m_bFocus == false); } CFX_ByteString CPWL_Edit::GetClassName() const { @@ -46,7 +46,7 @@ void CPWL_Edit::SetText(const CFX_WideString& csText) { if (CXML_Element* pXML = CXML_Element::Parse(sValue.c_str(), sValue.GetLength())) { int32_t nCount = pXML->CountChildren(); - FX_BOOL bFirst = TRUE; + bool bFirst = true; swText.clear(); @@ -61,7 +61,7 @@ void CPWL_Edit::SetText(const CFX_WideString& csText) { } if (bFirst) - bFirst = FALSE; + bFirst = false; else swText += FWL_VKEY_Return; swText += swSection; @@ -82,7 +82,7 @@ void CPWL_Edit::RePosChildWnd() { CFX_FloatRect rcVScroll = CFX_FloatRect(rcWindow.right, rcWindow.bottom, rcWindow.right + PWL_SCROLLBAR_WIDTH, rcWindow.top); - pVSB->Move(rcVScroll, TRUE, FALSE); + pVSB->Move(rcVScroll, true, false); } if (m_pEditCaret && !HasFlag(PES_TEXTOVERFLOW)) @@ -105,25 +105,24 @@ CFX_FloatRect CPWL_Edit::GetClientRect() const { return rcClient; } -void CPWL_Edit::SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat, - FX_BOOL bPaint) { +void CPWL_Edit::SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat, bool bPaint) { m_pEdit->SetAlignmentV((int32_t)nFormat, bPaint); } -FX_BOOL CPWL_Edit::CanSelectAll() const { +bool CPWL_Edit::CanSelectAll() const { return GetSelectWordRange() != m_pEdit->GetWholeWordRange(); } -FX_BOOL CPWL_Edit::CanClear() const { +bool CPWL_Edit::CanClear() const { return !IsReadOnly() && m_pEdit->IsSelected(); } -FX_BOOL CPWL_Edit::CanCopy() const { +bool CPWL_Edit::CanCopy() const { return !HasFlag(PES_PASSWORD) && !HasFlag(PES_NOREAD) && m_pEdit->IsSelected(); } -FX_BOOL CPWL_Edit::CanCut() const { +bool CPWL_Edit::CanCut() const { return CanCopy() && !IsReadOnly(); } void CPWL_Edit::CutText() { @@ -145,39 +144,39 @@ void CPWL_Edit::OnCreated() { m_rcOldWindow = GetWindowRect(); m_pEdit->SetOprNotify(this); - m_pEdit->EnableOprNotify(TRUE); + m_pEdit->EnableOprNotify(true); } void CPWL_Edit::SetParamByFlag() { if (HasFlag(PES_RIGHT)) { - m_pEdit->SetAlignmentH(2, FALSE); + m_pEdit->SetAlignmentH(2, false); } else if (HasFlag(PES_MIDDLE)) { - m_pEdit->SetAlignmentH(1, FALSE); + m_pEdit->SetAlignmentH(1, false); } else { - m_pEdit->SetAlignmentH(0, FALSE); + m_pEdit->SetAlignmentH(0, false); } if (HasFlag(PES_BOTTOM)) { - m_pEdit->SetAlignmentV(2, FALSE); + m_pEdit->SetAlignmentV(2, false); } else if (HasFlag(PES_CENTER)) { - m_pEdit->SetAlignmentV(1, FALSE); + m_pEdit->SetAlignmentV(1, false); } else { - m_pEdit->SetAlignmentV(0, FALSE); + m_pEdit->SetAlignmentV(0, false); } if (HasFlag(PES_PASSWORD)) { - m_pEdit->SetPasswordChar('*', FALSE); + m_pEdit->SetPasswordChar('*', false); } - m_pEdit->SetMultiLine(HasFlag(PES_MULTILINE), FALSE); - m_pEdit->SetAutoReturn(HasFlag(PES_AUTORETURN), FALSE); - m_pEdit->SetAutoFontSize(HasFlag(PWS_AUTOFONTSIZE), FALSE); - m_pEdit->SetAutoScroll(HasFlag(PES_AUTOSCROLL), FALSE); + m_pEdit->SetMultiLine(HasFlag(PES_MULTILINE), false); + m_pEdit->SetAutoReturn(HasFlag(PES_AUTORETURN), false); + m_pEdit->SetAutoFontSize(HasFlag(PWS_AUTOFONTSIZE), false); + m_pEdit->SetAutoScroll(HasFlag(PES_AUTOSCROLL), false); m_pEdit->EnableUndo(HasFlag(PES_UNDO)); if (HasFlag(PES_TEXTOVERFLOW)) { SetClipRect(CFX_FloatRect(0.0f, 0.0f, 0.0f, 0.0f)); - m_pEdit->SetTextOverflow(TRUE, FALSE); + m_pEdit->SetTextOverflow(true, false); } else { if (m_pEditCaret) { m_pEditCaret->SetClipRect(CPWL_Utils::InflateRect( @@ -197,8 +196,9 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { if (nCharArray > 0) { switch (GetBorderStyle()) { case BorderStyle::SOLID: { - sLine << "q\n" << GetBorderWidth() << " w\n" - << CPWL_Utils::GetColorAppStream(GetBorderColor(), FALSE) + sLine << "q\n" + << GetBorderWidth() << " w\n" + << CPWL_Utils::GetColorAppStream(GetBorderColor(), false) .AsStringC() << " 2 J 0 j\n"; @@ -215,8 +215,9 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { break; } case BorderStyle::DASH: { - sLine << "q\n" << GetBorderWidth() << " w\n" - << CPWL_Utils::GetColorAppStream(GetBorderColor(), FALSE) + sLine << "q\n" + << GetBorderWidth() << " w\n" + << CPWL_Utils::GetColorAppStream(GetBorderColor(), false) .AsStringC() << " 2 J 0 j\n" << "[" << GetBorderDash().nDash << " " << GetBorderDash().nGap @@ -397,66 +398,65 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, rcClip, CFX_FloatPoint(), pRange, pSysHandler, m_pFormFiller); } -FX_BOOL CPWL_Edit::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_Edit::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDown(point, nFlag); if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point)) { if (m_bMouseDown) InvalidateRect(); - m_bMouseDown = TRUE; + m_bMouseDown = true; SetCapture(); m_pEdit->OnMouseDown(point, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); } - return TRUE; + return true; } -FX_BOOL CPWL_Edit::OnLButtonDblClk(const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_Edit::OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag) { CPWL_Wnd::OnLButtonDblClk(point, nFlag); if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point)) { m_pEdit->SelectAll(); } - return TRUE; + return true; } -FX_BOOL CPWL_Edit::OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { +bool CPWL_Edit::OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { if (m_bMouseDown) - return FALSE; + return false; CPWL_Wnd::OnRButtonUp(point, nFlag); if (!HasFlag(PES_TEXTOVERFLOW) && !ClientHitTest(point)) - return TRUE; + return true; CFX_SystemHandler* pSH = GetSystemHandler(); if (!pSH) - return FALSE; + return false; SetFocus(); - return FALSE; + return false; } void CPWL_Edit::OnSetFocus() { - SetEditCaret(TRUE); + SetEditCaret(true); if (!IsReadOnly()) { if (IPWL_FocusHandler* pFocusHandler = GetFocusHandler()) pFocusHandler->OnSetFocus(this); } - m_bFocus = TRUE; + m_bFocus = true; } void CPWL_Edit::OnKillFocus() { - ShowVScrollBar(FALSE); + ShowVScrollBar(false); m_pEdit->SelectNone(); - SetCaret(FALSE, CFX_FloatPoint(), CFX_FloatPoint()); + SetCaret(false, CFX_FloatPoint(), CFX_FloatPoint()); SetCharSet(FXFONT_ANSI_CHARSET); - m_bFocus = FALSE; + m_bFocus = false; } void CPWL_Edit::SetCharSpace(FX_FLOAT fCharSpace) { @@ -520,7 +520,7 @@ CFX_FloatPoint CPWL_Edit::GetWordRightBottomPoint( return pt; } -FX_BOOL CPWL_Edit::IsTextFull() const { +bool CPWL_Edit::IsTextFull() const { return m_pEdit->IsTextFull(); } @@ -544,14 +544,14 @@ FX_FLOAT CPWL_Edit::GetCharArrayAutoFontSize(CPDF_Font* pFont, void CPWL_Edit::SetCharArray(int32_t nCharArray) { if (HasFlag(PES_CHARARRAY) && nCharArray > 0) { m_pEdit->SetCharArray(nCharArray); - m_pEdit->SetTextOverflow(TRUE, TRUE); + m_pEdit->SetTextOverflow(true, true); if (HasFlag(PWS_AUTOFONTSIZE)) { if (IPVT_FontMap* pFontMap = GetFontMap()) { FX_FLOAT fFontSize = GetCharArrayAutoFontSize( pFontMap->GetPDFFont(0), GetClientRect(), nCharArray); if (fFontSize > 0.0f) { - m_pEdit->SetAutoFontSize(FALSE, TRUE); + m_pEdit->SetAutoFontSize(false, true); m_pEdit->SetFontSize(fFontSize); } } @@ -572,41 +572,41 @@ CFX_FloatRect CPWL_Edit::GetFocusRect() const { return CFX_FloatRect(); } -void CPWL_Edit::ShowVScrollBar(FX_BOOL bShow) { +void CPWL_Edit::ShowVScrollBar(bool bShow) { if (CPWL_ScrollBar* pScroll = GetVScrollBar()) { if (bShow) { if (!pScroll->IsVisible()) { - pScroll->SetVisible(TRUE); + pScroll->SetVisible(true); CFX_FloatRect rcWindow = GetWindowRect(); m_rcOldWindow = rcWindow; rcWindow.right += PWL_SCROLLBAR_WIDTH; - Move(rcWindow, TRUE, TRUE); + Move(rcWindow, true, true); } } else { if (pScroll->IsVisible()) { - pScroll->SetVisible(FALSE); - Move(m_rcOldWindow, TRUE, TRUE); + pScroll->SetVisible(false); + Move(m_rcOldWindow, true, true); } } } } -FX_BOOL CPWL_Edit::IsVScrollBarVisible() const { +bool CPWL_Edit::IsVScrollBarVisible() const { if (CPWL_ScrollBar* pScroll = GetVScrollBar()) { return pScroll->IsVisible(); } - return FALSE; + return false; } -FX_BOOL CPWL_Edit::OnKeyDown(uint16_t nChar, uint32_t nFlag) { +bool CPWL_Edit::OnKeyDown(uint16_t nChar, uint32_t nFlag) { if (m_bMouseDown) - return TRUE; + return true; if (nChar == FWL_VKEY_Delete) { if (m_pFillerNotify) { - FX_BOOL bRC = TRUE; - FX_BOOL bExit = FALSE; + bool bRC = true; + bool bExit = false; CFX_WideString strChange; CFX_WideString strChangeEx; @@ -617,20 +617,20 @@ FX_BOOL CPWL_Edit::OnKeyDown(uint16_t nChar, uint32_t nFlag) { if (nSelStart == nSelEnd) nSelEnd = nSelStart + 1; m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), strChange, - strChangeEx, nSelStart, nSelEnd, TRUE, + strChangeEx, nSelStart, nSelEnd, true, bRC, bExit, nFlag); if (!bRC) - return FALSE; + return false; if (bExit) - return FALSE; + return false; } } - FX_BOOL bRet = CPWL_EditCtrl::OnKeyDown(nChar, nFlag); + bool bRet = CPWL_EditCtrl::OnKeyDown(nChar, nFlag); // In case of implementation swallow the OnKeyDown event. if (IsProceedtoOnChar(nChar, nFlag)) - return TRUE; + return true; return bRet; } @@ -640,9 +640,9 @@ FX_BOOL CPWL_Edit::OnKeyDown(uint16_t nChar, uint32_t nFlag) { *If the event is swallowed, implementation may do other unexpected things, which *is not the control means to do. */ -FX_BOOL CPWL_Edit::IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag) { - FX_BOOL bCtrl = IsCTRLpressed(nFlag); - FX_BOOL bAlt = IsALTpressed(nFlag); +bool CPWL_Edit::IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag) { + bool bCtrl = IsCTRLpressed(nFlag); + bool bAlt = IsALTpressed(nFlag); if (bCtrl && !bAlt) { // hot keys for edit control. switch (nKeyCode) { @@ -651,7 +651,7 @@ FX_BOOL CPWL_Edit::IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag) { case 'X': case 'A': case 'Z': - return TRUE; + return true; default: break; } @@ -662,18 +662,18 @@ FX_BOOL CPWL_Edit::IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag) { case FWL_VKEY_Back: case FWL_VKEY_Return: case FWL_VKEY_Space: - return TRUE; + return true; default: - return FALSE; + return false; } } -FX_BOOL CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { +bool CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { if (m_bMouseDown) - return TRUE; + return true; - FX_BOOL bRC = TRUE; - FX_BOOL bExit = FALSE; + bool bRC = true; + bool bExit = false; if (!IsCTRLpressed(nFlag)) { if (m_pFillerNotify) { @@ -697,15 +697,15 @@ FX_BOOL CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { CFX_WideString strChangeEx; m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swChange, - strChangeEx, nSelStart, nSelEnd, TRUE, + strChangeEx, nSelStart, nSelEnd, true, bRC, bExit, nFlag); } } if (!bRC) - return TRUE; + return true; if (bExit) - return FALSE; + return false; if (IPVT_FontMap* pFontMap = GetFontMap()) { int32_t nOldCharSet = GetCharSet(); @@ -719,9 +719,9 @@ FX_BOOL CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { return CPWL_EditCtrl::OnChar(nChar, nFlag); } -FX_BOOL CPWL_Edit::OnMouseWheel(short zDelta, - const CFX_FloatPoint& point, - uint32_t nFlag) { +bool CPWL_Edit::OnMouseWheel(short zDelta, + const CFX_FloatPoint& point, + uint32_t nFlag) { if (HasFlag(PES_MULTILINE)) { CFX_FloatPoint ptScroll = GetScrollPos(); @@ -732,10 +732,10 @@ FX_BOOL CPWL_Edit::OnMouseWheel(short zDelta, } SetScrollPos(ptScroll); - return TRUE; + return true; } - return FALSE; + return false; } void CPWL_Edit::OnInsertReturn(const CPVT_WordPlace& place, @@ -807,25 +807,25 @@ CPVT_WordRange CPWL_Edit::CombineWordRange(const CPVT_WordRange& wr1, CPVT_WordRange CPWL_Edit::GetLatinWordsRange( const CFX_FloatPoint& point) const { - return GetSameWordsRange(m_pEdit->SearchWordPlace(point), TRUE, FALSE); + return GetSameWordsRange(m_pEdit->SearchWordPlace(point), true, false); } CPVT_WordRange CPWL_Edit::GetLatinWordsRange( const CPVT_WordPlace& place) const { - return GetSameWordsRange(place, TRUE, FALSE); + return GetSameWordsRange(place, true, false); } CPVT_WordRange CPWL_Edit::GetArabicWordsRange( const CPVT_WordPlace& place) const { - return GetSameWordsRange(place, FALSE, TRUE); + return GetSameWordsRange(place, false, true); } #define PWL_ISARABICWORD(word) \ ((word >= 0x0600 && word <= 0x06FF) || (word >= 0xFB50 && word <= 0xFEFC)) CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace& place, - FX_BOOL bLatin, - FX_BOOL bArabic) const { + bool bLatin, + bool bArabic) const { CPVT_WordRange range; CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); |