diff options
author | tsepez <tsepez@chromium.org> | 2016-11-02 15:43:18 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-02 15:43:19 -0700 |
commit | d19e912dd469e4bdad9f3020e1f6eb98f10f3470 (patch) | |
tree | 239cb568a80445f14a1ab9b63dcaaddcce67e1cc /xfa/fxfa/app/xfa_fftextedit.cpp | |
parent | 12f3e4a58f05850b93af35619cb04f0231d86acc (diff) | |
download | pdfium-d19e912dd469e4bdad9f3020e1f6eb98f10f3470.tar.xz |
Remove FX_BOOL from xfa.
Review-Url: https://codereview.chromium.org/2467203003
Diffstat (limited to 'xfa/fxfa/app/xfa_fftextedit.cpp')
-rw-r--r-- | xfa/fxfa/app/xfa_fftextedit.cpp | 192 |
1 files changed, 94 insertions, 98 deletions
diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index ffbcac1e17..2b47ae2495 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -36,7 +36,7 @@ CXFA_FFTextEdit::~CXFA_FFTextEdit() { } } -FX_BOOL CXFA_FFTextEdit::LoadWidget() { +bool CXFA_FFTextEdit::LoadWidget() { CFWL_Edit* pFWLEdit = new CFWL_Edit(GetFWLApp()); pFWLEdit->Initialize(); m_pNormalWidget = pFWLEdit; @@ -100,18 +100,18 @@ void CXFA_FFTextEdit::UpdateWidgetProperty() { m_pNormalWidget->ModifyStyles(dwStyle, 0xFFFFFFFF); m_pNormalWidget->ModifyStylesEx(dwExtendedStyle, 0xFFFFFFFF); } -FX_BOOL CXFA_FFTextEdit::OnLButtonDown(uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { +bool CXFA_FFTextEdit::OnLButtonDown(uint32_t dwFlags, + FX_FLOAT fx, + FX_FLOAT fy) { if (!PtInActiveRect(fx, fy)) { - return FALSE; + return false; } if (!IsFocused()) { m_dwStatus |= XFA_WidgetStatus_Focused; UpdateFWLData(); AddInvalidateRect(); } - SetButtonDown(TRUE); + SetButtonDown(true); CFWL_MsgMouse ms; ms.m_dwCmd = FWL_MouseCommand::LeftButtonDown; ms.m_dwFlags = dwFlags; @@ -120,23 +120,23 @@ FX_BOOL CXFA_FFTextEdit::OnLButtonDown(uint32_t dwFlags, ms.m_pDstTarget = m_pNormalWidget->GetWidget(); FWLToClient(ms.m_fx, ms.m_fy); TranslateFWLMessage(&ms); - return TRUE; + return true; } -FX_BOOL CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { +bool CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags, + FX_FLOAT fx, + FX_FLOAT fy) { if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) { - return FALSE; + return false; } if (!PtInActiveRect(fx, fy)) { - return FALSE; + return false; } if (!IsFocused()) { m_dwStatus |= XFA_WidgetStatus_Focused; UpdateFWLData(); AddInvalidateRect(); } - SetButtonDown(TRUE); + SetButtonDown(true); CFWL_MsgMouse ms; ms.m_dwCmd = FWL_MouseCommand::RightButtonDown; ms.m_dwFlags = dwFlags; @@ -144,18 +144,16 @@ FX_BOOL CXFA_FFTextEdit::OnRButtonDown(uint32_t dwFlags, ms.m_fy = fy; FWLToClient(ms.m_fx, ms.m_fy); TranslateFWLMessage(&ms); - return TRUE; + return true; } -FX_BOOL CXFA_FFTextEdit::OnRButtonUp(uint32_t dwFlags, - FX_FLOAT fx, - FX_FLOAT fy) { +bool CXFA_FFTextEdit::OnRButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { if (!CXFA_FFField::OnRButtonUp(dwFlags, fx, fy)) - return FALSE; + return false; GetDoc()->GetDocEnvironment()->PopupMenu(this, CFX_PointF(fx, fy)); - return TRUE; + return true; } -FX_BOOL CXFA_FFTextEdit::OnSetFocus(CXFA_FFWidget* pOldWidget) { +bool CXFA_FFTextEdit::OnSetFocus(CXFA_FFWidget* pOldWidget) { m_dwStatus &= ~XFA_WidgetStatus_TextEditValueChanged; if (!IsFocused()) { m_dwStatus |= XFA_WidgetStatus_Focused; @@ -167,9 +165,9 @@ FX_BOOL CXFA_FFTextEdit::OnSetFocus(CXFA_FFWidget* pOldWidget) { ms.m_pDstTarget = m_pNormalWidget->GetWidget(); ms.m_pSrcTarget = nullptr; TranslateFWLMessage(&ms); - return TRUE; + return true; } -FX_BOOL CXFA_FFTextEdit::OnKillFocus(CXFA_FFWidget* pNewWidget) { +bool CXFA_FFTextEdit::OnKillFocus(CXFA_FFWidget* pNewWidget) { CFWL_MsgKillFocus ms; ms.m_pDstTarget = m_pNormalWidget->GetWidget(); ms.m_pSrcTarget = nullptr; @@ -181,17 +179,17 @@ FX_BOOL CXFA_FFTextEdit::OnKillFocus(CXFA_FFWidget* pNewWidget) { AddInvalidateRect(); CXFA_FFWidget::OnKillFocus(pNewWidget); m_dwStatus &= ~XFA_WidgetStatus_TextEditValueChanged; - return TRUE; + return true; } -FX_BOOL CXFA_FFTextEdit::CommitData() { +bool CXFA_FFTextEdit::CommitData() { CFX_WideString wsText; ((CFWL_Edit*)m_pNormalWidget)->GetText(wsText); if (m_pDataAcc->SetValue(wsText, XFA_VALUEPICTURE_Edit)) { m_pDataAcc->UpdateUIDisplay(this); - return TRUE; + return true; } ValidateNumberField(wsText); - return FALSE; + return false; } void CXFA_FFTextEdit::ValidateNumberField(const CFX_WideString& wsText) { CXFA_WidgetAcc* pAcc = GetDataAcc(); @@ -210,7 +208,7 @@ void CXFA_FFTextEdit::ValidateNumberField(const CFX_WideString& wsText) { } } } -FX_BOOL CXFA_FFTextEdit::IsDataChanged() { +bool CXFA_FFTextEdit::IsDataChanged() { return (m_dwStatus & XFA_WidgetStatus_TextEditValueChanged) != 0; } uint32_t CXFA_FFTextEdit::GetAlignment() { @@ -250,15 +248,15 @@ uint32_t CXFA_FFTextEdit::GetAlignment() { } return dwExtendedStyle; } -FX_BOOL CXFA_FFTextEdit::UpdateFWLData() { +bool CXFA_FFTextEdit::UpdateFWLData() { if (!m_pNormalWidget) { - return FALSE; + return false; } XFA_VALUEPICTURE eType = XFA_VALUEPICTURE_Display; if (IsFocused()) { eType = XFA_VALUEPICTURE_Edit; } - FX_BOOL bUpdate = FALSE; + bool bUpdate = false; if (m_pDataAcc->GetUIType() == XFA_Element::TextEdit && m_pDataAcc->GetNumberOfCells() < 0) { XFA_Element elementType = XFA_Element::Unknown; @@ -268,7 +266,7 @@ FX_BOOL CXFA_FFTextEdit::UpdateFWLData() { } if (((CFWL_Edit*)m_pNormalWidget)->GetLimit() != iMaxChars) { ((CFWL_Edit*)m_pNormalWidget)->SetLimit(iMaxChars); - bUpdate = TRUE; + bUpdate = true; } } if (m_pDataAcc->GetUIType() == XFA_Element::Barcode) { @@ -276,7 +274,7 @@ FX_BOOL CXFA_FFTextEdit::UpdateFWLData() { if (eType == XFA_VALUEPICTURE_Edit) m_pDataAcc->GetBarcodeAttribute_DataLength(nDataLen); static_cast<CFWL_Edit*>(m_pNormalWidget)->SetLimit(nDataLen); - bUpdate = TRUE; + bUpdate = true; } CFX_WideString wsText; m_pDataAcc->GetValue(wsText, eType); @@ -284,76 +282,74 @@ FX_BOOL CXFA_FFTextEdit::UpdateFWLData() { ((CFWL_Edit*)m_pNormalWidget)->GetText(wsOldText); if (wsText != wsOldText || (eType == XFA_VALUEPICTURE_Edit && bUpdate)) { ((CFWL_Edit*)m_pNormalWidget)->SetText(wsText); - bUpdate = TRUE; + bUpdate = true; } if (bUpdate) { m_pNormalWidget->Update(); } - return TRUE; + return true; } -FX_BOOL CXFA_FFTextEdit::CanUndo() { +bool CXFA_FFTextEdit::CanUndo() { return ((CFWL_Edit*)m_pNormalWidget)->CanUndo(); } -FX_BOOL CXFA_FFTextEdit::CanRedo() { +bool CXFA_FFTextEdit::CanRedo() { return ((CFWL_Edit*)m_pNormalWidget)->CanRedo(); } -FX_BOOL CXFA_FFTextEdit::Undo() { +bool CXFA_FFTextEdit::Undo() { return ((CFWL_Edit*)m_pNormalWidget)->Undo(); } -FX_BOOL CXFA_FFTextEdit::Redo() { +bool CXFA_FFTextEdit::Redo() { return ((CFWL_Edit*)m_pNormalWidget)->Redo(); } -FX_BOOL CXFA_FFTextEdit::CanCopy() { +bool CXFA_FFTextEdit::CanCopy() { int32_t nCount = ((CFWL_Edit*)m_pNormalWidget)->CountSelRanges(); return nCount > 0; } -FX_BOOL CXFA_FFTextEdit::CanCut() { +bool CXFA_FFTextEdit::CanCut() { if (m_pNormalWidget->GetStylesEx() & FWL_STYLEEXT_EDT_ReadOnly) { - return FALSE; + return false; } int32_t nCount = ((CFWL_Edit*)m_pNormalWidget)->CountSelRanges(); return nCount > 0; } -FX_BOOL CXFA_FFTextEdit::CanPaste() { +bool CXFA_FFTextEdit::CanPaste() { return m_pDataAcc->GetAccess() == XFA_ATTRIBUTEENUM_Open; } -FX_BOOL CXFA_FFTextEdit::CanSelectAll() { +bool CXFA_FFTextEdit::CanSelectAll() { return ((CFWL_Edit*)m_pNormalWidget)->GetTextLength() > 0; } -FX_BOOL CXFA_FFTextEdit::Copy(CFX_WideString& wsCopy) { +bool CXFA_FFTextEdit::Copy(CFX_WideString& wsCopy) { return ((CFWL_Edit*)m_pNormalWidget)->Copy(wsCopy); } -FX_BOOL CXFA_FFTextEdit::Cut(CFX_WideString& wsCut) { +bool CXFA_FFTextEdit::Cut(CFX_WideString& wsCut) { return ((CFWL_Edit*)m_pNormalWidget)->Cut(wsCut); } -FX_BOOL CXFA_FFTextEdit::Paste(const CFX_WideString& wsPaste) { +bool CXFA_FFTextEdit::Paste(const CFX_WideString& wsPaste) { return ((CFWL_Edit*)m_pNormalWidget)->Paste(wsPaste); } -FX_BOOL CXFA_FFTextEdit::SelectAll() { +bool CXFA_FFTextEdit::SelectAll() { int32_t nCount = ((CFWL_Edit*)m_pNormalWidget)->GetTextLength(); return ((CFWL_Edit*)m_pNormalWidget)->AddSelRange(0, nCount) >= 0; } -FX_BOOL CXFA_FFTextEdit::Delete() { +bool CXFA_FFTextEdit::Delete() { return ((CFWL_Edit*)m_pNormalWidget)->Delete(); } -FX_BOOL CXFA_FFTextEdit::DeSelect() { +bool CXFA_FFTextEdit::DeSelect() { return ((CFWL_Edit*)m_pNormalWidget)->ClearSelections() == FWL_Error::Succeeded; } -FX_BOOL CXFA_FFTextEdit::GetSuggestWords( - CFX_PointF pointf, - std::vector<CFX_ByteString>& sSuggest) { +bool CXFA_FFTextEdit::GetSuggestWords(CFX_PointF pointf, + std::vector<CFX_ByteString>& sSuggest) { if (m_pDataAcc->GetUIType() != XFA_Element::TextEdit) { - return FALSE; + return false; } FWLToClient(pointf.x, pointf.y); return ((CFWL_Edit*)m_pNormalWidget)->GetSuggestWords(pointf, sSuggest); } -FX_BOOL CXFA_FFTextEdit::ReplaceSpellCheckWord( - CFX_PointF pointf, - const CFX_ByteStringC& bsReplace) { +bool CXFA_FFTextEdit::ReplaceSpellCheckWord(CFX_PointF pointf, + const CFX_ByteStringC& bsReplace) { if (m_pDataAcc->GetUIType() != XFA_Element::TextEdit) { - return FALSE; + return false; } FWLToClient(pointf.x, pointf.y); return ((CFWL_Edit*)m_pNormalWidget) @@ -392,10 +388,10 @@ void CXFA_FFTextEdit::OnTextFull(IFWL_Widget* pWidget) { m_pDataAcc->ProcessEvent(XFA_ATTRIBUTEENUM_Full, &eParam); } -FX_BOOL CXFA_FFTextEdit::CheckWord(const CFX_ByteStringC& sWord) { +bool CXFA_FFTextEdit::CheckWord(const CFX_ByteStringC& sWord) { if (sWord.IsEmpty() || m_pDataAcc->GetUIType() != XFA_Element::TextEdit) - return TRUE; - return FALSE; + return true; + return false; } void CXFA_FFTextEdit::OnProcessMessage(CFWL_Message* pMessage) { @@ -423,7 +419,7 @@ void CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) { } case CFWL_EventType::GetSuggestedWords: { CFWL_EvtEdtGetSuggestWords* event = (CFWL_EvtEdtGetSuggestWords*)pEvent; - event->bSuggestWords = FALSE; + event->bSuggestWords = false; break; } default: @@ -441,7 +437,7 @@ CXFA_FFNumericEdit::CXFA_FFNumericEdit(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) : CXFA_FFTextEdit(pPageView, pDataAcc) {} CXFA_FFNumericEdit::~CXFA_FFNumericEdit() {} -FX_BOOL CXFA_FFNumericEdit::LoadWidget() { +bool CXFA_FFNumericEdit::LoadWidget() { CFWL_Edit* pWidget = new CFWL_Edit(GetFWLApp()); pWidget->Initialize(); m_pNormalWidget = pWidget; @@ -498,12 +494,12 @@ void CXFA_FFNumericEdit::OnProcessEvent(CFWL_Event* pEvent) { CXFA_FFTextEdit::OnProcessEvent(pEvent); } -FX_BOOL CXFA_FFNumericEdit::OnValidate(IFWL_Widget* pWidget, - CFX_WideString& wsText) { +bool CXFA_FFNumericEdit::OnValidate(IFWL_Widget* pWidget, + CFX_WideString& wsText) { CFX_WideString wsPattern; m_pDataAcc->GetPictureContent(wsPattern, XFA_VALUEPICTURE_Edit); if (!wsPattern.IsEmpty()) { - return TRUE; + return true; } int32_t iLeads = 0; m_pDataAcc->GetLeadDigits(iLeads); @@ -521,7 +517,7 @@ CXFA_FFPasswordEdit::CXFA_FFPasswordEdit(CXFA_FFPageView* pPageView, CXFA_FFPasswordEdit::~CXFA_FFPasswordEdit() {} -FX_BOOL CXFA_FFPasswordEdit::LoadWidget() { +bool CXFA_FFPasswordEdit::LoadWidget() { CFWL_Edit* pWidget = new CFWL_Edit(GetFWLApp()); pWidget->Initialize(); m_pNormalWidget = pWidget; @@ -572,26 +568,26 @@ CXFA_FFDateTimeEdit::CXFA_FFDateTimeEdit(CXFA_FFPageView* pPageView, CXFA_FFDateTimeEdit::~CXFA_FFDateTimeEdit() {} -FX_BOOL CXFA_FFDateTimeEdit::GetBBox(CFX_RectF& rtBox, - uint32_t dwStatus, - FX_BOOL bDrawFocus) { +bool CXFA_FFDateTimeEdit::GetBBox(CFX_RectF& rtBox, + uint32_t dwStatus, + bool bDrawFocus) { if (bDrawFocus) - return FALSE; + return false; return CXFA_FFWidget::GetBBox(rtBox, dwStatus); } -FX_BOOL CXFA_FFDateTimeEdit::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) { +bool CXFA_FFDateTimeEdit::PtInActiveRect(FX_FLOAT fx, FX_FLOAT fy) { if (!m_pNormalWidget) { - return FALSE; + return false; } CFX_RectF rtWidget; ((CFWL_DateTimePicker*)m_pNormalWidget)->GetBBox(rtWidget); if (rtWidget.Contains(fx, fy)) { - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL CXFA_FFDateTimeEdit::LoadWidget() { +bool CXFA_FFDateTimeEdit::LoadWidget() { CFWL_DateTimePicker* pWidget = new CFWL_DateTimePicker(GetFWLApp()); pWidget->Initialize(); m_pNormalWidget = pWidget; @@ -687,18 +683,18 @@ uint32_t CXFA_FFDateTimeEdit::GetAlignment() { } return dwExtendedStyle; } -FX_BOOL CXFA_FFDateTimeEdit::CommitData() { +bool CXFA_FFDateTimeEdit::CommitData() { CFX_WideString wsText; ((CFWL_DateTimePicker*)m_pNormalWidget)->GetEditText(wsText); if (m_pDataAcc->SetValue(wsText, XFA_VALUEPICTURE_Edit)) { m_pDataAcc->UpdateUIDisplay(this); - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL CXFA_FFDateTimeEdit::UpdateFWLData() { +bool CXFA_FFDateTimeEdit::UpdateFWLData() { if (!m_pNormalWidget) { - return FALSE; + return false; } XFA_VALUEPICTURE eType = XFA_VALUEPICTURE_Display; if (IsFocused()) { @@ -718,11 +714,11 @@ FX_BOOL CXFA_FFDateTimeEdit::UpdateFWLData() { } } m_pNormalWidget->Update(); - return TRUE; + return true; } -FX_BOOL CXFA_FFDateTimeEdit::IsDataChanged() { +bool CXFA_FFDateTimeEdit::IsDataChanged() { if (m_dwStatus & XFA_WidgetStatus_TextEditValueChanged) { - return TRUE; + return true; } CFX_WideString wsText; ((CFWL_DateTimePicker*)m_pNormalWidget)->GetEditText(wsText); @@ -730,49 +726,49 @@ FX_BOOL CXFA_FFDateTimeEdit::IsDataChanged() { m_pDataAcc->GetValue(wsOldValue, XFA_VALUEPICTURE_Edit); return wsOldValue != wsText; } -FX_BOOL CXFA_FFDateTimeEdit::CanUndo() { +bool CXFA_FFDateTimeEdit::CanUndo() { return ((CFWL_DateTimePicker*)m_pNormalWidget)->CanUndo(); } -FX_BOOL CXFA_FFDateTimeEdit::CanRedo() { +bool CXFA_FFDateTimeEdit::CanRedo() { return ((CFWL_DateTimePicker*)m_pNormalWidget)->CanRedo(); } -FX_BOOL CXFA_FFDateTimeEdit::Undo() { +bool CXFA_FFDateTimeEdit::Undo() { return ((CFWL_DateTimePicker*)m_pNormalWidget)->Undo(); } -FX_BOOL CXFA_FFDateTimeEdit::Redo() { +bool CXFA_FFDateTimeEdit::Redo() { return ((CFWL_DateTimePicker*)m_pNormalWidget)->Redo(); } -FX_BOOL CXFA_FFDateTimeEdit::CanCopy() { +bool CXFA_FFDateTimeEdit::CanCopy() { return ((CFWL_DateTimePicker*)m_pNormalWidget)->CanCopy(); } -FX_BOOL CXFA_FFDateTimeEdit::CanCut() { +bool CXFA_FFDateTimeEdit::CanCut() { if (m_pDataAcc->GetAccess() != XFA_ATTRIBUTEENUM_Open) { - return FALSE; + return false; } return ((CFWL_DateTimePicker*)m_pNormalWidget)->CanCut(); } -FX_BOOL CXFA_FFDateTimeEdit::CanPaste() { +bool CXFA_FFDateTimeEdit::CanPaste() { return m_pDataAcc->GetAccess() == XFA_ATTRIBUTEENUM_Open; } -FX_BOOL CXFA_FFDateTimeEdit::CanSelectAll() { +bool CXFA_FFDateTimeEdit::CanSelectAll() { return ((CFWL_DateTimePicker*)m_pNormalWidget)->CanSelectAll(); } -FX_BOOL CXFA_FFDateTimeEdit::Copy(CFX_WideString& wsCopy) { +bool CXFA_FFDateTimeEdit::Copy(CFX_WideString& wsCopy) { return ((CFWL_DateTimePicker*)m_pNormalWidget)->Copy(wsCopy); } -FX_BOOL CXFA_FFDateTimeEdit::Cut(CFX_WideString& wsCut) { +bool CXFA_FFDateTimeEdit::Cut(CFX_WideString& wsCut) { return ((CFWL_DateTimePicker*)m_pNormalWidget)->Cut(wsCut); } -FX_BOOL CXFA_FFDateTimeEdit::Paste(const CFX_WideString& wsPaste) { +bool CXFA_FFDateTimeEdit::Paste(const CFX_WideString& wsPaste) { return ((CFWL_DateTimePicker*)m_pNormalWidget)->Paste(wsPaste); } -FX_BOOL CXFA_FFDateTimeEdit::SelectAll() { +bool CXFA_FFDateTimeEdit::SelectAll() { return ((CFWL_DateTimePicker*)m_pNormalWidget)->SelectAll(); } -FX_BOOL CXFA_FFDateTimeEdit::Delete() { +bool CXFA_FFDateTimeEdit::Delete() { return ((CFWL_DateTimePicker*)m_pNormalWidget)->Delete(); } -FX_BOOL CXFA_FFDateTimeEdit::DeSelect() { +bool CXFA_FFDateTimeEdit::DeSelect() { return ((CFWL_DateTimePicker*)m_pNormalWidget)->DeSelect(); } void CXFA_FFDateTimeEdit::OnSelectChanged(IFWL_Widget* pWidget, |