diff options
Diffstat (limited to 'xfa/fde')
52 files changed, 1039 insertions, 1060 deletions
diff --git a/xfa/fde/cfde_path.cpp b/xfa/fde/cfde_path.cpp index f18eab54d2..23aad50549 100644 --- a/xfa/fde/cfde_path.cpp +++ b/xfa/fde/cfde_path.cpp @@ -8,15 +8,15 @@ #include "xfa/fde/fde_object.h" -FX_BOOL CFDE_Path::StartFigure() { +bool CFDE_Path::StartFigure() { return CloseFigure(); } -FX_BOOL CFDE_Path::CloseFigure() { +bool CFDE_Path::CloseFigure() { FX_PATHPOINT* pPoint = GetLastPoint(); if (pPoint) pPoint->m_Flag |= FXPT_CLOSEFIGURE; - return TRUE; + return true; } FX_PATHPOINT* CFDE_Path::GetLastPoint(int32_t iCount) const { @@ -29,9 +29,9 @@ FX_PATHPOINT* CFDE_Path::GetLastPoint(int32_t iCount) const { return m_Path.GetPoints() + iPoints - iCount; } -FX_BOOL CFDE_Path::FigureClosed() const { +bool CFDE_Path::FigureClosed() const { FX_PATHPOINT* pPoint = GetLastPoint(); - return pPoint ? (pPoint->m_Flag & FXPT_CLOSEFIGURE) : TRUE; + return pPoint ? (pPoint->m_Flag & FXPT_CLOSEFIGURE) : true; } FX_PATHPOINT* CFDE_Path::AddPoints(int32_t iCount) { @@ -72,7 +72,7 @@ void CFDE_Path::BezierTo(const CFX_PointF& p1, p[2].m_Flag = FXPT_BEZIERTO; } -void CFDE_Path::ArcTo(FX_BOOL bStart, +void CFDE_Path::ArcTo(bool bStart, const CFX_RectF& rect, FX_FLOAT startAngle, FX_FLOAT endAngle) { @@ -129,7 +129,7 @@ void CFDE_Path::AddBeziers(const CFX_PointsF& points) { void CFDE_Path::GetCurveTangents(const CFX_PointsF& points, CFX_PointsF& tangents, - FX_BOOL bClosed, + bool bClosed, FX_FLOAT fTension) const { int32_t iCount = points.GetSize(); tangents.SetSize(iCount); @@ -153,7 +153,7 @@ void CFDE_Path::GetCurveTangents(const CFX_PointsF& points, } void CFDE_Path::AddCurve(const CFX_PointsF& points, - FX_BOOL bClosed, + bool bClosed, FX_FLOAT fTension) { int32_t iLast = points.GetUpperBound(); if (iLast < 1) @@ -201,7 +201,7 @@ void CFDE_Path::AddLine(const CFX_PointF& pt1, const CFX_PointF& pt2) { LineTo(pt2); } -void CFDE_Path::AddPath(const CFDE_Path* pSrc, FX_BOOL bConnect) { +void CFDE_Path::AddPath(const CFDE_Path* pSrc, bool bConnect) { if (!pSrc) return; diff --git a/xfa/fde/cfde_path.h b/xfa/fde/cfde_path.h index 34619d45ef..b0359cd198 100644 --- a/xfa/fde/cfde_path.h +++ b/xfa/fde/cfde_path.h @@ -13,18 +13,18 @@ class CFDE_Path : public CFX_Target { public: - FX_BOOL StartFigure(); - FX_BOOL CloseFigure(); + bool StartFigure(); + bool CloseFigure(); void AddBezier(const CFX_PointsF& points); void AddBeziers(const CFX_PointsF& points); void AddCurve(const CFX_PointsF& points, - FX_BOOL bClosed, + bool bClosed, FX_FLOAT fTension = 0.5f); void AddEllipse(const CFX_RectF& rect); void AddLines(const CFX_PointsF& points); void AddLine(const CFX_PointF& pt1, const CFX_PointF& pt2); - void AddPath(const CFDE_Path* pSrc, FX_BOOL bConnect); + void AddPath(const CFDE_Path* pSrc, bool bConnect); void AddPolygon(const CFX_PointsF& points); void AddRectangle(const CFX_RectF& rect); void GetBBox(CFX_RectF& bbox) const; @@ -33,13 +33,13 @@ class CFDE_Path : public CFX_Target { FX_FLOAT fMiterLimit) const; FX_PATHPOINT* AddPoints(int32_t iCount); FX_PATHPOINT* GetLastPoint(int32_t iCount = 1) const; - FX_BOOL FigureClosed() const; + bool FigureClosed() const; void MoveTo(FX_FLOAT fx, FX_FLOAT fy); void LineTo(FX_FLOAT fx, FX_FLOAT fy); void BezierTo(const CFX_PointF& p1, const CFX_PointF& p2, const CFX_PointF& p3); - void ArcTo(FX_BOOL bStart, + void ArcTo(bool bStart, const CFX_RectF& rect, FX_FLOAT startAngle, FX_FLOAT endAngle); @@ -47,7 +47,7 @@ class CFDE_Path : public CFX_Target { void LineTo(const CFX_PointF& p1) { LineTo(p1.x, p1.y); } void GetCurveTangents(const CFX_PointsF& points, CFX_PointsF& tangents, - FX_BOOL bClosed, + bool bClosed, FX_FLOAT fTension) const; CFX_PathData m_Path; }; diff --git a/xfa/fde/cfde_txtedtbuf.cpp b/xfa/fde/cfde_txtedtbuf.cpp index 58f1822661..6d36eb3da2 100644 --- a/xfa/fde/cfde_txtedtbuf.cpp +++ b/xfa/fde/cfde_txtedtbuf.cpp @@ -16,12 +16,12 @@ const int kDefaultChunkCount = 2; } // namespace CFDE_TxtEdtBuf::CFDE_TxtEdtBuf() - : m_nChunkSize(kDefaultChunkSize), m_nTotal(0), m_bChanged(FALSE) { + : m_nChunkSize(kDefaultChunkSize), m_nTotal(0), m_bChanged(false) { ResetChunkBuffer(kDefaultChunkCount, m_nChunkSize); } CFDE_TxtEdtBuf::~CFDE_TxtEdtBuf() { - Clear(TRUE); + Clear(true); m_Chunks.RemoveAll(); } @@ -35,7 +35,7 @@ int32_t CFDE_TxtEdtBuf::GetTextLength() const { void CFDE_TxtEdtBuf::SetText(const CFX_WideString& wsText) { ASSERT(!wsText.IsEmpty()); - Clear(FALSE); + Clear(false); int32_t nTextLength = wsText.GetLength(); int32_t nNeedCount = ((nTextLength - 1) / m_nChunkSize + 1) - m_Chunks.GetSize(); @@ -62,7 +62,7 @@ void CFDE_TxtEdtBuf::SetText(const CFX_WideString& wsText) { lpChunk->nUsed = nCopyedLength; } m_nTotal = nTextLength; - m_bChanged = TRUE; + m_bChanged = true; } void CFDE_TxtEdtBuf::GetText(CFX_WideString& wsText) const { @@ -165,7 +165,7 @@ void CFDE_TxtEdtBuf::Insert(int32_t nPos, cp.nChunkIndex++; } m_nTotal += nLength; - m_bChanged = TRUE; + m_bChanged = true; } void CFDE_TxtEdtBuf::Delete(int32_t nIndex, int32_t nLength) { @@ -196,10 +196,10 @@ void CFDE_TxtEdtBuf::Delete(int32_t nIndex, int32_t nLength) { nLength -= nDeleted; cpEnd.nChunkIndex--; } - m_bChanged = TRUE; + m_bChanged = true; } -void CFDE_TxtEdtBuf::Clear(FX_BOOL bRelease) { +void CFDE_TxtEdtBuf::Clear(bool bRelease) { int32_t i = 0; int32_t nCount = m_Chunks.GetSize(); if (bRelease) { @@ -213,19 +213,19 @@ void CFDE_TxtEdtBuf::Clear(FX_BOOL bRelease) { } } m_nTotal = 0; - m_bChanged = TRUE; + m_bChanged = true; } -FX_BOOL CFDE_TxtEdtBuf::Optimize(IFX_Pause* pPause) { - if (m_bChanged == FALSE) { - return TRUE; +bool CFDE_TxtEdtBuf::Optimize(IFX_Pause* pPause) { + if (m_bChanged == false) { + return true; } if (m_nTotal == 0) { - return TRUE; + return true; } int32_t nCount = m_Chunks.GetSize(); if (nCount == 0) { - return TRUE; + return true; } int32_t i = 0; for (; i < nCount; i++) { @@ -238,7 +238,7 @@ FX_BOOL CFDE_TxtEdtBuf::Optimize(IFX_Pause* pPause) { } } if (pPause && pPause->NeedToPauseNow()) - return FALSE; + return false; FDE_CHUNKHEADER* lpPreChunk = m_Chunks[0]; FDE_CHUNKHEADER* lpCurChunk = nullptr; @@ -256,10 +256,10 @@ FX_BOOL CFDE_TxtEdtBuf::Optimize(IFX_Pause* pPause) { lpPreChunk = lpCurChunk; } if (pPause && pPause->NeedToPauseNow()) - return FALSE; + return false; } - m_bChanged = FALSE; - return TRUE; + m_bChanged = false; + return true; } void CFDE_TxtEdtBuf::ResetChunkBuffer(int32_t nDefChunkCount, diff --git a/xfa/fde/cfde_txtedtbuf.h b/xfa/fde/cfde_txtedtbuf.h index e1bc9259e4..f85dcb352a 100644 --- a/xfa/fde/cfde_txtedtbuf.h +++ b/xfa/fde/cfde_txtedtbuf.h @@ -31,9 +31,9 @@ class CFDE_TxtEdtBuf { void Insert(int32_t nPos, const FX_WCHAR* lpText, int32_t nLength = 1); void Delete(int32_t nIndex, int32_t nLength = 1); - void Clear(FX_BOOL bRelease = TRUE); + void Clear(bool bRelease = true); - FX_BOOL Optimize(IFX_Pause* pPause = nullptr); + bool Optimize(IFX_Pause* pPause = nullptr); private: friend class CFDE_TxtEdtBufIter; @@ -55,7 +55,7 @@ class CFDE_TxtEdtBuf { int32_t m_nChunkSize; int32_t m_nTotal; - FX_BOOL m_bChanged; + bool m_bChanged; CFX_ArrayTemplate<FDE_CHUNKHEADER*> m_Chunks; std::unique_ptr<IFX_MemoryAllocator> m_pAllocator; }; diff --git a/xfa/fde/cfde_txtedtbufiter.cpp b/xfa/fde/cfde_txtedtbufiter.cpp index c6d77a4523..e4544a3891 100644 --- a/xfa/fde/cfde_txtedtbufiter.cpp +++ b/xfa/fde/cfde_txtedtbufiter.cpp @@ -19,10 +19,10 @@ CFDE_TxtEdtBufIter::CFDE_TxtEdtBufIter(CFDE_TxtEdtBuf* pBuf, FX_WCHAR wcAlias) CFDE_TxtEdtBufIter::~CFDE_TxtEdtBufIter() {} -FX_BOOL CFDE_TxtEdtBufIter::Next(FX_BOOL bPrev) { +bool CFDE_TxtEdtBufIter::Next(bool bPrev) { if (bPrev) { if (m_nIndex == 0) { - return FALSE; + return false; } ASSERT(m_nCurChunk < m_pBuf->m_Chunks.GetSize()); CFDE_TxtEdtBuf::FDE_CHUNKHEADER* lpChunk = nullptr; @@ -40,10 +40,10 @@ FX_BOOL CFDE_TxtEdtBufIter::Next(FX_BOOL bPrev) { } ASSERT(m_nCurChunk >= 0); m_nIndex--; - return TRUE; + return true; } else { if (m_nIndex >= (m_pBuf->m_nTotal - 1)) { - return FALSE; + return false; } ASSERT(m_nCurChunk < m_pBuf->m_Chunks.GetSize()); CFDE_TxtEdtBuf::FDE_CHUNKHEADER* lpChunk = m_pBuf->m_Chunks[m_nCurChunk]; @@ -62,7 +62,7 @@ FX_BOOL CFDE_TxtEdtBufIter::Next(FX_BOOL bPrev) { } } m_nIndex++; - return TRUE; + return true; } } @@ -86,7 +86,7 @@ FX_WCHAR CFDE_TxtEdtBufIter::GetChar() { return m_Alias; } -FX_BOOL CFDE_TxtEdtBufIter::IsEOF(FX_BOOL bTail) const { +bool CFDE_TxtEdtBufIter::IsEOF(bool bTail) const { return bTail ? m_nIndex == (m_pBuf->GetTextLength() - 2) : m_nIndex == 0; } diff --git a/xfa/fde/cfde_txtedtbufiter.h b/xfa/fde/cfde_txtedtbufiter.h index dacfb26918..4322708a2a 100644 --- a/xfa/fde/cfde_txtedtbufiter.h +++ b/xfa/fde/cfde_txtedtbufiter.h @@ -17,11 +17,11 @@ class CFDE_TxtEdtBufIter : public IFX_CharIter { CFDE_TxtEdtBufIter(CFDE_TxtEdtBuf* pBuf, FX_WCHAR wcAlias = 0); ~CFDE_TxtEdtBufIter() override; - FX_BOOL Next(FX_BOOL bPrev = FALSE) override; + bool Next(bool bPrev = false) override; FX_WCHAR GetChar() override; void SetAt(int32_t nIndex) override; int32_t GetAt() const override; - FX_BOOL IsEOF(FX_BOOL bTail = TRUE) const override; + bool IsEOF(bool bTail = true) const override; IFX_CharIter* Clone() override; private: diff --git a/xfa/fde/cfde_txtedtdorecord_deleterange.cpp b/xfa/fde/cfde_txtedtdorecord_deleterange.cpp index 33384b43ee..30459270b4 100644 --- a/xfa/fde/cfde_txtedtdorecord_deleterange.cpp +++ b/xfa/fde/cfde_txtedtdorecord_deleterange.cpp @@ -14,7 +14,7 @@ CFDE_TxtEdtDoRecord_DeleteRange::CFDE_TxtEdtDoRecord_DeleteRange( int32_t nIndex, int32_t nCaret, const CFX_WideString& wsRange, - FX_BOOL bSel) + bool bSel) : m_pEngine(pEngine), m_bSel(bSel), m_nIndex(nIndex), @@ -25,7 +25,7 @@ CFDE_TxtEdtDoRecord_DeleteRange::CFDE_TxtEdtDoRecord_DeleteRange( CFDE_TxtEdtDoRecord_DeleteRange::~CFDE_TxtEdtDoRecord_DeleteRange() {} -FX_BOOL CFDE_TxtEdtDoRecord_DeleteRange::Undo() const { +bool CFDE_TxtEdtDoRecord_DeleteRange::Undo() const { if (m_pEngine->IsSelect()) m_pEngine->ClearSelection(); @@ -37,11 +37,11 @@ FX_BOOL CFDE_TxtEdtDoRecord_DeleteRange::Undo() const { m_pEngine->m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Insert; m_pEngine->m_ChangeInfo.wsDelete = m_wsRange; Param.pEventSink->On_TextChanged(m_pEngine, m_pEngine->m_ChangeInfo); - m_pEngine->SetCaretPos(m_nCaret, TRUE); - return TRUE; + m_pEngine->SetCaretPos(m_nCaret, true); + return true; } -FX_BOOL CFDE_TxtEdtDoRecord_DeleteRange::Redo() const { +bool CFDE_TxtEdtDoRecord_DeleteRange::Redo() const { m_pEngine->Inner_DeleteRange(m_nIndex, m_wsRange.GetLength()); if (m_bSel) m_pEngine->RemoveSelRange(m_nIndex, m_wsRange.GetLength()); @@ -50,6 +50,6 @@ FX_BOOL CFDE_TxtEdtDoRecord_DeleteRange::Redo() const { m_pEngine->m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Insert; m_pEngine->m_ChangeInfo.wsDelete = m_wsRange; Param.pEventSink->On_TextChanged(m_pEngine, m_pEngine->m_ChangeInfo); - m_pEngine->SetCaretPos(m_nIndex, TRUE); - return TRUE; + m_pEngine->SetCaretPos(m_nIndex, true); + return true; } diff --git a/xfa/fde/cfde_txtedtdorecord_deleterange.h b/xfa/fde/cfde_txtedtdorecord_deleterange.h index 316e87f266..f7d7955940 100644 --- a/xfa/fde/cfde_txtedtdorecord_deleterange.h +++ b/xfa/fde/cfde_txtedtdorecord_deleterange.h @@ -19,15 +19,15 @@ class CFDE_TxtEdtDoRecord_DeleteRange : public IFDE_TxtEdtDoRecord { int32_t nIndex, int32_t nCaret, const CFX_WideString& wsRange, - FX_BOOL bSel = FALSE); + bool bSel = false); ~CFDE_TxtEdtDoRecord_DeleteRange() override; - FX_BOOL Undo() const override; - FX_BOOL Redo() const override; + bool Undo() const override; + bool Redo() const override; private: CFDE_TxtEdtEngine* m_pEngine; - FX_BOOL m_bSel; + bool m_bSel; int32_t m_nIndex; int32_t m_nCaret; CFX_WideString m_wsRange; diff --git a/xfa/fde/cfde_txtedtdorecord_insert.cpp b/xfa/fde/cfde_txtedtdorecord_insert.cpp index 55cfb95ba4..1fa3bbcf8f 100644 --- a/xfa/fde/cfde_txtedtdorecord_insert.cpp +++ b/xfa/fde/cfde_txtedtdorecord_insert.cpp @@ -23,7 +23,7 @@ CFDE_TxtEdtDoRecord_Insert::CFDE_TxtEdtDoRecord_Insert( CFDE_TxtEdtDoRecord_Insert::~CFDE_TxtEdtDoRecord_Insert() {} -FX_BOOL CFDE_TxtEdtDoRecord_Insert::Undo() const { +bool CFDE_TxtEdtDoRecord_Insert::Undo() const { if (m_pEngine->IsSelect()) m_pEngine->ClearSelection(); @@ -32,16 +32,16 @@ FX_BOOL CFDE_TxtEdtDoRecord_Insert::Undo() const { m_pEngine->m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Delete; m_pEngine->m_ChangeInfo.wsDelete = m_wsInsert; Param.pEventSink->On_TextChanged(m_pEngine, m_pEngine->m_ChangeInfo); - m_pEngine->SetCaretPos(m_nCaret, TRUE); - return TRUE; + m_pEngine->SetCaretPos(m_nCaret, true); + return true; } -FX_BOOL CFDE_TxtEdtDoRecord_Insert::Redo() const { +bool CFDE_TxtEdtDoRecord_Insert::Redo() const { m_pEngine->Inner_Insert(m_nCaret, m_wsInsert.c_str(), m_wsInsert.GetLength()); FDE_TXTEDTPARAMS& Param = m_pEngine->m_Param; m_pEngine->m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Insert; m_pEngine->m_ChangeInfo.wsDelete = m_wsInsert; Param.pEventSink->On_TextChanged(m_pEngine, m_pEngine->m_ChangeInfo); - m_pEngine->SetCaretPos(m_nCaret, FALSE); - return TRUE; + m_pEngine->SetCaretPos(m_nCaret, false); + return true; } diff --git a/xfa/fde/cfde_txtedtdorecord_insert.h b/xfa/fde/cfde_txtedtdorecord_insert.h index 73493aa4fa..e80453e9e3 100644 --- a/xfa/fde/cfde_txtedtdorecord_insert.h +++ b/xfa/fde/cfde_txtedtdorecord_insert.h @@ -21,8 +21,8 @@ class CFDE_TxtEdtDoRecord_Insert : public IFDE_TxtEdtDoRecord { int32_t nLength); ~CFDE_TxtEdtDoRecord_Insert() override; - FX_BOOL Undo() const override; - FX_BOOL Redo() const override; + bool Undo() const override; + bool Redo() const override; private: CFDE_TxtEdtEngine* m_pEngine; diff --git a/xfa/fde/cfde_txtedtengine.cpp b/xfa/fde/cfde_txtedtengine.cpp index 60ad6090a6..a4cfab2983 100644 --- a/xfa/fde/cfde_txtedtengine.cpp +++ b/xfa/fde/cfde_txtedtengine.cpp @@ -36,7 +36,7 @@ FDE_TXTEDTPARAMS::FDE_TXTEDTPARAMS() dwFontColor(0xff000000), fLineSpace(10.0f), fTabWidth(36), - bTabEquidistant(FALSE), + bTabEquidistant(false), wDefChar(0xFEFF), wLineBreakChar('\n'), nCharRotation(0), @@ -57,14 +57,14 @@ CFDE_TxtEdtEngine::CFDE_TxtEdtEngine() m_nLayoutPos(0), m_fCaretPosReserve(0.0), m_nCaret(0), - m_bBefore(TRUE), + m_bBefore(true), m_nCaretPage(0), m_dwFindFlags(0), - m_bLock(FALSE), + m_bLock(false), m_nLimit(0), m_wcAliasChar(L'*'), m_nFirstLineEnd(FDE_TXTEDIT_LINEEND_Auto), - m_bAutoLineEnd(TRUE), + m_bAutoLineEnd(true), m_wLineEnd(kUnicodeParagraphSeparator) { FXSYS_memset(&m_rtCaret, 0, sizeof(CFX_RectF)); m_bAutoLineEnd = (m_Param.nLineEnd == FDE_TXTEDIT_LINEEND_Auto); @@ -110,18 +110,18 @@ void CFDE_TxtEdtEngine::SetTextByStream(IFX_Stream* pStream) { int32_t nIndex = 0; if (pStream && pStream->GetLength()) { int32_t nStreamLength = pStream->GetLength(); - FX_BOOL bValid = TRUE; + bool bValid = true; if (m_nLimit > 0 && nStreamLength > m_nLimit) { - bValid = FALSE; + bValid = false; } - FX_BOOL bPreIsCR = FALSE; + bool bPreIsCR = false; if (bValid) { uint8_t bom[4]; int32_t nPos = pStream->GetBOM(bom); pStream->Seek(FX_STREAMSEEK_Begin, nPos); int32_t nPlateSize = std::min(nStreamLength, m_pTxtBuf->GetChunkSize()); FX_WCHAR* lpwstr = FX_Alloc(FX_WCHAR, nPlateSize); - FX_BOOL bEos = false; + bool bEos = false; while (!bEos) { int32_t nRead = pStream->ReadString(lpwstr, nPlateSize, bEos); bPreIsCR = ReplaceParagEnd(lpwstr, nRead, bPreIsCR); @@ -142,7 +142,7 @@ void CFDE_TxtEdtEngine::SetText(const CFX_WideString& wsText) { CFX_WideString wsTemp; FX_WCHAR* lpBuffer = wsTemp.GetBuffer(nLength); FXSYS_memcpy(lpBuffer, wsText.c_str(), nLength * sizeof(FX_WCHAR)); - ReplaceParagEnd(lpBuffer, nLength, FALSE); + ReplaceParagEnd(lpBuffer, nLength, false); wsTemp.ReleaseBuffer(nLength); if (m_nLimit > 0 && nLength > m_nLimit) { wsTemp.Delete(m_nLimit, nLength - m_nLimit); @@ -185,7 +185,7 @@ int32_t CFDE_TxtEdtEngine::GetCaretPos() const { return m_nCaret + (m_bBefore ? 0 : 1); } -int32_t CFDE_TxtEdtEngine::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) { +int32_t CFDE_TxtEdtEngine::SetCaretPos(int32_t nIndex, bool bBefore) { if (IsLocked()) { return 0; } @@ -199,7 +199,7 @@ int32_t CFDE_TxtEdtEngine::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) { GetCaretRect(m_rtCaret, m_nCaretPage, m_nCaret, m_bBefore); if (!m_bBefore) { m_nCaret++; - m_bBefore = TRUE; + m_bBefore = true; } m_fCaretPosReserve = (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) ? m_rtCaret.top @@ -210,18 +210,18 @@ int32_t CFDE_TxtEdtEngine::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) { } int32_t CFDE_TxtEdtEngine::MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret, - FX_BOOL bShift, - FX_BOOL bCtrl) { + bool bShift, + bool bCtrl) { if (IsLocked()) { return 0; } if (m_PagePtrArray.GetSize() <= m_nCaretPage) { return 0; } - FX_BOOL bSelChange = FALSE; + bool bSelChange = false; if (IsSelect()) { ClearSelection(); - bSelChange = TRUE; + bSelChange = true; } if (bShift) { if (m_nAnchorPos == -1) { @@ -230,7 +230,7 @@ int32_t CFDE_TxtEdtEngine::MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret, } else { m_nAnchorPos = -1; } - FX_BOOL bVertical = m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical; + bool bVertical = m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical; switch (eMoveCaret) { case MC_Left: { if (bVertical) { @@ -239,7 +239,7 @@ int32_t CFDE_TxtEdtEngine::MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret, UpdateCaretIndex(ptCaret); } } else { - FX_BOOL bBefore = TRUE; + bool bBefore = true; int32_t nIndex = MoveBackward(bBefore); if (nIndex >= 0) { UpdateCaretRect(nIndex, bBefore); @@ -253,7 +253,7 @@ int32_t CFDE_TxtEdtEngine::MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret, UpdateCaretIndex(ptCaret); } } else { - FX_BOOL bBefore = TRUE; + bool bBefore = true; int32_t nIndex = MoveForward(bBefore); if (nIndex >= 0) { UpdateCaretRect(nIndex, bBefore); @@ -262,7 +262,7 @@ int32_t CFDE_TxtEdtEngine::MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret, } break; case MC_Up: { if (bVertical) { - FX_BOOL bBefore = TRUE; + bool bBefore = true; int32_t nIndex = MoveBackward(bBefore); if (nIndex >= 0) { UpdateCaretRect(nIndex, bBefore); @@ -276,7 +276,7 @@ int32_t CFDE_TxtEdtEngine::MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret, } break; case MC_Down: { if (bVertical) { - FX_BOOL bBefore = TRUE; + bool bBefore = true; int32_t nIndex = MoveForward(bBefore); if (nIndex >= 0) { UpdateCaretRect(nIndex, bBefore); @@ -329,14 +329,14 @@ int32_t CFDE_TxtEdtEngine::MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret, } void CFDE_TxtEdtEngine::Lock() { - m_bLock = TRUE; + m_bLock = true; } void CFDE_TxtEdtEngine::Unlock() { - m_bLock = FALSE; + m_bLock = false; } -FX_BOOL CFDE_TxtEdtEngine::IsLocked() const { +bool CFDE_TxtEdtEngine::IsLocked() const { return m_bLock; } @@ -349,9 +349,9 @@ int32_t CFDE_TxtEdtEngine::Insert(int32_t nStart, CFX_WideString wsTemp; FX_WCHAR* lpBuffer = wsTemp.GetBuffer(nLength); FXSYS_memcpy(lpBuffer, lpText, nLength * sizeof(FX_WCHAR)); - ReplaceParagEnd(lpBuffer, nLength, FALSE); + ReplaceParagEnd(lpBuffer, nLength, false); wsTemp.ReleaseBuffer(nLength); - FX_BOOL bPart = FALSE; + bool bPart = false; if (m_nLimit > 0) { int32_t nTotalLength = GetTextBufLength(); int32_t nCount = m_SelRangePtrArr.GetSize(); @@ -365,7 +365,7 @@ int32_t CFDE_TxtEdtEngine::Insert(int32_t nStart, } if (nExpectLength > m_nLimit) { nLength -= (nExpectLength - m_nLimit); - bPart = TRUE; + bPart = true; } } if ((m_Param.dwMode & FDE_TEXTEDITMODE_LimitArea_Vert) || @@ -400,7 +400,7 @@ int32_t CFDE_TxtEdtEngine::Insert(int32_t nStart, return FDE_TXTEDT_MODIFY_RET_F_Full; } if (nLength < nTemp) { - bPart = TRUE; + bPart = true; } } if (m_Param.dwMode & FDE_TEXTEDITMODE_Validate) { @@ -425,17 +425,17 @@ int32_t CFDE_TxtEdtEngine::Insert(int32_t nStart, nStart = m_nCaret; nStart += nLength; FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nStart - 1); - FX_BOOL bBefore = TRUE; + bool bBefore = true; if (wChar != L'\n' && wChar != L'\r') { nStart--; - bBefore = FALSE; + bBefore = false; } SetCaretPos(nStart, bBefore); m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo); return bPart ? FDE_TXTEDT_MODIFY_RET_S_Part : FDE_TXTEDT_MODIFY_RET_S_Normal; } -int32_t CFDE_TxtEdtEngine::Delete(int32_t nStart, FX_BOOL bBackspace) { +int32_t CFDE_TxtEdtEngine::Delete(int32_t nStart, bool bBackspace) { if (IsLocked()) { return FDE_TXTEDT_MODIFY_RET_F_Locked; } @@ -507,7 +507,7 @@ int32_t CFDE_TxtEdtEngine::DeleteRange(int32_t nStart, int32_t nCount) { } DeleteRange_DoRecord(nStart, nCount); m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo); - SetCaretPos(nStart, TRUE); + SetCaretPos(nStart, true); return FDE_TXTEDT_MODIFY_RET_S_Normal; } @@ -543,10 +543,10 @@ int32_t CFDE_TxtEdtEngine::Replace(int32_t nStart, m_ChangeInfo.wsInsert = CFX_WideString(wsReplace.c_str(), nTextLength); nStart += nTextLength; FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nStart - 1); - FX_BOOL bBefore = TRUE; + bool bBefore = true; if (wChar != L'\n' && wChar != L'\r') { nStart--; - bBefore = FALSE; + bBefore = false; } SetCaretPos(nStart, bBefore); m_Param.pEventSink->On_PageUnload(this, m_nCaretPage, 0); @@ -601,7 +601,7 @@ void CFDE_TxtEdtEngine::AddSelRange(int32_t nStart, int32_t nCount) { return; } int32_t nEnd = nStart + nCount - 1; - FX_BOOL bBegin = FALSE; + bool bBegin = false; int32_t nRangeBgn = 0; int32_t nRangeCnt = 0; for (int32_t i = 0; i < nSize; i++) { @@ -623,7 +623,7 @@ void CFDE_TxtEdtEngine::AddSelRange(int32_t nStart, int32_t nCount) { break; } nRangeCnt = 1; - bBegin = TRUE; + bBegin = true; } } } @@ -664,19 +664,19 @@ void CFDE_TxtEdtEngine::ClearSelection() { m_Param.pEventSink->On_SelChanged(this); } -FX_BOOL CFDE_TxtEdtEngine::Redo(const IFDE_TxtEdtDoRecord* pDoRecord) { +bool CFDE_TxtEdtEngine::Redo(const IFDE_TxtEdtDoRecord* pDoRecord) { if (IsLocked()) - return FALSE; + return false; if (m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo) - return FALSE; + return false; return pDoRecord->Redo(); } -FX_BOOL CFDE_TxtEdtEngine::Undo(const IFDE_TxtEdtDoRecord* pDoRecord) { +bool CFDE_TxtEdtEngine::Undo(const IFDE_TxtEdtDoRecord* pDoRecord) { if (IsLocked()) - return FALSE; + return false; if (m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo) - return FALSE; + return false; return pDoRecord->Undo(); } @@ -719,7 +719,7 @@ void CFDE_TxtEdtEngine::EndLayout() { Unlock(); } -FX_BOOL CFDE_TxtEdtEngine::Optimize(IFX_Pause* pPause) { +bool CFDE_TxtEdtEngine::Optimize(IFX_Pause* pPause) { return m_pTxtBuf->Optimize(pPause); } @@ -848,7 +848,7 @@ void CFDE_TxtEdtEngine::Inner_Insert(int32_t nStart, int32_t nTextStart = 0; FX_WCHAR wCurChar = L' '; const FX_WCHAR* lpPos = lpText; - FX_BOOL bFirst = TRUE; + bool bFirst = true; int32_t nParagIndex = ParagPos.nParagIndex; for (i = 0; i < nLength; i++, lpPos++) { wCurChar = *lpPos; @@ -857,7 +857,7 @@ void CFDE_TxtEdtEngine::Inner_Insert(int32_t nStart, pParag->SetTextLength(nLeavePart + (i - nTextStart + 1)); pParag->SetLineCount(-1); nReserveCharStart += pParag->GetTextLength(); - bFirst = FALSE; + bFirst = false; } else { pParag = new CFDE_TxtEdtParag(this); pParag->SetLineCount(-1); @@ -872,7 +872,7 @@ void CFDE_TxtEdtEngine::Inner_Insert(int32_t nStart, if (bFirst) { pParag->IncrementTextLength(nLength); pParag->SetLineCount(-1); - bFirst = FALSE; + bFirst = false; } else { pParag = new CFDE_TxtEdtParag(this); pParag->SetLineCount(-1); @@ -903,12 +903,12 @@ void CFDE_TxtEdtEngine::Inner_DeleteRange(int32_t nStart, int32_t nCount) { TextPos2ParagPos(nStart, ParagPosBgn); TextPos2ParagPos(nEnd, ParagPosEnd); CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPosEnd.nParagIndex]; - FX_BOOL bLastParag = FALSE; + bool bLastParag = false; if (ParagPosEnd.nCharIndex == pParag->GetTextLength() - 1) { if (ParagPosEnd.nParagIndex < m_ParagPtrArray.GetSize() - 1) { ParagPosEnd.nParagIndex++; } else { - bLastParag = TRUE; + bLastParag = true; } } int32_t nTotalLineCount = 0; @@ -949,7 +949,7 @@ void CFDE_TxtEdtEngine::Inner_DeleteRange(int32_t nStart, int32_t nCount) { void CFDE_TxtEdtEngine::DeleteRange_DoRecord(int32_t nStart, int32_t nCount, - FX_BOOL bSel) { + bool bSel) { ASSERT(nStart >= 0); if (nCount == -1) { nCount = GetTextLength() - nStart; @@ -973,7 +973,7 @@ void CFDE_TxtEdtEngine::ResetEngine() { RemoveAllParags(); ClearSelection(); m_nCaret = 0; - m_pTxtBuf->Clear(FALSE); + m_pTxtBuf->Clear(false); m_nCaret = 0; } @@ -1146,18 +1146,18 @@ void CFDE_TxtEdtEngine::UpdateTxtBreak() { m_pTextBreak->SetCharSpace(m_Param.fCharSpace); } -FX_BOOL CFDE_TxtEdtEngine::ReplaceParagEnd(FX_WCHAR*& lpText, - int32_t& nLength, - FX_BOOL bPreIsCR) { +bool CFDE_TxtEdtEngine::ReplaceParagEnd(FX_WCHAR*& lpText, + int32_t& nLength, + bool bPreIsCR) { for (int32_t i = 0; i < nLength; i++) { FX_WCHAR wc = lpText[i]; switch (wc) { case L'\r': { lpText[i] = m_wLineEnd; - bPreIsCR = TRUE; + bPreIsCR = true; } break; case L'\n': { - if (bPreIsCR == TRUE) { + if (bPreIsCR == true) { int32_t nNext = i + 1; if (nNext < nLength) { FXSYS_memmove(lpText + i, lpText + nNext, @@ -1165,25 +1165,25 @@ FX_BOOL CFDE_TxtEdtEngine::ReplaceParagEnd(FX_WCHAR*& lpText, } i--; nLength--; - bPreIsCR = FALSE; + bPreIsCR = false; if (m_bAutoLineEnd) { m_nFirstLineEnd = FDE_TXTEDIT_LINEEND_CRLF; - m_bAutoLineEnd = FALSE; + m_bAutoLineEnd = false; } } else { lpText[i] = m_wLineEnd; if (m_bAutoLineEnd) { m_nFirstLineEnd = FDE_TXTEDIT_LINEEND_LF; - m_bAutoLineEnd = FALSE; + m_bAutoLineEnd = false; } } } break; default: { if (bPreIsCR && m_bAutoLineEnd) { m_nFirstLineEnd = FDE_TXTEDIT_LINEEND_CR; - m_bAutoLineEnd = FALSE; + m_bAutoLineEnd = false; } - bPreIsCR = FALSE; + bPreIsCR = false; } break; } } @@ -1303,7 +1303,7 @@ void CFDE_TxtEdtEngine::TextPos2ParagPos(int32_t nIndex, ParagPos.nCharIndex = nIndex - m_ParagPtrArray[nMid]->GetStartIndex(); } -int32_t CFDE_TxtEdtEngine::MoveForward(FX_BOOL& bBefore) { +int32_t CFDE_TxtEdtEngine::MoveForward(bool& bBefore) { if (m_nCaret == m_pTxtBuf->GetTextLength() - 1) return -1; @@ -1314,13 +1314,13 @@ int32_t CFDE_TxtEdtEngine::MoveForward(FX_BOOL& bBefore) { nCaret++; } nCaret++; - bBefore = TRUE; + bBefore = true; return nCaret; } -int32_t CFDE_TxtEdtEngine::MoveBackward(FX_BOOL& bBefore) { +int32_t CFDE_TxtEdtEngine::MoveBackward(bool& bBefore) { if (m_nCaret == 0) - return FALSE; + return false; int32_t nCaret = m_nCaret; if (nCaret > 2 && m_pTxtBuf->GetCharByIndex(nCaret - 1) == L'\n' && @@ -1328,26 +1328,26 @@ int32_t CFDE_TxtEdtEngine::MoveBackward(FX_BOOL& bBefore) { nCaret--; } nCaret--; - bBefore = TRUE; + bBefore = true; return nCaret; } -FX_BOOL CFDE_TxtEdtEngine::MoveUp(CFX_PointF& ptCaret) { +bool CFDE_TxtEdtEngine::MoveUp(CFX_PointF& ptCaret) { IFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage); const CFX_RectF& rtContent = pPage->GetContentsBox(); if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) { ptCaret.x = m_rtCaret.left + m_rtCaret.width / 2 - m_Param.fLineSpace; ptCaret.y = m_fCaretPosReserve; - FX_BOOL bLineReserve = + bool bLineReserve = !!(m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_LineReserve); if (ptCaret.x < rtContent.left) { if (bLineReserve) { if (m_nCaretPage == CountPages() - 1) { - return FALSE; + return false; } } else { if (m_nCaretPage == 0) { - return FALSE; + return false; } } if (bLineReserve) { @@ -1364,7 +1364,7 @@ FX_BOOL CFDE_TxtEdtEngine::MoveUp(CFX_PointF& ptCaret) { ptCaret.y = m_rtCaret.top + m_rtCaret.height / 2 - m_Param.fLineSpace; if (ptCaret.y < rtContent.top) { if (m_nCaretPage == 0) { - return FALSE; + return false; } ptCaret.y -= rtContent.top; m_nCaretPage--; @@ -1372,25 +1372,25 @@ FX_BOOL CFDE_TxtEdtEngine::MoveUp(CFX_PointF& ptCaret) { ptCaret.y += pCurPage->GetContentsBox().bottom(); } } - return TRUE; + return true; } -FX_BOOL CFDE_TxtEdtEngine::MoveDown(CFX_PointF& ptCaret) { +bool CFDE_TxtEdtEngine::MoveDown(CFX_PointF& ptCaret) { IFDE_TxtEdtPage* pPage = GetPage(m_nCaretPage); const CFX_RectF& rtContent = pPage->GetContentsBox(); if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) { ptCaret.x = m_rtCaret.left + m_rtCaret.width / 2 + m_Param.fLineSpace; ptCaret.y = m_fCaretPosReserve; if (ptCaret.x >= rtContent.right()) { - FX_BOOL bLineReserve = + bool bLineReserve = !!(m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_LineReserve); if (bLineReserve) { if (m_nCaretPage == 0) { - return FALSE; + return false; } } else { if (m_nCaretPage == CountPages() - 1) { - return FALSE; + return false; } } if (bLineReserve) { @@ -1407,7 +1407,7 @@ FX_BOOL CFDE_TxtEdtEngine::MoveDown(CFX_PointF& ptCaret) { ptCaret.y = m_rtCaret.top + m_rtCaret.height / 2 + m_Param.fLineSpace; if (ptCaret.y >= rtContent.bottom()) { if (m_nCaretPage == CountPages() - 1) { - return FALSE; + return false; } ptCaret.y -= rtContent.bottom(); m_nCaretPage++; @@ -1415,10 +1415,10 @@ FX_BOOL CFDE_TxtEdtEngine::MoveDown(CFX_PointF& ptCaret) { ptCaret.y += pCurPage->GetContentsBox().top; } } - return TRUE; + return true; } -FX_BOOL CFDE_TxtEdtEngine::MoveLineStart() { +bool CFDE_TxtEdtEngine::MoveLineStart() { int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1; FDE_TXTEDTPARAGPOS ParagPos; TextPos2ParagPos(nIndex, ParagPos); @@ -1434,12 +1434,12 @@ FX_BOOL CFDE_TxtEdtEngine::MoveLineStart() { break; } } - UpdateCaretRect(nStart, TRUE); + UpdateCaretRect(nStart, true); pParag->UnloadParag(); - return TRUE; + return true; } -FX_BOOL CFDE_TxtEdtEngine::MoveLineEnd() { +bool CFDE_TxtEdtEngine::MoveLineEnd() { int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1; FDE_TXTEDTPARAGPOS ParagPos; TextPos2ParagPos(nIndex, ParagPos); @@ -1458,12 +1458,12 @@ FX_BOOL CFDE_TxtEdtEngine::MoveLineEnd() { nIndex = nStart + nCount - 1; ASSERT(nIndex <= GetTextBufLength()); FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nIndex); - FX_BOOL bBefore = FALSE; + bool bBefore = false; if (nIndex <= GetTextBufLength()) { if (wChar == L'\r') { - bBefore = TRUE; + bBefore = true; } else if (wChar == L'\n' && nIndex > nStart) { - bBefore = TRUE; + bBefore = true; nIndex--; wChar = m_pTxtBuf->GetCharByIndex(nIndex); if (wChar != L'\r') { @@ -1473,19 +1473,19 @@ FX_BOOL CFDE_TxtEdtEngine::MoveLineEnd() { } UpdateCaretRect(nIndex, bBefore); pParag->UnloadParag(); - return TRUE; + return true; } -FX_BOOL CFDE_TxtEdtEngine::MoveParagStart() { +bool CFDE_TxtEdtEngine::MoveParagStart() { int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1; FDE_TXTEDTPARAGPOS ParagPos; TextPos2ParagPos(nIndex, ParagPos); CFDE_TxtEdtParag* pParag = m_ParagPtrArray[ParagPos.nParagIndex]; - UpdateCaretRect(pParag->GetStartIndex(), TRUE); - return TRUE; + UpdateCaretRect(pParag->GetStartIndex(), true); + return true; } -FX_BOOL CFDE_TxtEdtEngine::MoveParagEnd() { +bool CFDE_TxtEdtEngine::MoveParagEnd() { int32_t nIndex = m_bBefore ? m_nCaret : m_nCaret - 1; FDE_TXTEDTPARAGPOS ParagPos; TextPos2ParagPos(nIndex, ParagPos); @@ -1499,21 +1499,21 @@ FX_BOOL CFDE_TxtEdtEngine::MoveParagEnd() { nIndex++; } } - UpdateCaretRect(nIndex, TRUE); - return TRUE; + UpdateCaretRect(nIndex, true); + return true; } -FX_BOOL CFDE_TxtEdtEngine::MoveHome() { - UpdateCaretRect(0, TRUE); - return TRUE; +bool CFDE_TxtEdtEngine::MoveHome() { + UpdateCaretRect(0, true); + return true; } -FX_BOOL CFDE_TxtEdtEngine::MoveEnd() { - UpdateCaretRect(GetTextBufLength(), TRUE); - return TRUE; +bool CFDE_TxtEdtEngine::MoveEnd() { + UpdateCaretRect(GetTextBufLength(), true); + return true; } -FX_BOOL CFDE_TxtEdtEngine::IsFitArea(CFX_WideString& wsText) { +bool CFDE_TxtEdtEngine::IsFitArea(CFX_WideString& wsText) { std::unique_ptr<CFDE_TextOut> pTextOut(new CFDE_TextOut); pTextOut->SetLineSpace(m_Param.fLineSpace); pTextOut->SetFont(m_Param.pFont); @@ -1536,23 +1536,23 @@ FX_BOOL CFDE_TxtEdtEngine::IsFitArea(CFX_WideString& wsText) { wsText.Delete(wsText.GetLength() - 1); if ((m_Param.dwMode & FDE_TEXTEDITMODE_LimitArea_Horz) && (rcText.width > m_Param.fPlateWidth)) { - return FALSE; + return false; } if ((m_Param.dwMode & FDE_TEXTEDITMODE_LimitArea_Vert) && (rcText.height > m_Param.fLineSpace * m_Param.nLineCount)) { - return FALSE; + return false; } - return TRUE; + return true; } -void CFDE_TxtEdtEngine::UpdateCaretRect(int32_t nIndex, FX_BOOL bBefore) { +void CFDE_TxtEdtEngine::UpdateCaretRect(int32_t nIndex, bool bBefore) { MovePage2Char(nIndex); GetCaretRect(m_rtCaret, m_nCaretPage, nIndex, bBefore); m_nCaret = nIndex; m_bBefore = bBefore; if (!m_bBefore) { m_nCaret++; - m_bBefore = TRUE; + m_bBefore = true; } m_fCaretPosReserve = (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) ? m_rtCaret.top @@ -1563,14 +1563,14 @@ void CFDE_TxtEdtEngine::UpdateCaretRect(int32_t nIndex, FX_BOOL bBefore) { void CFDE_TxtEdtEngine::GetCaretRect(CFX_RectF& rtCaret, int32_t nPageIndex, int32_t nCaret, - FX_BOOL bBefore) { + bool bBefore) { IFDE_TxtEdtPage* pPage = m_PagePtrArray[m_nCaretPage]; m_Param.pEventSink->On_PageLoad(this, m_nCaretPage, 0); - FX_BOOL bCombText = !!(m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_CombText); + bool bCombText = !!(m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_CombText); int32_t nIndexInpage = nCaret - pPage->GetCharStart(); if (bBefore && bCombText && nIndexInpage > 0) { nIndexInpage--; - bBefore = FALSE; + bBefore = false; } int32_t nBIDILevel = pPage->GetCharRect(nIndexInpage, rtCaret, bCombText); if (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical) { @@ -1602,13 +1602,13 @@ void CFDE_TxtEdtEngine::UpdateCaretIndex(const CFX_PointF& ptCaret) { GetCaretRect(m_rtCaret, m_nCaretPage, m_nCaret, m_bBefore); if (!m_bBefore) { m_nCaret++; - m_bBefore = TRUE; + m_bBefore = true; } m_Param.pEventSink->On_CaretChanged(this, m_nCaretPage); m_Param.pEventSink->On_PageUnload(this, m_nCaretPage, 0); } -FX_BOOL CFDE_TxtEdtEngine::IsSelect() { +bool CFDE_TxtEdtEngine::IsSelect() { return m_SelRangePtrArr.GetSize() > 0; } @@ -1620,12 +1620,12 @@ void CFDE_TxtEdtEngine::DeleteSelect() { int32_t nSelCount = GetSelRange(--nCountRange, nSelStart); delete m_SelRangePtrArr[nCountRange]; m_SelRangePtrArr.RemoveAt(nCountRange); - DeleteRange_DoRecord(nSelStart, nSelCount, TRUE); + DeleteRange_DoRecord(nSelStart, nSelCount, true); } ClearSelection(); m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo); m_Param.pEventSink->On_SelChanged(this); - SetCaretPos(nSelStart, TRUE); + SetCaretPos(nSelStart, true); return; } } diff --git a/xfa/fde/cfde_txtedtengine.h b/xfa/fde/cfde_txtedtengine.h index 974913936f..8f0e855f52 100644 --- a/xfa/fde/cfde_txtedtengine.h +++ b/xfa/fde/cfde_txtedtengine.h @@ -36,16 +36,16 @@ class CFDE_TxtEdtEngine { int32_t GetCaretRect(CFX_RectF& rtCaret) const; int32_t GetCaretPos() const; - int32_t SetCaretPos(int32_t nIndex, FX_BOOL bBefore); + int32_t SetCaretPos(int32_t nIndex, bool bBefore); int32_t MoveCaretPos(FDE_TXTEDTMOVECARET eMoveCaret, - FX_BOOL bShift = FALSE, - FX_BOOL bCtrl = FALSE); + bool bShift = false, + bool bCtrl = false); void Lock(); void Unlock(); - FX_BOOL IsLocked() const; + bool IsLocked() const; int32_t Insert(int32_t nStart, const FX_WCHAR* lpText, int32_t nLength); - int32_t Delete(int32_t nStart, FX_BOOL bBackspace = FALSE); + int32_t Delete(int32_t nStart, bool bBackspace = false); int32_t DeleteRange(int32_t nStart, int32_t nCount = -1); int32_t Replace(int32_t nStart, int32_t nLength, @@ -61,14 +61,14 @@ class CFDE_TxtEdtEngine { int32_t GetSelRange(int32_t nIndex, int32_t& nStart); void ClearSelection(); - FX_BOOL Redo(const IFDE_TxtEdtDoRecord* pRecord); - FX_BOOL Undo(const IFDE_TxtEdtDoRecord* pRecord); + bool Redo(const IFDE_TxtEdtDoRecord* pRecord); + bool Undo(const IFDE_TxtEdtDoRecord* pRecord); int32_t StartLayout(); int32_t DoLayout(IFX_Pause* pPause); void EndLayout(); - FX_BOOL Optimize(IFX_Pause* pPause = nullptr); + bool Optimize(IFX_Pause* pPause = nullptr); int32_t CountParags() const; CFDE_TxtEdtParag* GetParag(int32_t nParagIndex) const; IFX_CharIter* CreateCharIter(); @@ -114,9 +114,7 @@ class CFDE_TxtEdtEngine { int32_t nLength); void Inner_DeleteRange(int32_t nStart, int32_t nCount = -1); - void DeleteRange_DoRecord(int32_t nStart, - int32_t nCount, - FX_BOOL bSel = FALSE); + void DeleteRange_DoRecord(int32_t nStart, int32_t nCount, bool bSel = false); void ResetEngine(); void RebuildParagraphs(); void RemoveAllParags(); @@ -125,31 +123,31 @@ class CFDE_TxtEdtEngine { void UpdatePages(); void UpdateTxtBreak(); - FX_BOOL ReplaceParagEnd(FX_WCHAR*& lpText, - int32_t& nLength, - FX_BOOL bPreIsCR = FALSE); + bool ReplaceParagEnd(FX_WCHAR*& lpText, + int32_t& nLength, + bool bPreIsCR = false); void RecoverParagEnd(CFX_WideString& wsText); int32_t MovePage2Char(int32_t nIndex); void TextPos2ParagPos(int32_t nIndex, FDE_TXTEDTPARAGPOS& ParagPos) const; - int32_t MoveForward(FX_BOOL& bBefore); - int32_t MoveBackward(FX_BOOL& bBefore); - FX_BOOL MoveUp(CFX_PointF& ptCaret); - FX_BOOL MoveDown(CFX_PointF& ptCaret); - FX_BOOL MoveLineStart(); - FX_BOOL MoveLineEnd(); - FX_BOOL MoveParagStart(); - FX_BOOL MoveParagEnd(); - FX_BOOL MoveHome(); - FX_BOOL MoveEnd(); - FX_BOOL IsFitArea(CFX_WideString& wsText); - void UpdateCaretRect(int32_t nIndex, FX_BOOL bBefore = TRUE); + int32_t MoveForward(bool& bBefore); + int32_t MoveBackward(bool& bBefore); + bool MoveUp(CFX_PointF& ptCaret); + bool MoveDown(CFX_PointF& ptCaret); + bool MoveLineStart(); + bool MoveLineEnd(); + bool MoveParagStart(); + bool MoveParagEnd(); + bool MoveHome(); + bool MoveEnd(); + bool IsFitArea(CFX_WideString& wsText); + void UpdateCaretRect(int32_t nIndex, bool bBefore = true); void GetCaretRect(CFX_RectF& rtCaret, int32_t nPageIndex, int32_t nCaret, - FX_BOOL bBefore = TRUE); + bool bBefore = true); void UpdateCaretIndex(const CFX_PointF& ptCaret); - FX_BOOL IsSelect(); + bool IsSelect(); void DeleteSelect(); std::unique_ptr<CFDE_TxtEdtBuf> m_pTxtBuf; @@ -164,15 +162,15 @@ class CFDE_TxtEdtEngine { int32_t m_nLayoutPos; FX_FLOAT m_fCaretPosReserve; int32_t m_nCaret; - FX_BOOL m_bBefore; + bool m_bBefore; int32_t m_nCaretPage; CFX_RectF m_rtCaret; uint32_t m_dwFindFlags; - FX_BOOL m_bLock; + bool m_bLock; int32_t m_nLimit; FX_WCHAR m_wcAliasChar; int32_t m_nFirstLineEnd; - FX_BOOL m_bAutoLineEnd; + bool m_bAutoLineEnd; FX_WCHAR m_wLineEnd; FDE_TXTEDT_TEXTCHANGE_INFO m_ChangeInfo; }; diff --git a/xfa/fde/cfde_txtedtpage.cpp b/xfa/fde/cfde_txtedtpage.cpp index 9f0d29f63d..0abb1d69f3 100644 --- a/xfa/fde/cfde_txtedtpage.cpp +++ b/xfa/fde/cfde_txtedtpage.cpp @@ -37,7 +37,7 @@ CFDE_TxtEdtPage::CFDE_TxtEdtPage(CFDE_TxtEdtEngine* pEngine, int32_t nPageIndex) m_nPageStart(-1), m_nCharCount(0), m_nPageIndex(nPageIndex), - m_bLoaded(FALSE) { + m_bLoaded(false) { FXSYS_memset(&m_rtPage, 0, sizeof(CFX_RectF)); FXSYS_memset(&m_rtPageMargin, 0, sizeof(CFX_RectF)); FXSYS_memset(&m_rtPageContents, 0, sizeof(CFX_RectF)); @@ -45,7 +45,7 @@ CFDE_TxtEdtPage::CFDE_TxtEdtPage(CFDE_TxtEdtEngine* pEngine, int32_t nPageIndex) } CFDE_TxtEdtPage::~CFDE_TxtEdtPage() { - m_PieceMassArr.RemoveAll(TRUE); + m_PieceMassArr.RemoveAll(true); } CFDE_TxtEdtEngine* CFDE_TxtEdtPage::GetEngine() const { @@ -60,7 +60,7 @@ void CFDE_TxtEdtPage::GetRect(FDE_TEXTEDITPIECE* hVisualObj, CFX_RectF& rt) {} int32_t CFDE_TxtEdtPage::GetCharRect(int32_t nIndex, CFX_RectF& rect, - FX_BOOL bBBox) const { + bool bBBox) const { ASSERT(m_nRefCount > 0); ASSERT(nIndex >= 0 && nIndex < m_nCharCount); if (m_nRefCount < 1) { @@ -81,17 +81,16 @@ int32_t CFDE_TxtEdtPage::GetCharRect(int32_t nIndex, return 0; } -int32_t CFDE_TxtEdtPage::GetCharIndex(const CFX_PointF& fPoint, - FX_BOOL& bBefore) { - FX_BOOL bVertical = m_pEditEngine->GetEditParams()->dwLayoutStyles & - FDE_TEXTEDITLAYOUT_DocVertical; +int32_t CFDE_TxtEdtPage::GetCharIndex(const CFX_PointF& fPoint, bool& bBefore) { + bool bVertical = m_pEditEngine->GetEditParams()->dwLayoutStyles & + FDE_TEXTEDITLAYOUT_DocVertical; CFX_PointF ptF = fPoint; NormalizePt2Rect(ptF, m_rtPageContents, kTolerance); int32_t nCount = m_PieceMassArr.GetSize(); CFX_RectF rtLine; int32_t nBgn = 0; int32_t nEnd = 0; - FX_BOOL bInLine = FALSE; + bool bInLine = false; int32_t i = 0; for (i = 0; i < nCount; i++) { const FDE_TEXTEDITPIECE* pPiece = m_PieceMassArr.GetPtrAt(i); @@ -101,7 +100,7 @@ int32_t CFDE_TxtEdtPage::GetCharIndex(const CFX_PointF& fPoint, pPiece->rtPiece.bottom() > ptF.y))) { nBgn = nEnd = i; rtLine = pPiece->rtPiece; - bInLine = TRUE; + bInLine = true; } else if (bInLine) { if (bVertical ? (!(pPiece->rtPiece.left <= ptF.x && pPiece->rtPiece.right() > ptF.x)) @@ -122,13 +121,13 @@ int32_t CFDE_TxtEdtPage::GetCharIndex(const CFX_PointF& fPoint, nCaret = m_nPageStart + pPiece->nStart; if (pPiece->rtPiece.Contains(ptF)) { CFX_RectFArray rectArr; - m_pTextSet->GetCharRects(pPiece, rectArr, FALSE); + m_pTextSet->GetCharRects(pPiece, rectArr, false); int32_t nRtCount = rectArr.GetSize(); for (int32_t j = 0; j < nRtCount; j++) { if (rectArr[j].Contains(ptF)) { nCaret = m_nPageStart + pPiece->nStart + j; if (nCaret >= m_pEditEngine->GetTextBufLength()) { - bBefore = TRUE; + bBefore = true; return m_pEditEngine->GetTextBufLength(); } FX_WCHAR wChar = m_pEditEngine->GetTextBuf()->GetCharByIndex(nCaret); @@ -139,7 +138,7 @@ int32_t CFDE_TxtEdtPage::GetCharIndex(const CFX_PointF& fPoint, nCaret--; } } - bBefore = TRUE; + bBefore = true; return nCaret; } if (bVertical @@ -154,7 +153,7 @@ int32_t CFDE_TxtEdtPage::GetCharIndex(const CFX_PointF& fPoint, } } } - bBefore = TRUE; + bBefore = true; return nCaret; } @@ -181,7 +180,7 @@ int32_t CFDE_TxtEdtPage::GetDisplayPos(const CFX_RectF& rtClip, if (!rtClip.IntersectWith(rtObj)) { continue; } - int32_t nCount = m_pTextSet->GetDisplayPos(pPiece, pos, FALSE); + int32_t nCount = m_pTextSet->GetDisplayPos(pPiece, pos, false); nCharPosCount += nCount; pos += nCount; } @@ -199,31 +198,31 @@ void CFDE_TxtEdtPage::CalcRangeRectArray(int32_t nStart, CFX_RectFArray& RectFArr) const { int32_t nPieceCount = m_PieceMassArr.GetSize(); int32_t nEnd = nStart + nCount - 1; - FX_BOOL bInRange = FALSE; + bool bInRange = false; for (int32_t i = 0; i < nPieceCount; i++) { FDE_TEXTEDITPIECE* piece = m_PieceMassArr.GetPtrAt(i); if (!bInRange) { if (nStart >= piece->nStart && nStart < (piece->nStart + piece->nCount)) { int32_t nRangeEnd = piece->nCount - 1; - FX_BOOL bEnd = FALSE; + bool bEnd = false; if (nEnd >= piece->nStart && nEnd < (piece->nStart + piece->nCount)) { nRangeEnd = nEnd - piece->nStart; - bEnd = TRUE; + bEnd = true; } CFX_RectFArray rcArr; - m_pTextSet->GetCharRects(piece, rcArr, FALSE); + m_pTextSet->GetCharRects(piece, rcArr, false); CFX_RectF rectPiece = rcArr[nStart - piece->nStart]; rectPiece.Union(rcArr[nRangeEnd]); RectFArr.Add(rectPiece); if (bEnd) { return; } - bInRange = TRUE; + bInRange = true; } } else { if (nEnd >= piece->nStart && nEnd < (piece->nStart + piece->nCount)) { CFX_RectFArray rcArr; - m_pTextSet->GetCharRects(piece, rcArr, FALSE); + m_pTextSet->GetCharRects(piece, rcArr, false); CFX_RectF rectPiece = rcArr[0]; rectPiece.Union(rcArr[nEnd - piece->nStart]); RectFArr.Add(rectPiece); @@ -239,7 +238,7 @@ int32_t CFDE_TxtEdtPage::SelectWord(const CFX_PointF& fPoint, int32_t& nCount) { return -1; } CFDE_TxtEdtBuf* pBuf = m_pEditEngine->GetTextBuf(); - FX_BOOL bBefore; + bool bBefore; int32_t nIndex = GetCharIndex(fPoint, bBefore); if (nIndex == m_pEditEngine->GetTextBufLength()) { nIndex = m_pEditEngine->GetTextBufLength() - 1; @@ -254,7 +253,7 @@ int32_t CFDE_TxtEdtPage::SelectWord(const CFX_PointF& fPoint, int32_t& nCount) { return pIter->GetWordPos(); } -FX_BOOL CFDE_TxtEdtPage::IsLoaded(const CFX_RectF* pClipBox) { +bool CFDE_TxtEdtPage::IsLoaded(const CFX_RectF* pClipBox) { return m_bLoaded; } @@ -293,8 +292,8 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, m_pEndParag->LoadParag(); m_pEndParag->GetLineRange(nEndLine - nEndLineInParag, nPageEnd, nTemp); nPageEnd += (nTemp - 1); - FX_BOOL bVertial = pParams->dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical; - FX_BOOL bLineReserve = + bool bVertial = pParams->dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical; + bool bLineReserve = !!(pParams->dwLayoutStyles & FDE_TEXTEDITLAYOUT_LineReserve); FX_FLOAT fLineStart = bVertial @@ -306,7 +305,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, if (!m_pTextSet) m_pTextSet.reset(new CFDE_TxtEdtTextSet(this)); - m_PieceMassArr.RemoveAll(TRUE); + m_PieceMassArr.RemoveAll(true); uint32_t dwBreakStatus = FX_TXTBREAK_None; int32_t nPieceStart = 0; @@ -315,12 +314,12 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, pBreak->ClearBreakPieces(); m_nPageStart = nPageStart; m_nCharCount = nPageEnd - nPageStart + 1; - FX_BOOL bReload = FALSE; + bool bReload = false; FX_FLOAT fDefCharWidth = 0; std::unique_ptr<IFX_CharIter> pIter(m_pIter->Clone()); pIter->SetAt(nPageStart); m_pIter->SetAt(nPageStart); - FX_BOOL bFirstPiece = TRUE; + bool bFirstPiece = true; do { if (bReload) { dwBreakStatus = pBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); @@ -381,7 +380,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, } if (bFirstPiece) { m_rtPageContents = TxtEdtPiece.rtPiece; - bFirstPiece = FALSE; + bFirstPiece = false; } else { m_rtPageContents.Union(TxtEdtPiece.rtPiece); } @@ -396,10 +395,10 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, pBreak->ClearBreakPieces(); } if (pIter->GetAt() == nPageEnd && dwBreakStatus == FX_TXTBREAK_LineBreak) { - bReload = TRUE; - pIter->Next(TRUE); + bReload = true; + pIter->Next(true); } - } while (pIter->Next(FALSE) && (pIter->GetAt() <= nPageEnd)); + } while (pIter->Next(false) && (pIter->GetAt() <= nPageEnd)); if (m_rtPageContents.left != 0) { FX_FLOAT fDelta = 0.0f; if (m_rtPageContents.width < pParams->fPlateWidth) { @@ -432,7 +431,7 @@ int32_t CFDE_TxtEdtPage::LoadPage(const CFX_RectF* pClipBox, pPiece->rtPiece.height = pParams->fFontSize; } m_nRefCount = 1; - m_bLoaded = TRUE; + m_bLoaded = true; return 0; } @@ -442,7 +441,7 @@ void CFDE_TxtEdtPage::UnloadPage(const CFX_RectF* pClipBox) { if (m_nRefCount != 0) return; - m_PieceMassArr.RemoveAll(FALSE); + m_PieceMassArr.RemoveAll(false); m_pTextSet.reset(); m_CharWidths.clear(); if (m_pBgnParag) { diff --git a/xfa/fde/cfde_txtedtpage.h b/xfa/fde/cfde_txtedtpage.h index 777f82929e..5cb4501afc 100644 --- a/xfa/fde/cfde_txtedtpage.h +++ b/xfa/fde/cfde_txtedtpage.h @@ -26,8 +26,8 @@ class CFDE_TxtEdtPage : public IFDE_TxtEdtPage { CFDE_TxtEdtEngine* GetEngine() const override; int32_t GetCharRect(int32_t nIndex, CFX_RectF& rect, - FX_BOOL bBBox = FALSE) const override; - int32_t GetCharIndex(const CFX_PointF& fPoint, FX_BOOL& bBefore) override; + bool bBBox = false) const override; + int32_t GetCharIndex(const CFX_PointF& fPoint, bool& bBefore) override; void CalcRangeRectArray(int32_t nStart, int32_t nCount, CFX_RectFArray& RectFArr) const override; @@ -37,7 +37,7 @@ class CFDE_TxtEdtPage : public IFDE_TxtEdtPage { int32_t GetDisplayPos(const CFX_RectF& rtClip, FXTEXT_CHARPOS*& pCharPos, CFX_RectF* pBBox) const override; - FX_BOOL IsLoaded(const CFX_RectF* pClipBox) override; + bool IsLoaded(const CFX_RectF* pClipBox) override; int32_t LoadPage(const CFX_RectF* pClipBox, IFX_Pause* pPause) override; void UnloadPage(const CFX_RectF* pClipBox) override; const CFX_RectF& GetContentsBox() override; @@ -72,7 +72,7 @@ class CFDE_TxtEdtPage : public IFDE_TxtEdtPage { int32_t m_nPageStart; int32_t m_nCharCount; int32_t m_nPageIndex; - FX_BOOL m_bLoaded; + bool m_bLoaded; CFX_RectF m_rtPage; CFX_RectF m_rtPageMargin; CFX_RectF m_rtPageContents; diff --git a/xfa/fde/cfde_txtedtparag.cpp b/xfa/fde/cfde_txtedtparag.cpp index 38f569d334..6e6a664ff2 100644 --- a/xfa/fde/cfde_txtedtparag.cpp +++ b/xfa/fde/cfde_txtedtparag.cpp @@ -44,7 +44,7 @@ void CFDE_TxtEdtParag::LoadParag() { pIter->SetAt(m_nCharStart); int32_t nEndIndex = m_nCharStart + m_nCharCount; CFX_ArrayTemplate<int32_t> LineBaseArr; - FX_BOOL bReload = FALSE; + bool bReload = false; uint32_t dwBreakStatus = FX_TXTBREAK_None; do { if (bReload) { @@ -69,10 +69,10 @@ void CFDE_TxtEdtParag::LoadParag() { } if ((pIter->GetAt() + 1 == nEndIndex) && (dwBreakStatus == FX_TXTBREAK_LineBreak)) { - bReload = TRUE; - pIter->Next(TRUE); + bReload = true; + pIter->Next(true); } - } while (pIter->Next(FALSE) && (pIter->GetAt() < nEndIndex)); + } while (pIter->Next(false) && (pIter->GetAt() < nEndIndex)); pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); pTxtBreak->ClearBreakPieces(); int32_t nLineCount = LineBaseArr.GetSize(); @@ -110,7 +110,7 @@ void CFDE_TxtEdtParag::CalcLines() { std::unique_ptr<IFX_CharIter> pIter( new CFDE_TxtEdtBufIter(static_cast<CFDE_TxtEdtBuf*>(pTxtBuf))); pIter->SetAt(m_nCharStart); - FX_BOOL bReload = FALSE; + bool bReload = false; do { if (bReload) { dwBreakStatus = pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); @@ -128,10 +128,10 @@ void CFDE_TxtEdtParag::CalcLines() { } if ((pIter->GetAt() + 1 == nEndIndex) && (dwBreakStatus == FX_TXTBREAK_LineBreak)) { - bReload = TRUE; - pIter->Next(TRUE); + bReload = true; + pIter->Next(true); } - } while (pIter->Next(FALSE) && (pIter->GetAt() < nEndIndex)); + } while (pIter->Next(false) && (pIter->GetAt() < nEndIndex)); pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); pTxtBreak->ClearBreakPieces(); m_nLineCount = nCount; diff --git a/xfa/fde/cfde_txtedttextset.cpp b/xfa/fde/cfde_txtedttextset.cpp index 9213d650f3..33da0c5a8f 100644 --- a/xfa/fde/cfde_txtedttextset.cpp +++ b/xfa/fde/cfde_txtedttextset.cpp @@ -46,7 +46,7 @@ FX_ARGB CFDE_TxtEdtTextSet::GetFontColor() { int32_t CFDE_TxtEdtTextSet::GetDisplayPos(FDE_TEXTEDITPIECE* pPiece, FXTEXT_CHARPOS* pCharPos, - FX_BOOL bCharCode, + bool bCharCode, CFX_WideString* pWSForms) { if (!pPiece) return 0; @@ -76,7 +76,7 @@ int32_t CFDE_TxtEdtTextSet::GetDisplayPos(FDE_TEXTEDITPIECE* pPiece, int32_t CFDE_TxtEdtTextSet::GetCharRects(const FDE_TEXTEDITPIECE* pPiece, CFX_RectFArray& rtArray, - FX_BOOL bBBox) { + bool bBBox) { if (!pPiece) return 0; diff --git a/xfa/fde/cfde_txtedttextset.h b/xfa/fde/cfde_txtedttextset.h index a2121659ba..14979dcf14 100644 --- a/xfa/fde/cfde_txtedttextset.h +++ b/xfa/fde/cfde_txtedttextset.h @@ -27,11 +27,11 @@ class CFDE_TxtEdtTextSet : public IFDE_TextSet { FX_ARGB GetFontColor() override; int32_t GetDisplayPos(FDE_TEXTEDITPIECE* pPiece, FXTEXT_CHARPOS* pCharPos, - FX_BOOL bCharCode = FALSE, + bool bCharCode = false, CFX_WideString* pWSForms = nullptr) override; int32_t GetCharRects(const FDE_TEXTEDITPIECE* pPiece, CFX_RectFArray& rtArray, - FX_BOOL bBBox) override; + bool bBBox) override; private: CFDE_TxtEdtPage* const m_pPage; diff --git a/xfa/fde/cfx_chariter.cpp b/xfa/fde/cfx_chariter.cpp index d51fb0868f..568ecd6cf0 100644 --- a/xfa/fde/cfx_chariter.cpp +++ b/xfa/fde/cfx_chariter.cpp @@ -13,17 +13,17 @@ CFX_CharIter::CFX_CharIter(const CFX_WideString& wsText) CFX_CharIter::~CFX_CharIter() {} -FX_BOOL CFX_CharIter::Next(FX_BOOL bPrev) { +bool CFX_CharIter::Next(bool bPrev) { if (bPrev) { if (m_nIndex <= 0) - return FALSE; + return false; m_nIndex--; } else { if (m_nIndex + 1 >= m_wsText.GetLength()) - return FALSE; + return false; m_nIndex++; } - return TRUE; + return true; } FX_WCHAR CFX_CharIter::GetChar() { @@ -40,7 +40,7 @@ int32_t CFX_CharIter::GetAt() const { return m_nIndex; } -FX_BOOL CFX_CharIter::IsEOF(FX_BOOL bTail) const { +bool CFX_CharIter::IsEOF(bool bTail) const { return bTail ? (m_nIndex + 1 == m_wsText.GetLength()) : (m_nIndex == 0); } diff --git a/xfa/fde/cfx_chariter.h b/xfa/fde/cfx_chariter.h index 004da3c279..d122af21f1 100644 --- a/xfa/fde/cfx_chariter.h +++ b/xfa/fde/cfx_chariter.h @@ -16,11 +16,11 @@ class CFX_CharIter : public IFX_CharIter { explicit CFX_CharIter(const CFX_WideString& wsText); ~CFX_CharIter() override; - FX_BOOL Next(FX_BOOL bPrev = FALSE) override; + bool Next(bool bPrev = false) override; FX_WCHAR GetChar() override; void SetAt(int32_t nIndex) override; int32_t GetAt() const override; - FX_BOOL IsEOF(FX_BOOL bTail = TRUE) const override; + bool IsEOF(bool bTail = true) const override; IFX_CharIter* Clone() override; private: diff --git a/xfa/fde/cfx_wordbreak.cpp b/xfa/fde/cfx_wordbreak.cpp index a9aa75b622..04fc32f550 100644 --- a/xfa/fde/cfx_wordbreak.cpp +++ b/xfa/fde/cfx_wordbreak.cpp @@ -2789,35 +2789,35 @@ void CFX_WordBreak::Attach(const CFX_WideString& wsText) { m_pCurIter.reset(new CFX_CharIter(wsText)); } -FX_BOOL CFX_WordBreak::Next(FX_BOOL bPrev) { +bool CFX_WordBreak::Next(bool bPrev) { std::unique_ptr<IFX_CharIter> pIter( (bPrev ? m_pPreIter : m_pCurIter)->Clone()); if (pIter->IsEOF(!bPrev)) - return FALSE; + return false; pIter->Next(bPrev); - if (!FindNextBreakPos(pIter.get(), bPrev, TRUE)) - return FALSE; + if (!FindNextBreakPos(pIter.get(), bPrev, true)) + return false; if (bPrev) { m_pCurIter = std::move(m_pPreIter); - m_pCurIter->Next(TRUE); + m_pCurIter->Next(true); m_pPreIter = std::move(pIter); } else { m_pPreIter = std::move(m_pCurIter); m_pPreIter->Next(); m_pCurIter = std::move(pIter); } - return TRUE; + return true; } void CFX_WordBreak::SetAt(int32_t nIndex) { m_pPreIter.reset(); m_pCurIter->SetAt(nIndex); - FindNextBreakPos(m_pCurIter.get(), TRUE, FALSE); + FindNextBreakPos(m_pCurIter.get(), true, false); m_pPreIter = std::move(m_pCurIter); m_pCurIter.reset(m_pPreIter->Clone()); - FindNextBreakPos(m_pCurIter.get(), FALSE, FALSE); + FindNextBreakPos(m_pCurIter.get(), false, false); } int32_t CFX_WordBreak::GetWordPos() const { @@ -2844,18 +2844,18 @@ void CFX_WordBreak::GetWord(CFX_WideString& wsWord) const { wsWord.ReleaseBuffer(nWordLength); } -FX_BOOL CFX_WordBreak::IsEOF(FX_BOOL bTail) const { +bool CFX_WordBreak::IsEOF(bool bTail) const { return m_pCurIter->IsEOF(bTail); } -FX_BOOL CFX_WordBreak::FindNextBreakPos(IFX_CharIter* pIter, - FX_BOOL bPrev, - FX_BOOL bFromNext) { +bool CFX_WordBreak::FindNextBreakPos(IFX_CharIter* pIter, + bool bPrev, + bool bFromNext) { FX_WordBreakProp ePreType = FX_WordBreakProp_None; FX_WordBreakProp eCurType = FX_WordBreakProp_None; FX_WordBreakProp eNextType = FX_WordBreakProp_None; if (pIter->IsEOF(!bPrev)) { - return TRUE; + return true; } if (!(bFromNext || pIter->IsEOF(bPrev))) { pIter->Next(!bPrev); @@ -2863,7 +2863,7 @@ FX_BOOL CFX_WordBreak::FindNextBreakPos(IFX_CharIter* pIter, pIter->Next(bPrev); } eCurType = GetWordBreakProperty(pIter->GetChar()); - FX_BOOL bFirst = TRUE; + bool bFirst = true; do { pIter->Next(bPrev); eNextType = GetWordBreakProperty(pIter->GetChar()); @@ -2872,7 +2872,7 @@ FX_BOOL CFX_WordBreak::FindNextBreakPos(IFX_CharIter* pIter, if (wBreak) { if (pIter->IsEOF(!bPrev)) { pIter->Next(!bPrev); - return TRUE; + return true; } if (bFirst) { int32_t nFlags = 0; @@ -2896,12 +2896,12 @@ FX_BOOL CFX_WordBreak::FindNextBreakPos(IFX_CharIter* pIter, if (!((nFlags == 1 && ePreType == FX_WordBreakProp_ALetter) || (nFlags == 2 && ePreType == FX_WordBreakProp_Numberic))) { pIter->Next(!bPrev); - return TRUE; + return true; } pIter->Next(bPrev); - wBreak = FALSE; + wBreak = false; } - bFirst = FALSE; + bFirst = false; } if (wBreak) { int32_t nFlags = 0; @@ -2922,7 +2922,7 @@ FX_BOOL CFX_WordBreak::FindNextBreakPos(IFX_CharIter* pIter, } if (nFlags <= 0) { pIter->Next(!bPrev); - return TRUE; + return true; } ASSERT(nFlags <= 2); pIter->Next(bPrev); @@ -2931,13 +2931,13 @@ FX_BOOL CFX_WordBreak::FindNextBreakPos(IFX_CharIter* pIter, (nFlags == 2 && eNextType == FX_WordBreakProp_Numberic))) { pIter->Next(!bPrev); pIter->Next(!bPrev); - return TRUE; + return true; } } } ePreType = eCurType; eCurType = eNextType; - bFirst = FALSE; + bFirst = false; } while (!pIter->IsEOF(!bPrev)); - return TRUE; + return true; } diff --git a/xfa/fde/cfx_wordbreak.h b/xfa/fde/cfx_wordbreak.h index 14cf7304cd..9df6eda1f5 100644 --- a/xfa/fde/cfx_wordbreak.h +++ b/xfa/fde/cfx_wordbreak.h @@ -21,17 +21,15 @@ class CFX_WordBreak { void Attach(IFX_CharIter* pIter); void Attach(const CFX_WideString& wsText); - FX_BOOL Next(FX_BOOL bPrev); + bool Next(bool bPrev); void SetAt(int32_t nIndex); int32_t GetWordPos() const; int32_t GetWordLength() const; void GetWord(CFX_WideString& wsWord) const; - FX_BOOL IsEOF(FX_BOOL bTail) const; + bool IsEOF(bool bTail) const; protected: - FX_BOOL FindNextBreakPos(IFX_CharIter* pIter, - FX_BOOL bPrev, - FX_BOOL bFromNext = TRUE); + bool FindNextBreakPos(IFX_CharIter* pIter, bool bPrev, bool bFromNext = true); private: std::unique_ptr<IFX_CharIter> m_pPreIter; diff --git a/xfa/fde/css/cfde_cssrulecollection.cpp b/xfa/fde/css/cfde_cssrulecollection.cpp index 95f94cbff3..70cc655a56 100644 --- a/xfa/fde/css/cfde_cssrulecollection.cpp +++ b/xfa/fde/css/cfde_cssrulecollection.cpp @@ -92,7 +92,7 @@ void CFDE_CSSRuleCollection::AddRulesFrom(IFDE_CSSStyleSheet* pStyleSheet, AddRuleTo(m_pUniversalRules, NewRuleData(pSelector, pDeclaration)); break; default: - ASSERT(FALSE); + ASSERT(false); break; } } @@ -126,16 +126,16 @@ void CFDE_CSSRuleCollection::AddRuleTo(CFX_MapPtrToPtr& map, } } -FX_BOOL CFDE_CSSRuleCollection::AddRuleTo(FDE_CSSRuleData*& pList, - FDE_CSSRuleData* pData) { +bool CFDE_CSSRuleCollection::AddRuleTo(FDE_CSSRuleData*& pList, + FDE_CSSRuleData* pData) { if (pList) { pData->pNext = pList->pNext; pList->pNext = pData; - return FALSE; + return false; } pList = pData; - return TRUE; + return true; } FDE_CSSRuleData* CFDE_CSSRuleCollection::NewRuleData( diff --git a/xfa/fde/css/fde_css.h b/xfa/fde/css/fde_css.h index 5b033cf014..1ee037537c 100644 --- a/xfa/fde/css/fde_css.h +++ b/xfa/fde/css/fde_css.h @@ -760,7 +760,7 @@ class IFDE_CSSStyleSheet : public IFX_Retainable { int32_t iBufSize, uint16_t wCodePage, uint32_t dwMediaList = FDE_CSSMEDIATYPE_ALL); - virtual FX_BOOL GetUrl(CFX_WideString& szUrl) = 0; + virtual bool GetUrl(CFX_WideString& szUrl) = 0; virtual uint32_t GetMediaList() const = 0; virtual uint16_t GetCodePage() const = 0; @@ -783,7 +783,7 @@ struct FDE_CSSLENGTH { return (FDE_CSSLENGTHUNIT)(m_iData & FDE_CSSUNITMASK); } FX_FLOAT GetValue() const { return (m_iData >> FDE_CSSUNITBITS) / 1024.0f; } - FX_BOOL NonZero() const { return (m_iData >> FDE_CSSUNITBITS) != 0; } + bool NonZero() const { return (m_iData >> FDE_CSSUNITBITS) != 0; } private: intptr_t m_iData; @@ -897,8 +897,8 @@ class IFDE_CSSComputedStyle : public IFX_Retainable { virtual IFDE_CSSBoundaryStyle* GetBoundaryStyles() = 0; virtual IFDE_CSSPositionStyle* GetPositionStyles() = 0; virtual IFDE_CSSParagraphStyle* GetParagraphStyles() = 0; - virtual FX_BOOL GetCustomStyle(const CFX_WideStringC& wsName, - CFX_WideString& wsValue) const = 0; + virtual bool GetCustomStyle(const CFX_WideStringC& wsName, + CFX_WideString& wsValue) const = 0; }; #endif // XFA_FDE_CSS_FDE_CSS_H_ diff --git a/xfa/fde/css/fde_csscache.h b/xfa/fde/css/fde_csscache.h index 8f4f2a78c7..10f4d9e0fa 100644 --- a/xfa/fde/css/fde_csscache.h +++ b/xfa/fde/css/fde_csscache.h @@ -58,7 +58,7 @@ class CFDE_CSSAccelerator : public CFX_Target { void OnEnterTag(CXFA_CSSTagProvider* pTag); void OnLeaveTag(CXFA_CSSTagProvider* pTag); - void Clear() { m_Stack.RemoveAll(FALSE); } + void Clear() { m_Stack.RemoveAll(false); } FDE_CSSTagCache* GetTopElement() const { return m_Stack.GetTopElement(); } diff --git a/xfa/fde/css/fde_cssdatatable.cpp b/xfa/fde/css/fde_cssdatatable.cpp index 955fe9e747..d2f81833e3 100644 --- a/xfa/fde/css/fde_cssdatatable.cpp +++ b/xfa/fde/css/fde_cssdatatable.cpp @@ -17,25 +17,25 @@ uint8_t Hex2Dec(uint8_t hexHigh, uint8_t hexLow) { } // namespace -FX_BOOL FDE_CSSLengthToFloat(const FDE_CSSLENGTH& len, - FX_FLOAT fPercentBase, - FX_FLOAT& fResult) { +bool FDE_CSSLengthToFloat(const FDE_CSSLENGTH& len, + FX_FLOAT fPercentBase, + FX_FLOAT& fResult) { switch (len.GetUnit()) { case FDE_CSSLENGTHUNIT_Point: fResult = len.GetValue(); - return TRUE; + return true; case FDE_CSSLENGTHUNIT_Percent: fResult = len.GetValue() * fPercentBase; - return TRUE; + return true; default: - return FALSE; + return false; } } CFX_FloatRect FDE_CSSBoundaryToRect(IFDE_CSSBoundaryStyle* pBoundStyle, FX_FLOAT fContainerWidth, - FX_BOOL bPadding, - FX_BOOL bBorder, - FX_BOOL bMargin) { + bool bPadding, + bool bBorder, + bool bMargin) { FX_FLOAT fResult; const FDE_CSSRECT* pRect; CFX_FloatRect rect(0, 0, 0, 0); @@ -672,15 +672,15 @@ FDE_LPCCSSCOLORTABLE FDE_GetCSSColorByName(const CFX_WideStringC& wsName) { return nullptr; } -FX_BOOL FDE_ParseCSSNumber(const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_FLOAT& fValue, - FDE_CSSPRIMITIVETYPE& eUnit) { +bool FDE_ParseCSSNumber(const FX_WCHAR* pszValue, + int32_t iValueLen, + FX_FLOAT& fValue, + FDE_CSSPRIMITIVETYPE& eUnit) { ASSERT(pszValue && iValueLen > 0); int32_t iUsedLen = 0; fValue = FXSYS_wcstof(pszValue, iValueLen, &iUsedLen); if (iUsedLen <= 0) - return FALSE; + return false; iValueLen -= iUsedLen; pszValue += iUsedLen; @@ -693,13 +693,13 @@ FX_BOOL FDE_ParseCSSNumber(const FX_WCHAR* pszValue, if (pUnit) eUnit = (FDE_CSSPRIMITIVETYPE)pUnit->wValue; } - return TRUE; + return true; } -FX_BOOL FDE_ParseCSSString(const FX_WCHAR* pszValue, - int32_t iValueLen, - int32_t& iOffset, - int32_t& iLength) { +bool FDE_ParseCSSString(const FX_WCHAR* pszValue, + int32_t iValueLen, + int32_t& iOffset, + int32_t& iLength) { ASSERT(pszValue && iValueLen > 0); iOffset = 0; iLength = iValueLen; @@ -712,25 +712,25 @@ FX_BOOL FDE_ParseCSSString(const FX_WCHAR* pszValue, return iValueLen > 0; } -FX_BOOL FDE_ParseCSSURI(const FX_WCHAR* pszValue, - int32_t iValueLen, - int32_t& iOffset, - int32_t& iLength) { +bool FDE_ParseCSSURI(const FX_WCHAR* pszValue, + int32_t iValueLen, + int32_t& iOffset, + int32_t& iLength) { ASSERT(pszValue && iValueLen > 0); if (iValueLen < 6 || pszValue[iValueLen - 1] != ')' || FXSYS_wcsnicmp(L"url(", pszValue, 4)) { - return FALSE; + return false; } if (FDE_ParseCSSString(pszValue + 4, iValueLen - 5, iOffset, iLength)) { iOffset += 4; - return TRUE; + return true; } - return FALSE; + return false; } -FX_BOOL FDE_ParseCSSColor(const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_ARGB& dwColor) { +bool FDE_ParseCSSColor(const FX_WCHAR* pszValue, + int32_t iValueLen, + FX_ARGB& dwColor) { ASSERT(pszValue && iValueLen > 0); if (*pszValue == '#') { @@ -740,23 +740,23 @@ FX_BOOL FDE_ParseCSSColor(const FX_WCHAR* pszValue, uint8_t green = Hex2Dec((uint8_t)pszValue[2], (uint8_t)pszValue[2]); uint8_t blue = Hex2Dec((uint8_t)pszValue[3], (uint8_t)pszValue[3]); dwColor = ArgbEncode(255, red, green, blue); - return TRUE; + return true; } case 7: { uint8_t red = Hex2Dec((uint8_t)pszValue[1], (uint8_t)pszValue[2]); uint8_t green = Hex2Dec((uint8_t)pszValue[3], (uint8_t)pszValue[4]); uint8_t blue = Hex2Dec((uint8_t)pszValue[5], (uint8_t)pszValue[6]); dwColor = ArgbEncode(255, red, green, blue); - return TRUE; + return true; } default: - return FALSE; + return false; } } if (iValueLen >= 10) { if (pszValue[iValueLen - 1] != ')' || FXSYS_wcsnicmp(L"rgb(", pszValue, 4)) - return FALSE; + return false; uint8_t rgb[3] = {0}; FX_FLOAT fValue; @@ -764,27 +764,27 @@ FX_BOOL FDE_ParseCSSColor(const FX_WCHAR* pszValue, CFDE_CSSValueListParser list(pszValue + 4, iValueLen - 5, ','); for (int32_t i = 0; i < 3; ++i) { if (!list.NextValue(eType, pszValue, iValueLen)) - return FALSE; + return false; if (eType != FDE_CSSPRIMITIVETYPE_Number) - return FALSE; + return false; if (!FDE_ParseCSSNumber(pszValue, iValueLen, fValue, eType)) - return FALSE; + return false; rgb[i] = eType == FDE_CSSPRIMITIVETYPE_Percent ? FXSYS_round(fValue * 2.55f) : FXSYS_round(fValue); } dwColor = ArgbEncode(255, rgb[0], rgb[1], rgb[2]); - return TRUE; + return true; } FDE_LPCCSSCOLORTABLE pColor = FDE_GetCSSColorByName(CFX_WideStringC(pszValue, iValueLen)); if (!pColor) - return FALSE; + return false; dwColor = pColor->dwValue; - return TRUE; + return true; } CFDE_CSSValueList::CFDE_CSSValueList(IFX_MemoryAllocator* pStaticStore, @@ -802,14 +802,14 @@ int32_t CFDE_CSSValueList::CountValues() const { IFDE_CSSValue* CFDE_CSSValueList::GetValue(int32_t index) const { return m_ppList[index]; } -FX_BOOL CFDE_CSSValueListParser::NextValue(FDE_CSSPRIMITIVETYPE& eType, - const FX_WCHAR*& pStart, - int32_t& iLength) { +bool CFDE_CSSValueListParser::NextValue(FDE_CSSPRIMITIVETYPE& eType, + const FX_WCHAR*& pStart, + int32_t& iLength) { while (m_pCur < m_pEnd && (*m_pCur <= ' ' || *m_pCur == m_Separator)) { ++m_pCur; } if (m_pCur >= m_pEnd) { - return FALSE; + return false; } eType = FDE_CSSPRIMITIVETYPE_Unknown; pStart = m_pCur; @@ -853,14 +853,14 @@ FX_BOOL CFDE_CSSValueListParser::NextValue(FDE_CSSPRIMITIVETYPE& eType, eType = FDE_CSSPRIMITIVETYPE_RGB; } } else { - iLength = SkipTo(m_Separator, TRUE, TRUE); + iLength = SkipTo(m_Separator, true, true); eType = FDE_CSSPRIMITIVETYPE_String; } return m_pCur <= m_pEnd && iLength > 0; } int32_t CFDE_CSSValueListParser::SkipTo(FX_WCHAR wch, - FX_BOOL bWSSeparator, - FX_BOOL bBrContinue) { + bool bWSSeparator, + bool bBrContinue) { const FX_WCHAR* pStart = m_pCur; if (!bBrContinue) { if (bWSSeparator) { diff --git a/xfa/fde/css/fde_cssdatatable.h b/xfa/fde/css/fde_cssdatatable.h index 62eff3f014..660895cdb0 100644 --- a/xfa/fde/css/fde_cssdatatable.h +++ b/xfa/fde/css/fde_cssdatatable.h @@ -81,15 +81,15 @@ class CFDE_CSSValueListParser : public CFX_Target { : m_Separator(separator), m_pCur(psz), m_pEnd(psz + iLen) { ASSERT(psz && iLen > 0); } - FX_BOOL NextValue(FDE_CSSPRIMITIVETYPE& eType, - const FX_WCHAR*& pStart, - int32_t& iLength); + bool NextValue(FDE_CSSPRIMITIVETYPE& eType, + const FX_WCHAR*& pStart, + int32_t& iLength); FX_WCHAR m_Separator; protected: int32_t SkipTo(FX_WCHAR wch, - FX_BOOL bWSSeparator = FALSE, - FX_BOOL bBrContinue = FALSE); + bool bWSSeparator = false, + bool bBrContinue = false); const FX_WCHAR* m_pCur; const FX_WCHAR* m_pEnd; @@ -155,20 +155,20 @@ struct FDE_CSSPERSUDOTABLE { typedef FDE_CSSPERSUDOTABLE const* FDE_LPCCSSPERSUDOTABLE; FDE_LPCCSSPERSUDOTABLE FDE_GetCSSPersudoByEnum(FDE_CSSPERSUDO ePersudo); -FX_BOOL FDE_ParseCSSNumber(const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_FLOAT& fValue, - FDE_CSSPRIMITIVETYPE& eUnit); -FX_BOOL FDE_ParseCSSString(const FX_WCHAR* pszValue, - int32_t iValueLen, - int32_t& iOffset, - int32_t& iLength); -FX_BOOL FDE_ParseCSSColor(const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_ARGB& dwColor); -FX_BOOL FDE_ParseCSSURI(const FX_WCHAR* pszValue, +bool FDE_ParseCSSNumber(const FX_WCHAR* pszValue, + int32_t iValueLen, + FX_FLOAT& fValue, + FDE_CSSPRIMITIVETYPE& eUnit); +bool FDE_ParseCSSString(const FX_WCHAR* pszValue, int32_t iValueLen, int32_t& iOffset, int32_t& iLength); +bool FDE_ParseCSSColor(const FX_WCHAR* pszValue, + int32_t iValueLen, + FX_ARGB& dwColor); +bool FDE_ParseCSSURI(const FX_WCHAR* pszValue, + int32_t iValueLen, + int32_t& iOffset, + int32_t& iLength); #endif // XFA_FDE_CSS_FDE_CSSDATATABLE_H_ diff --git a/xfa/fde/css/fde_cssdeclaration.cpp b/xfa/fde/css/fde_cssdeclaration.cpp index 3ce6ebabd6..2196d6bd91 100644 --- a/xfa/fde/css/fde_cssdeclaration.cpp +++ b/xfa/fde/css/fde_cssdeclaration.cpp @@ -9,7 +9,7 @@ #include "core/fxcrt/fx_ext.h" IFDE_CSSValue* CFDE_CSSDeclaration::GetProperty(FDE_CSSPROPERTY eProperty, - FX_BOOL& bImportant) const { + bool& bImportant) const { for (const FDE_CSSPropertyHolder* pHolder = m_pFirstProperty; pHolder; pHolder = pHolder->pNext) { if (pHolder->eProperty == eProperty) { @@ -25,7 +25,7 @@ FX_POSITION CFDE_CSSDeclaration::GetStartPosition() const { void CFDE_CSSDeclaration::GetNextProperty(FX_POSITION& pos, FDE_CSSPROPERTY& eProperty, IFDE_CSSValue*& pValue, - FX_BOOL& bImportant) const { + bool& bImportant) const { const FDE_CSSPropertyHolder* pHolder = (const FDE_CSSPropertyHolder*)pos; bImportant = pHolder->bImportant; eProperty = (FDE_CSSPROPERTY)pHolder->eProperty; @@ -86,7 +86,7 @@ inline IFDE_CSSPrimitiveValue* CFDE_CSSDeclaration::NewEnumValue( void CFDE_CSSDeclaration::AddPropertyHolder(IFX_MemoryAllocator* pStaticStore, FDE_CSSPROPERTY eProperty, IFDE_CSSValue* pValue, - FX_BOOL bImportant) { + bool bImportant) { FDE_CSSPropertyHolder* pHolder = FXTARGET_NewWith(pStaticStore) FDE_CSSPropertyHolder; pHolder->bImportant = bImportant; @@ -99,17 +99,17 @@ void CFDE_CSSDeclaration::AddPropertyHolder(IFX_MemoryAllocator* pStaticStore, m_pFirstProperty = pHolder; m_pLastProperty = pHolder; } -FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen) { +bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen) { ASSERT(iValueLen > 0); - FX_BOOL bImportant = FALSE; + bool bImportant = false; if (iValueLen >= 10 && pszValue[iValueLen - 10] == '!' && FXSYS_wcsnicmp(L"important", pszValue + iValueLen - 9, 9) == 0) { if ((iValueLen -= 10) == 0) { - return FALSE; + return false; } - bImportant = TRUE; + bImportant = true; } const uint32_t dwType = pArgs->pProperty->dwType; switch (dwType & 0x0F) { @@ -152,10 +152,10 @@ FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, if (pCSSValue) { AddPropertyHolder(pArgs->pStaticStore, pArgs->pProperty->eName, pCSSValue, bImportant); - return TRUE; + return true; } if (FDE_IsOnlyValue(dwType, g_ValueGuessOrder[i])) { - return FALSE; + return false; } } } break; @@ -189,7 +189,7 @@ FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, FDE_CSSPROPERTY_BorderBottomColor, FDE_CSSPROPERTY_BorderBottomStyle, FDE_CSSPROPERTY_BorderBottomWidth); - return TRUE; + return true; } break; case FDE_CSSPROPERTY_BorderLeft: @@ -199,7 +199,7 @@ FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, FDE_CSSPROPERTY_BorderLeftColor, FDE_CSSPROPERTY_BorderLeftStyle, FDE_CSSPROPERTY_BorderLeftWidth); - return TRUE; + return true; } break; case FDE_CSSPROPERTY_BorderTop: @@ -209,7 +209,7 @@ FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, FDE_CSSPROPERTY_BorderTopColor, FDE_CSSPROPERTY_BorderTopStyle, FDE_CSSPROPERTY_BorderTopWidth); - return TRUE; + return true; } break; case FDE_CSSPROPERTY_BorderRight: @@ -219,7 +219,7 @@ FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, FDE_CSSPROPERTY_BorderRightColor, FDE_CSSPROPERTY_BorderRightStyle, FDE_CSSPROPERTY_BorderRightWidth); - return TRUE; + return true; } break; case FDE_CSSPROPERTY_BorderBottom: @@ -229,7 +229,7 @@ FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, FDE_CSSPROPERTY_BorderBottomColor, FDE_CSSPROPERTY_BorderBottomStyle, FDE_CSSPROPERTY_BorderBottomWidth); - return TRUE; + return true; } break; case FDE_CSSPROPERTY_Overflow: @@ -252,16 +252,16 @@ FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, return ParseValueListProperty(pArgs, pszValue, iValueLen, bImportant); } default: - ASSERT(FALSE); + ASSERT(false); break; } - return FALSE; + return false; } -FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszName, - int32_t iNameLen, - const FX_WCHAR* pszValue, - int32_t iValueLen) { +bool CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszName, + int32_t iNameLen, + const FX_WCHAR* pszValue, + int32_t iValueLen) { FDE_CSSCustomProperty* pProperty = FXTARGET_NewWith(pArgs->pStaticStore) FDE_CSSCustomProperty; pProperty->pwsName = CopyToLocal(pArgs, pszName, iNameLen); @@ -272,7 +272,7 @@ FX_BOOL CFDE_CSSDeclaration::AddProperty(const FDE_CSSPROPERTYARGS* pArgs, else m_pFirstCustom = pProperty; m_pLastCustom = pProperty; - return TRUE; + return true; } IFDE_CSSValue* CFDE_CSSDeclaration::ParseNumber( const FDE_CSSPROPERTYARGS* pArgs, @@ -401,11 +401,10 @@ IFDE_CSSValue* CFDE_CSSDeclaration::ParseFunction( return FXTARGET_NewWith(pArgs->pStaticStore) CFDE_CSSPrimitiveValue(pFunction); } -FX_BOOL CFDE_CSSDeclaration::ParseContentProperty( - const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant) { +bool CFDE_CSSDeclaration::ParseContentProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant) { IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); FDE_CSSPRIMITIVETYPE eType; @@ -417,7 +416,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseContentProperty( eType, CopyToLocal(pArgs, pszValue, iValueLen))); break; case FDE_CSSPRIMITIVETYPE_Number: - return FALSE; + return false; case FDE_CSSPRIMITIVETYPE_String: { const FDE_CSSPROPERTYVALUETABLE* pValue = FDE_GetCSSPropertyValueByName(CFX_WideStringC(pszValue, iValueLen)); @@ -428,7 +427,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseContentProperty( if (list.GetSize() == 0) { list.Add(NewEnumValue(pStaticStore, pValue->eName)); } else { - return FALSE; + return false; } } break; case FDE_CSSPROPERTYVALUE_OpenQuote: @@ -438,7 +437,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseContentProperty( list.Add(NewEnumValue(pStaticStore, pValue->eName)); break; default: - return FALSE; + return false; } continue; } @@ -451,25 +450,24 @@ FX_BOOL CFDE_CSSDeclaration::ParseContentProperty( eType, CopyToLocal(pArgs, pszValue, iValueLen))); } break; case FDE_CSSPRIMITIVETYPE_RGB: - return FALSE; + return false; default: break; } } if (list.GetSize() == 0) { - return FALSE; + return false; } AddPropertyHolder(pStaticStore, pArgs->pProperty->eName, FXTARGET_NewWith(pStaticStore) CFDE_CSSValueList(pStaticStore, list), bImportant); - return TRUE; + return true; } -FX_BOOL CFDE_CSSDeclaration::ParseCounterProperty( - const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant) { +bool CFDE_CSSDeclaration::ParseCounterProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant) { IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); CFDE_CSSValueArray list; @@ -486,7 +484,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseCounterProperty( CFDE_CSSValueList(pStaticStore, list)); list.RemoveAll(); } else { - return FALSE; + return false; } } } break; @@ -513,19 +511,19 @@ FX_BOOL CFDE_CSSDeclaration::ParseCounterProperty( CFDE_CSSValueList(pStaticStore, list)); } if (listFull.GetSize() == 0) { - return FALSE; + return false; } AddPropertyHolder(pStaticStore, pArgs->pProperty->eName, FXTARGET_NewWith(pStaticStore) CFDE_CSSValueList(pStaticStore, listFull), bImportant); - return TRUE; + return true; } -FX_BOOL CFDE_CSSDeclaration::ParseValueListProperty( +bool CFDE_CSSDeclaration::ParseValueListProperty( const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, - FX_BOOL bImportant) { + bool bImportant) { IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; FX_WCHAR separator = (pArgs->pProperty->eName == FDE_CSSPROPERTY_FontFamily) ? ',' : ' '; @@ -581,7 +579,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseValueListProperty( } } if (list.GetSize() == 0) { - return FALSE; + return false; } switch (pArgs->pProperty->eName) { case FDE_CSSPROPERTY_BorderColor: @@ -614,50 +612,49 @@ FX_BOOL CFDE_CSSDeclaration::ParseValueListProperty( FXTARGET_NewWith(pStaticStore) CFDE_CSSValueList(pStaticStore, list); AddPropertyHolder(pStaticStore, pArgs->pProperty->eName, pList, bImportant); - return TRUE; + return true; } break; } - return FALSE; + return false; } -FX_BOOL CFDE_CSSDeclaration::Add4ValuesProperty( - IFX_MemoryAllocator* pStaticStore, - const CFDE_CSSValueArray& list, - FX_BOOL bImportant, - FDE_CSSPROPERTY eLeft, - FDE_CSSPROPERTY eTop, - FDE_CSSPROPERTY eRight, - FDE_CSSPROPERTY eBottom) { +bool CFDE_CSSDeclaration::Add4ValuesProperty(IFX_MemoryAllocator* pStaticStore, + const CFDE_CSSValueArray& list, + bool bImportant, + FDE_CSSPROPERTY eLeft, + FDE_CSSPROPERTY eTop, + FDE_CSSPROPERTY eRight, + FDE_CSSPROPERTY eBottom) { switch (list.GetSize()) { case 1: AddPropertyHolder(pStaticStore, eLeft, list[0], bImportant); AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); AddPropertyHolder(pStaticStore, eRight, list[0], bImportant); AddPropertyHolder(pStaticStore, eBottom, list[0], bImportant); - return TRUE; + return true; case 2: AddPropertyHolder(pStaticStore, eLeft, list[1], bImportant); AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); AddPropertyHolder(pStaticStore, eRight, list[1], bImportant); AddPropertyHolder(pStaticStore, eBottom, list[0], bImportant); - return TRUE; + return true; case 3: AddPropertyHolder(pStaticStore, eLeft, list[1], bImportant); AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); AddPropertyHolder(pStaticStore, eRight, list[1], bImportant); AddPropertyHolder(pStaticStore, eBottom, list[2], bImportant); - return TRUE; + return true; case 4: AddPropertyHolder(pStaticStore, eLeft, list[3], bImportant); AddPropertyHolder(pStaticStore, eTop, list[0], bImportant); AddPropertyHolder(pStaticStore, eRight, list[1], bImportant); AddPropertyHolder(pStaticStore, eBottom, list[2], bImportant); - return TRUE; + return true; default: break; } - return FALSE; + return false; } -FX_BOOL CFDE_CSSDeclaration::ParseBorderPropoerty( +bool CFDE_CSSDeclaration::ParseBorderPropoerty( IFX_MemoryAllocator* pStaticStore, const FX_WCHAR* pszValue, int32_t iValueLen, @@ -741,13 +738,13 @@ FX_BOOL CFDE_CSSDeclaration::ParseBorderPropoerty( pStyle = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None); if (!pWidth) pWidth = NewNumberValue(pStaticStore, FDE_CSSPRIMITIVETYPE_Number, 0.0f); - return TRUE; + return true; } void CFDE_CSSDeclaration::AddBorderProperty(IFX_MemoryAllocator* pStaticStore, IFDE_CSSValue* pColor, IFDE_CSSValue* pStyle, IFDE_CSSValue* pWidth, - FX_BOOL bImportant, + bool bImportant, FDE_CSSPROPERTY eColor, FDE_CSSPROPERTY eStyle, FDE_CSSPROPERTY eWidth) { @@ -755,11 +752,11 @@ void CFDE_CSSDeclaration::AddBorderProperty(IFX_MemoryAllocator* pStaticStore, AddPropertyHolder(pStaticStore, eWidth, pWidth, bImportant); AddPropertyHolder(pStaticStore, eColor, pColor, bImportant); } -FX_BOOL CFDE_CSSDeclaration::ParseListStyleProperty( +bool CFDE_CSSDeclaration::ParseListStyleProperty( const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, - FX_BOOL bImportant) { + bool bImportant) { IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); IFDE_CSSPrimitiveValue* pType = nullptr; @@ -829,13 +826,13 @@ FX_BOOL CFDE_CSSDeclaration::ParseListStyleProperty( bImportant); AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ListStyleType, pType, bImportant); - return TRUE; + return true; } -FX_BOOL CFDE_CSSDeclaration::ParseBackgroundProperty( +bool CFDE_CSSDeclaration::ParseBackgroundProperty( const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, - FX_BOOL bImportant) { + bool bImportant) { IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); IFDE_CSSPrimitiveValue* pColor = nullptr; @@ -966,12 +963,12 @@ FX_BOOL CFDE_CSSDeclaration::ParseBackgroundProperty( bImportant); AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_BackgroundAttachment, pAttachment, bImportant); - return TRUE; + return true; } -FX_BOOL CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant) { +bool CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant) { IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, '/'); IFDE_CSSPrimitiveValue* pStyle = nullptr; @@ -1096,13 +1093,13 @@ FX_BOOL CFDE_CSSDeclaration::ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_FontFamily, pList, bImportant); } - return TRUE; + return true; } -FX_BOOL CFDE_CSSDeclaration::ParseColumnRuleProperty( +bool CFDE_CSSDeclaration::ParseColumnRuleProperty( const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, - FX_BOOL bImportant) { + bool bImportant) { IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); IFDE_CSSPrimitiveValue* pColumnRuleWidth = nullptr; @@ -1172,7 +1169,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseColumnRuleProperty( } } if (!pColumnRuleColor && !pColumnRuleStyle && !pColumnRuleWidth) - return FALSE; + return false; if (!pColumnRuleStyle) pColumnRuleStyle = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_None); @@ -1188,13 +1185,12 @@ FX_BOOL CFDE_CSSDeclaration::ParseColumnRuleProperty( pColumnRuleWidth, bImportant); AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnRuleColor, pColumnRuleColor, bImportant); - return TRUE; + return true; } -FX_BOOL CFDE_CSSDeclaration::ParseTextEmphasisProperty( - FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant) { +bool CFDE_CSSDeclaration::ParseTextEmphasisProperty(FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant) { IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); CFDE_CSSValueArray arrEmphasisStyle; @@ -1241,13 +1237,12 @@ FX_BOOL CFDE_CSSDeclaration::ParseTextEmphasisProperty( AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_TextEmphasisColor, pEmphasisColor, bImportant); } - return TRUE; + return true; } -FX_BOOL CFDE_CSSDeclaration::ParseColumnsProperty( - const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant) { +bool CFDE_CSSDeclaration::ParseColumnsProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant) { IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); IFDE_CSSPrimitiveValue* pColumnWidth = nullptr; @@ -1282,7 +1277,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseColumnsProperty( } } if (!pColumnWidth && !pColumnCount) - return FALSE; + return false; if (!pColumnWidth) pColumnWidth = NewEnumValue(pStaticStore, FDE_CSSPROPERTYVALUE_Auto); @@ -1293,13 +1288,13 @@ FX_BOOL CFDE_CSSDeclaration::ParseColumnsProperty( bImportant); AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_ColumnCount, pColumnCount, bImportant); - return TRUE; + return true; } -FX_BOOL CFDE_CSSDeclaration::ParseOverflowProperty( +bool CFDE_CSSDeclaration::ParseOverflowProperty( const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, - FX_BOOL bImportant) { + bool bImportant) { IFX_MemoryAllocator* pStaticStore = pArgs->pStaticStore; CFDE_CSSValueListParser parser(pszValue, iValueLen, ' '); IFDE_CSSPrimitiveValue* pOverflowX = nullptr; @@ -1318,7 +1313,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseOverflowProperty( case FDE_CSSOVERFLOW_NoDisplay: case FDE_CSSOVERFLOW_NoContent: if (pOverflowX && pOverflowY) - return FALSE; + return false; if (!pOverflowX) { pOverflowX = NewEnumValue(pStaticStore, pValue->eName); } else if (!pOverflowY) { @@ -1332,7 +1327,7 @@ FX_BOOL CFDE_CSSDeclaration::ParseOverflowProperty( } } if (!pOverflowX && !pOverflowY) - return FALSE; + return false; if (!pOverflowY) pOverflowY = NewEnumValue(pStaticStore, pOverflowX->GetEnum()); @@ -1341,5 +1336,5 @@ FX_BOOL CFDE_CSSDeclaration::ParseOverflowProperty( bImportant); AddPropertyHolder(pStaticStore, FDE_CSSPROPERTY_OverflowY, pOverflowY, bImportant); - return TRUE; + return true; } diff --git a/xfa/fde/css/fde_cssdeclaration.h b/xfa/fde/css/fde_cssdeclaration.h index 3598429e3a..f03b0c616a 100644 --- a/xfa/fde/css/fde_cssdeclaration.h +++ b/xfa/fde/css/fde_cssdeclaration.h @@ -14,7 +14,7 @@ class FDE_CSSPropertyHolder : public CFX_Target { public: int16_t eProperty; - FX_BOOL bImportant; + bool bImportant; IFDE_CSSValue* pValue; FDE_CSSPropertyHolder* pNext; }; @@ -40,88 +40,87 @@ class CFDE_CSSDeclaration : public CFX_Target { m_pFirstCustom(nullptr), m_pLastCustom(nullptr) {} - IFDE_CSSValue* GetProperty(FDE_CSSPROPERTY eProperty, - FX_BOOL& bImportant) const; + IFDE_CSSValue* GetProperty(FDE_CSSPROPERTY eProperty, bool& bImportant) const; FX_POSITION GetStartPosition() const; void GetNextProperty(FX_POSITION& pos, FDE_CSSPROPERTY& eProperty, IFDE_CSSValue*& pValue, - FX_BOOL& bImportant) const; + bool& bImportant) const; FX_POSITION GetStartCustom() const; void GetNextCustom(FX_POSITION& pos, CFX_WideString& wsName, CFX_WideString& wsValue) const; - FX_BOOL AddProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen); - FX_BOOL AddProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszName, - int32_t iNameLen, - const FX_WCHAR* pszValue, - int32_t iValueLen); + bool AddProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen); + bool AddProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszName, + int32_t iNameLen, + const FX_WCHAR* pszValue, + int32_t iValueLen); protected: - FX_BOOL ParseTextEmphasisProperty(FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant); - FX_BOOL ParseColumnsProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant); - FX_BOOL ParseColumnRuleProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant); - FX_BOOL ParseOverflowProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant); - FX_BOOL ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant); - FX_BOOL ParseBackgroundProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant); - FX_BOOL ParseListStyleProperty(const FDE_CSSPROPERTYARGS* pArgs, + bool ParseTextEmphasisProperty(FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, - FX_BOOL bImportant); - FX_BOOL ParseBorderPropoerty(IFX_MemoryAllocator* pStaticStore, + bool bImportant); + bool ParseColumnsProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant); + bool ParseColumnRuleProperty(const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen, - IFDE_CSSValue*& pColor, - IFDE_CSSValue*& pStyle, - IFDE_CSSValue*& pWidth) const; + bool bImportant); + bool ParseOverflowProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant); + bool ParseFontProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant); + bool ParseBackgroundProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant); + bool ParseListStyleProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant); + bool ParseBorderPropoerty(IFX_MemoryAllocator* pStaticStore, + const FX_WCHAR* pszValue, + int32_t iValueLen, + IFDE_CSSValue*& pColor, + IFDE_CSSValue*& pStyle, + IFDE_CSSValue*& pWidth) const; void AddBorderProperty(IFX_MemoryAllocator* pStaticStore, IFDE_CSSValue* pColor, IFDE_CSSValue* pStyle, IFDE_CSSValue* pWidth, - FX_BOOL bImportant, + bool bImportant, FDE_CSSPROPERTY eColor, FDE_CSSPROPERTY eStyle, FDE_CSSPROPERTY eWidth); - FX_BOOL ParseContentProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant); - FX_BOOL ParseCounterProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant); - FX_BOOL ParseValueListProperty(const FDE_CSSPROPERTYARGS* pArgs, - const FX_WCHAR* pszValue, - int32_t iValueLen, - FX_BOOL bImportant); - FX_BOOL Add4ValuesProperty(IFX_MemoryAllocator* pStaticStore, - const CFDE_CSSValueArray& list, - FX_BOOL bImportant, - FDE_CSSPROPERTY eLeft, - FDE_CSSPROPERTY eTop, - FDE_CSSPROPERTY eRight, - FDE_CSSPROPERTY eBottom); + bool ParseContentProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant); + bool ParseCounterProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant); + bool ParseValueListProperty(const FDE_CSSPROPERTYARGS* pArgs, + const FX_WCHAR* pszValue, + int32_t iValueLen, + bool bImportant); + bool Add4ValuesProperty(IFX_MemoryAllocator* pStaticStore, + const CFDE_CSSValueArray& list, + bool bImportant, + FDE_CSSPROPERTY eLeft, + FDE_CSSPROPERTY eTop, + FDE_CSSPROPERTY eRight, + FDE_CSSPROPERTY eBottom); IFDE_CSSValue* ParseNumber(const FDE_CSSPROPERTYARGS* pArgs, const FX_WCHAR* pszValue, int32_t iValueLen); @@ -146,7 +145,7 @@ class CFDE_CSSDeclaration : public CFX_Target { void AddPropertyHolder(IFX_MemoryAllocator* pStaticStore, FDE_CSSPROPERTY eProperty, IFDE_CSSValue* pValue, - FX_BOOL bImportant); + bool bImportant); IFDE_CSSPrimitiveValue* NewNumberValue(IFX_MemoryAllocator* pStaticStore, FDE_CSSPRIMITIVETYPE eUnit, FX_FLOAT fValue) const; diff --git a/xfa/fde/css/fde_cssstyleselector.cpp b/xfa/fde/css/fde_cssstyleselector.cpp index b68ace8dce..3eef4e4a4a 100644 --- a/xfa/fde/css/fde_cssstyleselector.cpp +++ b/xfa/fde/css/fde_cssstyleselector.cpp @@ -34,10 +34,10 @@ void CFDE_CSSCounterStyle::DoUpdateIndex(IFDE_CSSValueList* pList) { int32_t iCount = pList->CountValues(); FX_FLOAT fDefValue = 1.0; - FX_BOOL bDefIncrement = TRUE; + bool bDefIncrement = true; if (pList == m_pCounterReset) { fDefValue = 0.0; - bDefIncrement = FALSE; + bDefIncrement = false; } for (int32_t i = 0; i < iCount; i++) { IFDE_CSSValueList* pCounter = @@ -56,20 +56,20 @@ void CFDE_CSSCounterStyle::DoUpdateIndex(IFDE_CSSValueList* pList) { FDE_CSSCOUNTERDATA data; data.m_pszIdent = pszIdentifier; if (bDefIncrement) { - data.m_bIncrement = TRUE; + data.m_bIncrement = true; data.m_iIncVal = (int32_t)fValue; } else { data.m_iResetVal = (int32_t)fValue; - data.m_bReset = TRUE; + data.m_bReset = true; } m_arrCounterData.Add(data); } else { FDE_CSSCOUNTERDATA& data = m_arrCounterData.ElementAt(iIndex); if (bDefIncrement) { - data.m_bIncrement = TRUE; + data.m_bIncrement = true; data.m_iIncVal += (int32_t)fValue; } else { - data.m_bReset = TRUE; + data.m_bReset = true; data.m_iResetVal = (int32_t)fValue; } } @@ -77,7 +77,7 @@ void CFDE_CSSCounterStyle::DoUpdateIndex(IFDE_CSSValueList* pList) { } CFDE_CSSCounterStyle::CFDE_CSSCounterStyle() - : m_pCounterInc(nullptr), m_pCounterReset(nullptr), m_bIndexDirty(FALSE) {} + : m_pCounterInc(nullptr), m_pCounterReset(nullptr), m_bIndexDirty(false) {} CFDE_CSSCounterStyle::~CFDE_CSSCounterStyle() {} @@ -88,7 +88,7 @@ void CFDE_CSSCounterStyle::UpdateIndex() { m_arrCounterData.RemoveAll(); DoUpdateIndex(m_pCounterInc); DoUpdateIndex(m_pCounterReset); - m_bIndexDirty = FALSE; + m_bIndexDirty = false; } FDE_CSSRuleData::FDE_CSSRuleData(CFDE_CSSSelector* pSel, @@ -148,17 +148,17 @@ IFDE_CSSComputedStyle* CFDE_CSSStyleSelector::CreateComputedStyle( return pStyle; } -FX_BOOL CFDE_CSSStyleSelector::SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType, - IFDE_CSSStyleSheet* pSheet) { +bool CFDE_CSSStyleSelector::SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType, + IFDE_CSSStyleSheet* pSheet) { ASSERT(eType < FDE_CSSSTYLESHEETGROUP_MAX); CFDE_CSSStyleSheetArray& dest = m_SheetGroups[eType]; dest.RemoveAt(0, dest.GetSize()); if (pSheet) dest.Add(pSheet); - return TRUE; + return true; } -FX_BOOL CFDE_CSSStyleSelector::SetStyleSheets( +bool CFDE_CSSStyleSelector::SetStyleSheets( FDE_CSSSTYLESHEETGROUP eType, const CFDE_CSSStyleSheetArray* pArray) { ASSERT(eType < FDE_CSSSTYLESHEETGROUP_MAX); @@ -167,7 +167,7 @@ FX_BOOL CFDE_CSSStyleSelector::SetStyleSheets( dest.Copy(*pArray); else dest.RemoveAt(0, dest.GetSize()); - return TRUE; + return true; } void CFDE_CSSStyleSelector::SetStylePriority( @@ -247,9 +247,9 @@ void CFDE_CSSStyleSelector::MatchRules(FDE_CSSTagCache* pCache, } } -FX_BOOL CFDE_CSSStyleSelector::MatchSelector(FDE_CSSTagCache* pCache, - CFDE_CSSSelector* pSel, - FDE_CSSPERSUDO ePersudoType) { +bool CFDE_CSSStyleSelector::MatchSelector(FDE_CSSTagCache* pCache, + CFDE_CSSSelector* pSel, + FDE_CSSPERSUDO ePersudoType) { uint32_t dwHash; while (pSel && pCache) { switch (pSel->GetType()) { @@ -260,36 +260,36 @@ FX_BOOL CFDE_CSSStyleSelector::MatchSelector(FDE_CSSTagCache* pCache, continue; } if (MatchSelector(pCache, pSel->GetNextSelector(), ePersudoType)) { - return TRUE; + return true; } } - return FALSE; + return false; case FDE_CSSSELECTORTYPE_ID: dwHash = pCache->HashID(); if (dwHash != pSel->GetNameHash()) { - return FALSE; + return false; } break; case FDE_CSSSELECTORTYPE_Class: dwHash = pCache->HashClass(); if (dwHash != pSel->GetNameHash()) { - return FALSE; + return false; } break; case FDE_CSSSELECTORTYPE_Element: dwHash = pSel->GetNameHash(); if (dwHash != FDE_CSSUNIVERSALHASH && dwHash != pCache->HashTag()) { - return FALSE; + return false; } break; case FDE_CSSSELECTORTYPE_Persudo: dwHash = FDE_GetCSSPersudoByEnum(ePersudoType)->dwHash; if (dwHash != pSel->GetNameHash()) { - return FALSE; + return false; } break; default: - ASSERT(FALSE); + ASSERT(false); break; } pSel = pSel->GetNextSelector(); @@ -344,9 +344,9 @@ void CFDE_CSSStyleSelector::ComputeStyle( FXSYS_memcpy(ppInline, ppDeclArray, iDeclCount * sizeof(CFDE_CSSDeclaration*)); ppInline[iDeclCount++] = pDecl; - ApplyDeclarations(TRUE, const_cast<const CFDE_CSSDeclaration**>(ppInline), + ApplyDeclarations(true, const_cast<const CFDE_CSSDeclaration**>(ppInline), iDeclCount, pDestStyle); - ApplyDeclarations(FALSE, + ApplyDeclarations(false, const_cast<const CFDE_CSSDeclaration**>(ppInline), iDeclCount, pDestStyle); return; @@ -356,20 +356,20 @@ void CFDE_CSSStyleSelector::ComputeStyle( if (iDeclCount > 0) { ASSERT(ppDeclArray); - ApplyDeclarations(TRUE, ppDeclArray, iDeclCount, pDestStyle); - ApplyDeclarations(FALSE, ppDeclArray, iDeclCount, pDestStyle); + ApplyDeclarations(true, ppDeclArray, iDeclCount, pDestStyle); + ApplyDeclarations(false, ppDeclArray, iDeclCount, pDestStyle); } } void CFDE_CSSStyleSelector::ApplyDeclarations( - FX_BOOL bPriority, + bool bPriority, const CFDE_CSSDeclaration** ppDeclArray, int32_t iDeclCount, IFDE_CSSComputedStyle* pDestStyle) { CFDE_CSSComputedStyle* pComputedStyle = static_cast<CFDE_CSSComputedStyle*>(pDestStyle); IFDE_CSSValue* pVal; - FX_BOOL bImportant; + bool bImportant; int32_t i; if (bPriority) { IFDE_CSSValue* pLastest = nullptr; @@ -434,7 +434,7 @@ void CFDE_CSSStyleSelector::AppendInlineStyle(CFDE_CSSDeclaration* pDecl, int32_t iLen) { ASSERT(pDecl && psz && iLen > 0); std::unique_ptr<CFDE_CSSSyntaxParser> pSyntax(new CFDE_CSSSyntaxParser); - if (!pSyntax->Init(psz, iLen, 32, TRUE)) + if (!pSyntax->Init(psz, iLen, 32, true)) return; int32_t iLen2 = 0; @@ -770,17 +770,17 @@ void CFDE_CSSStyleSelector::ApplyProperty( switch (pPrimitive->GetEnum()) { case FDE_CSSPROPERTYVALUE_Transparent: FDE_CSSINHERITS.m_dwTextEmphasisColor = 0; - FDE_CSSINHERITS.m_bTextEmphasisColorCurrent = FALSE; + FDE_CSSINHERITS.m_bTextEmphasisColorCurrent = false; break; case FDE_CSSPROPERTYVALUE_Currentcolor: - FDE_CSSINHERITS.m_bTextEmphasisColorCurrent = TRUE; + FDE_CSSINHERITS.m_bTextEmphasisColorCurrent = true; break; default: break; } } else if (eType == FDE_CSSPRIMITIVETYPE_RGB) { FDE_CSSINHERITS.m_dwTextEmphasisColor = pPrimitive->GetRGBColor(); - FDE_CSSINHERITS.m_bTextEmphasisColorCurrent = FALSE; + FDE_CSSINHERITS.m_bTextEmphasisColorCurrent = false; } break; case FDE_CSSPROPERTY_PageBreakBefore: @@ -831,7 +831,7 @@ void CFDE_CSSStyleSelector::ApplyProperty( case FDE_CSSPROPERTY_ColumnRuleColor: if (eType == FDE_CSSPRIMITIVETYPE_RGB) { FDE_CSSNONINHERITS.m_dwColumnRuleColor = pPrimitive->GetRGBColor(); - FDE_CSSNONINHERITS.m_bColumnRuleColorSame = FALSE; + FDE_CSSNONINHERITS.m_bColumnRuleColorSame = false; } break; case FDE_CSSPROPERTY_ColumnRuleStyle: @@ -960,12 +960,12 @@ void CFDE_CSSStyleSelector::ApplyProperty( switch (pVal->GetEnum()) { case FDE_CSSPROPERTYVALUE_None: { FDE_CSSNONINHERITS.m_eTextCombine = FDE_CSSTEXTCOMBINE_None; - FDE_CSSNONINHERITS.m_bHasTextCombineNumber = FALSE; + FDE_CSSNONINHERITS.m_bHasTextCombineNumber = false; } break; case FDE_CSSPROPERTYVALUE_Horizontal: { FDE_CSSNONINHERITS.m_eTextCombine = FDE_CSSTEXTCOMBINE_Horizontal; - FDE_CSSNONINHERITS.m_bHasTextCombineNumber = FALSE; + FDE_CSSNONINHERITS.m_bHasTextCombineNumber = false; } break; default: break; @@ -1011,7 +1011,7 @@ void CFDE_CSSStyleSelector::ApplyProperty( } } } else { - ASSERT(FALSE); + ASSERT(false); } } @@ -1107,45 +1107,43 @@ FDE_CSSRUBYALIGN CFDE_CSSStyleSelector::ToRubyAlign( } } -FX_BOOL CFDE_CSSStyleSelector::ToTextEmphasisMark( - FDE_CSSPROPERTYVALUE eValue, - FDE_CSSTEXTEMPHASISMARK& eMark) { +bool CFDE_CSSStyleSelector::ToTextEmphasisMark(FDE_CSSPROPERTYVALUE eValue, + FDE_CSSTEXTEMPHASISMARK& eMark) { switch (eValue) { case FDE_CSSPROPERTYVALUE_None: eMark = FDE_CSSTEXTEMPHASISMARK_None; - return TRUE; + return true; case FDE_CSSPROPERTYVALUE_Dot: eMark = FDE_CSSTEXTEMPHASISMARK_Dot; - return TRUE; + return true; case FDE_CSSPROPERTYVALUE_Circle: eMark = FDE_CSSTEXTEMPHASISMARK_Circle; - return TRUE; + return true; case FDE_CSSPROPERTYVALUE_DoubleCircle: eMark = FDE_CSSTEXTEMPHASISMARK_DoubleCircle; - return TRUE; + return true; case FDE_CSSPROPERTYVALUE_Triangle: eMark = FDE_CSSTEXTEMPHASISMARK_Triangle; - return TRUE; + return true; case FDE_CSSPROPERTYVALUE_Sesame: eMark = FDE_CSSTEXTEMPHASISMARK_Sesame; - return TRUE; + return true; default: - return FALSE; + return false; } } -FX_BOOL CFDE_CSSStyleSelector::ToTextEmphasisFill( - FDE_CSSPROPERTYVALUE eValue, - FDE_CSSTEXTEMPHASISFILL& eFill) { +bool CFDE_CSSStyleSelector::ToTextEmphasisFill(FDE_CSSPROPERTYVALUE eValue, + FDE_CSSTEXTEMPHASISFILL& eFill) { switch (eValue) { case FDE_CSSPROPERTYVALUE_Filled: eFill = FDE_CSSTEXTEMPHASISFILL_Filled; - return TRUE; + return true; case FDE_CSSPROPERTYVALUE_Open: eFill = FDE_CSSTEXTEMPHASISFILL_Open; - return TRUE; + return true; default: - return FALSE; + return false; } } @@ -1482,7 +1480,7 @@ FDE_CSSBORDERSTYLE CFDE_CSSStyleSelector::ToBorderStyle( } } -FX_BOOL CFDE_CSSStyleSelector::SetLengthWithPercent( +bool CFDE_CSSStyleSelector::SetLengthWithPercent( FDE_CSSLENGTH& width, FDE_CSSPRIMITIVETYPE eType, IFDE_CSSPrimitiveValue* pPrimitive, @@ -1499,24 +1497,24 @@ FX_BOOL CFDE_CSSStyleSelector::SetLengthWithPercent( switch (pPrimitive->GetEnum()) { case FDE_CSSPROPERTYVALUE_Auto: width.Set(FDE_CSSLENGTHUNIT_Auto); - return TRUE; + return true; case FDE_CSSPROPERTYVALUE_None: width.Set(FDE_CSSLENGTHUNIT_None); - return TRUE; + return true; case FDE_CSSPROPERTYVALUE_Thin: width.Set(FDE_CSSLENGTHUNIT_Point, 2); - return TRUE; + return true; case FDE_CSSPROPERTYVALUE_Medium: width.Set(FDE_CSSLENGTHUNIT_Point, 3); - return TRUE; + return true; case FDE_CSSPROPERTYVALUE_Thick: width.Set(FDE_CSSLENGTHUNIT_Point, 4); - return TRUE; + return true; default: - return FALSE; + return false; } } - return FALSE; + return false; } FX_FLOAT CFDE_CSSStyleSelector::ToFontSize(FDE_CSSPROPERTYVALUE eValue, @@ -1749,15 +1747,15 @@ IFDE_CSSParagraphStyle* CFDE_CSSComputedStyle::GetParagraphStyles() { return static_cast<IFDE_CSSParagraphStyle*>(this); } -FX_BOOL CFDE_CSSComputedStyle::GetCustomStyle(const CFX_WideStringC& wsName, - CFX_WideString& wsValue) const { +bool CFDE_CSSComputedStyle::GetCustomStyle(const CFX_WideStringC& wsName, + CFX_WideString& wsValue) const { for (int32_t i = m_CustomProperties.GetSize() - 2; i > -1; i -= 2) { if (wsName == m_CustomProperties[i]) { wsValue = m_CustomProperties[i + 1]; - return TRUE; + return true; } } - return FALSE; + return false; } int32_t CFDE_CSSComputedStyle::CountFontFamilies() const { @@ -1829,12 +1827,12 @@ const FDE_CSSRECT* CFDE_CSSComputedStyle::GetPaddingWidth() const { void CFDE_CSSComputedStyle::SetMarginWidth(const FDE_CSSRECT& rect) { m_NonInheritedData.m_MarginWidth = rect; - m_NonInheritedData.m_bHasMargin = TRUE; + m_NonInheritedData.m_bHasMargin = true; } void CFDE_CSSComputedStyle::SetPaddingWidth(const FDE_CSSRECT& rect) { m_NonInheritedData.m_PaddingWidth = rect; - m_NonInheritedData.m_bHasPadding = TRUE; + m_NonInheritedData.m_bHasPadding = true; } FDE_CSSDISPLAY CFDE_CSSComputedStyle::GetDisplay() const { @@ -1915,7 +1913,7 @@ void CFDE_CSSInheritedData::Reset() { m_wFontWeight = 400; m_dwFontColor = 0xFF000000; m_iWidows = 2; - m_bTextEmphasisColorCurrent = TRUE; + m_bTextEmphasisColorCurrent = true; m_iOrphans = 2; } @@ -1934,7 +1932,7 @@ void CFDE_CSSNonInheritedData::Reset() { m_fVerticalAlign = 0.0f; m_ColumnCount.Set(FDE_CSSLENGTHUNIT_Auto); m_ColumnGap.Set(FDE_CSSLENGTHUNIT_Normal); - m_bColumnRuleColorSame = TRUE; + m_bColumnRuleColorSame = true; m_ColumnWidth.Set(FDE_CSSLENGTHUNIT_Auto); m_ColumnRuleWidth.Set(FDE_CSSLENGTHUNIT_Auto); m_eTextCombine = FDE_CSSTEXTCOMBINE_None; diff --git a/xfa/fde/css/fde_cssstyleselector.h b/xfa/fde/css/fde_cssstyleselector.h index ba2037677e..d72c9bf0cd 100644 --- a/xfa/fde/css/fde_cssstyleselector.h +++ b/xfa/fde/css/fde_cssstyleselector.h @@ -75,7 +75,7 @@ class CFDE_CSSRuleCollection : public CFX_Target { uint32_t dwKey, CFDE_CSSSelector* pSel, CFDE_CSSDeclaration* pDecl); - FX_BOOL AddRuleTo(FDE_CSSRuleData*& pList, FDE_CSSRuleData* pData); + bool AddRuleTo(FDE_CSSRuleData*& pList, FDE_CSSRuleData* pData); FDE_CSSRuleData* NewRuleData(CFDE_CSSSelector* pSel, CFDE_CSSDeclaration* pDecl); CFX_MapPtrToPtr m_IDRules; @@ -93,10 +93,9 @@ class CFDE_CSSStyleSelector : public CFX_Target { void SetDefFontSize(FX_FLOAT fFontSize); - FX_BOOL SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType, - IFDE_CSSStyleSheet* pSheet); - FX_BOOL SetStyleSheets(FDE_CSSSTYLESHEETGROUP eType, - const CFDE_CSSStyleSheetArray* pArray); + bool SetStyleSheet(FDE_CSSSTYLESHEETGROUP eType, IFDE_CSSStyleSheet* pSheet); + bool SetStyleSheets(FDE_CSSSTYLESHEETGROUP eType, + const CFDE_CSSStyleSheetArray* pArray); void SetStylePriority(FDE_CSSSTYLESHEETGROUP eType, FDE_CSSSTYLESHEETPRIORITY ePriority); void UpdateStyleIndex(uint32_t dwMediaList); @@ -116,13 +115,13 @@ class CFDE_CSSStyleSelector : public CFX_Target { void MatchRules(FDE_CSSTagCache* pCache, FDE_CSSRuleData* pList, FDE_CSSPERSUDO ePersudoType); - FX_BOOL MatchSelector(FDE_CSSTagCache* pCache, - CFDE_CSSSelector* pSel, - FDE_CSSPERSUDO ePersudoType); + bool MatchSelector(FDE_CSSTagCache* pCache, + CFDE_CSSSelector* pSel, + FDE_CSSPERSUDO ePersudoType); void AppendInlineStyle(CFDE_CSSDeclaration* pDecl, const FX_WCHAR* psz, int32_t iLen); - void ApplyDeclarations(FX_BOOL bPriority, + void ApplyDeclarations(bool bPriority, const CFDE_CSSDeclaration** ppDeclArray, int32_t iDeclCount, IFDE_CSSComputedStyle* pDestStyle); @@ -133,10 +132,10 @@ class CFDE_CSSStyleSelector : public CFX_Target { FX_FLOAT ApplyNumber(FDE_CSSPRIMITIVETYPE eUnit, FX_FLOAT fValue, FX_FLOAT fPercentBase); - FX_BOOL SetLengthWithPercent(FDE_CSSLENGTH& width, - FDE_CSSPRIMITIVETYPE eType, - IFDE_CSSPrimitiveValue* pPrimitive, - FX_FLOAT fFontSize); + bool SetLengthWithPercent(FDE_CSSLENGTH& width, + FDE_CSSPRIMITIVETYPE eType, + IFDE_CSSPrimitiveValue* pPrimitive, + FX_FLOAT fFontSize); FX_FLOAT ToFontSize(FDE_CSSPROPERTYVALUE eValue, FX_FLOAT fCurFontSize); FDE_CSSDISPLAY ToDisplay(FDE_CSSPROPERTYVALUE eValue); FDE_CSSTEXTALIGN ToTextAlign(FDE_CSSPROPERTYVALUE eValue); @@ -159,10 +158,10 @@ class CFDE_CSSStyleSelector : public CFX_Target { FDE_CSSOVERFLOW ToOverflow(FDE_CSSPROPERTYVALUE eValue); FDE_CSSLINEBREAK ToLineBreak(FDE_CSSPROPERTYVALUE eValue); FDE_CSSTEXTCOMBINE ToTextCombine(FDE_CSSPROPERTYVALUE eValue); - FX_BOOL ToTextEmphasisMark(FDE_CSSPROPERTYVALUE eValue, - FDE_CSSTEXTEMPHASISMARK& eMark); - FX_BOOL ToTextEmphasisFill(FDE_CSSPROPERTYVALUE eValue, - FDE_CSSTEXTEMPHASISFILL& eFill); + bool ToTextEmphasisMark(FDE_CSSPROPERTYVALUE eValue, + FDE_CSSTEXTEMPHASISMARK& eMark); + bool ToTextEmphasisFill(FDE_CSSPROPERTYVALUE eValue, + FDE_CSSTEXTEMPHASISFILL& eFill); FDE_CSSCURSOR ToCursor(FDE_CSSPROPERTYVALUE eValue); FDE_CSSPOSITION ToPosition(FDE_CSSPROPERTYVALUE eValue); FDE_CSSCAPTIONSIDE ToCaptionSide(FDE_CSSPROPERTYVALUE eValue); @@ -188,18 +187,18 @@ class CFDE_CSSStyleSelector : public CFX_Target { struct FDE_CSSCOUNTERDATA { public: FDE_CSSCOUNTERDATA() { FXSYS_memset(this, 0, sizeof(FDE_CSSCOUNTERDATA)); } - FX_BOOL GetCounterIncrement(int32_t& iValue) { + bool GetCounterIncrement(int32_t& iValue) { iValue = m_iIncVal; return m_bIncrement; } - FX_BOOL GetCounterReset(int32_t& iValue) { + bool GetCounterReset(int32_t& iValue) { iValue = m_iResetVal; return m_bReset; } const FX_WCHAR* m_pszIdent; - FX_BOOL m_bIncrement; - FX_BOOL m_bReset; + bool m_bIncrement; + bool m_bReset; int32_t m_iIncVal; int32_t m_iResetVal; }; @@ -211,21 +210,21 @@ class CFDE_CSSCounterStyle { void SetCounterIncrementList(IFDE_CSSValueList* pList) { m_pCounterInc = pList; - m_bIndexDirty = TRUE; + m_bIndexDirty = true; } void SetCounterResetList(IFDE_CSSValueList* pList) { m_pCounterReset = pList; - m_bIndexDirty = TRUE; + m_bIndexDirty = true; } int32_t CountCounters() { UpdateIndex(); return m_arrCounterData.GetSize(); } - FX_BOOL GetCounterIncrement(int32_t index, int32_t& iValue) { + bool GetCounterIncrement(int32_t index, int32_t& iValue) { UpdateIndex(); return m_arrCounterData.ElementAt(index).GetCounterIncrement(iValue); } - FX_BOOL GetCounterReset(int32_t index, int32_t& iValue) { + bool GetCounterReset(int32_t index, int32_t& iValue) { UpdateIndex(); return m_arrCounterData.ElementAt(index).GetCounterReset(iValue); } @@ -242,7 +241,7 @@ class CFDE_CSSCounterStyle { IFDE_CSSValueList* m_pCounterInc; IFDE_CSSValueList* m_pCounterReset; CFX_ArrayTemplate<FDE_CSSCOUNTERDATA> m_arrCounterData; - FX_BOOL m_bIndexDirty; + bool m_bIndexDirty; }; class CFDE_CSSInheritedData { @@ -367,8 +366,8 @@ class CFDE_CSSComputedStyle : public IFDE_CSSComputedStyle, IFDE_CSSBoundaryStyle* GetBoundaryStyles() override; IFDE_CSSPositionStyle* GetPositionStyles() override; IFDE_CSSParagraphStyle* GetParagraphStyles() override; - FX_BOOL GetCustomStyle(const CFX_WideStringC& wsName, - CFX_WideString& wsValue) const override; + bool GetCustomStyle(const CFX_WideStringC& wsName, + CFX_WideString& wsValue) const override; // IFDE_CSSFontStyle: int32_t CountFontFamilies() const override; diff --git a/xfa/fde/css/fde_cssstylesheet.cpp b/xfa/fde/css/fde_cssstylesheet.cpp index bc94cc2f70..e376aca399 100644 --- a/xfa/fde/css/fde_cssstylesheet.cpp +++ b/xfa/fde/css/fde_cssstylesheet.cpp @@ -100,11 +100,11 @@ void CFDE_CSSStyleSheet::Reset() { static_cast<CFDE_CSSFontFaceRule*>(pRule)->~CFDE_CSSFontFaceRule(); break; default: - ASSERT(FALSE); + ASSERT(false); break; } } - m_RuleArray.RemoveAll(FALSE); + m_RuleArray.RemoveAll(false); m_Selectors.RemoveAll(); m_StringCache.clear(); m_pAllocator.reset(); @@ -122,7 +122,7 @@ uint32_t CFDE_CSSStyleSheet::Release() { return dwRefCount; } -FX_BOOL CFDE_CSSStyleSheet::GetUrl(CFX_WideString& szUrl) { +bool CFDE_CSSStyleSheet::GetUrl(CFX_WideString& szUrl) { szUrl = m_szUrl; return szUrl.GetLength() > 0; } @@ -143,33 +143,32 @@ IFDE_CSSRule* CFDE_CSSStyleSheet::GetRule(int32_t index) { return m_RuleArray.GetAt(index); } -FX_BOOL CFDE_CSSStyleSheet::LoadFromStream(const CFX_WideString& szUrl, - IFX_Stream* pStream, - uint16_t wCodePage) { +bool CFDE_CSSStyleSheet::LoadFromStream(const CFX_WideString& szUrl, + IFX_Stream* pStream, + uint16_t wCodePage) { std::unique_ptr<CFDE_CSSSyntaxParser> pSyntax(new CFDE_CSSSyntaxParser); if (pStream->GetCodePage() != wCodePage) pStream->SetCodePage(wCodePage); - FX_BOOL bRet = pSyntax->Init(pStream, 4096) && LoadFromSyntax(pSyntax.get()); + bool bRet = pSyntax->Init(pStream, 4096) && LoadFromSyntax(pSyntax.get()); m_wCodePage = wCodePage; m_szUrl = szUrl; return bRet; } -FX_BOOL CFDE_CSSStyleSheet::LoadFromBuffer(const CFX_WideString& szUrl, - const FX_WCHAR* pBuffer, - int32_t iBufSize, - uint16_t wCodePage) { +bool CFDE_CSSStyleSheet::LoadFromBuffer(const CFX_WideString& szUrl, + const FX_WCHAR* pBuffer, + int32_t iBufSize, + uint16_t wCodePage) { ASSERT(pBuffer && iBufSize > 0); std::unique_ptr<CFDE_CSSSyntaxParser> pSyntax(new CFDE_CSSSyntaxParser); - FX_BOOL bRet = - pSyntax->Init(pBuffer, iBufSize) && LoadFromSyntax(pSyntax.get()); + bool bRet = pSyntax->Init(pBuffer, iBufSize) && LoadFromSyntax(pSyntax.get()); m_wCodePage = wCodePage; m_szUrl = szUrl; return bRet; } -FX_BOOL CFDE_CSSStyleSheet::LoadFromSyntax(CFDE_CSSSyntaxParser* pSyntax) { +bool CFDE_CSSStyleSheet::LoadFromSyntax(CFDE_CSSSyntaxParser* pSyntax) { Reset(); m_pAllocator = IFX_MemoryAllocator::Create(FX_ALLOCTYPE_Static, 1024, 0); FDE_CSSSYNTAXSTATUS eStatus; @@ -415,7 +414,7 @@ CFDE_CSSMediaRule::~CFDE_CSSMediaRule() { ((CFDE_CSSStyleRule*)pRule)->~CFDE_CSSStyleRule(); break; default: - ASSERT(FALSE); + ASSERT(false); break; } } @@ -433,7 +432,7 @@ IFDE_CSSRule* CFDE_CSSMediaRule::GetRule(int32_t index) { return m_RuleArray.GetAt(index); } -FX_BOOL FDE_IsCSSChar(FX_WCHAR wch) { +bool FDE_IsCSSChar(FX_WCHAR wch) { return (wch >= 'a' && wch <= 'z') || (wch >= 'A' && wch <= 'Z'); } diff --git a/xfa/fde/css/fde_cssstylesheet.h b/xfa/fde/css/fde_cssstylesheet.h index cd587ddcae..0fe63477d3 100644 --- a/xfa/fde/css/fde_cssstylesheet.h +++ b/xfa/fde/css/fde_cssstylesheet.h @@ -104,23 +104,23 @@ class CFDE_CSSStyleSheet : public IFDE_CSSStyleSheet, public CFX_Target { uint32_t Release() override; // IFDE_CSSStyleSheet: - FX_BOOL GetUrl(CFX_WideString& szUrl) override; + bool GetUrl(CFX_WideString& szUrl) override; uint32_t GetMediaList() const override; uint16_t GetCodePage() const override; int32_t CountRules() const override; IFDE_CSSRule* GetRule(int32_t index) override; - FX_BOOL LoadFromStream(const CFX_WideString& szUrl, - IFX_Stream* pStream, - uint16_t wCodePage); - FX_BOOL LoadFromBuffer(const CFX_WideString& szUrl, - const FX_WCHAR* pBuffer, - int32_t iBufSize, - uint16_t wCodePage); + bool LoadFromStream(const CFX_WideString& szUrl, + IFX_Stream* pStream, + uint16_t wCodePage); + bool LoadFromBuffer(const CFX_WideString& szUrl, + const FX_WCHAR* pBuffer, + int32_t iBufSize, + uint16_t wCodePage); protected: void Reset(); - FX_BOOL LoadFromSyntax(CFDE_CSSSyntaxParser* pSyntax); + bool LoadFromSyntax(CFDE_CSSSyntaxParser* pSyntax); FDE_CSSSYNTAXSTATUS LoadStyleRule( CFDE_CSSSyntaxParser* pSyntax, CFX_MassArrayTemplate<IFDE_CSSRule*>& ruleArray); diff --git a/xfa/fde/css/fde_csssyntax.cpp b/xfa/fde/css/fde_csssyntax.cpp index c2b0265a6e..436a94b67b 100644 --- a/xfa/fde/css/fde_csssyntax.cpp +++ b/xfa/fde/css/fde_csssyntax.cpp @@ -33,33 +33,33 @@ CFDE_CSSSyntaxParser::~CFDE_CSSSyntaxParser() { m_TextPlane.Reset(); } -FX_BOOL CFDE_CSSSyntaxParser::Init(IFX_Stream* pStream, - int32_t iCSSPlaneSize, - int32_t iTextDataSize, - FX_BOOL bOnlyDeclaration) { +bool CFDE_CSSSyntaxParser::Init(IFX_Stream* pStream, + int32_t iCSSPlaneSize, + int32_t iTextDataSize, + bool bOnlyDeclaration) { ASSERT(pStream && iCSSPlaneSize > 0 && iTextDataSize > 0); Reset(bOnlyDeclaration); if (!m_TextData.EstimateSize(iTextDataSize)) { - return FALSE; + return false; } uint8_t bom[4]; m_pStream = pStream; m_iStreamPos = m_pStream->GetBOM(bom); m_iPlaneSize = iCSSPlaneSize; - return TRUE; + return true; } -FX_BOOL CFDE_CSSSyntaxParser::Init(const FX_WCHAR* pBuffer, - int32_t iBufferSize, - int32_t iTextDatSize, - FX_BOOL bOnlyDeclaration) { +bool CFDE_CSSSyntaxParser::Init(const FX_WCHAR* pBuffer, + int32_t iBufferSize, + int32_t iTextDatSize, + bool bOnlyDeclaration) { ASSERT(pBuffer && iBufferSize > 0 && iTextDatSize > 0); Reset(bOnlyDeclaration); if (!m_TextData.EstimateSize(iTextDatSize)) { - return FALSE; + return false; } return m_TextPlane.AttachBuffer(pBuffer, iBufferSize); } -void CFDE_CSSSyntaxParser::Reset(FX_BOOL bOnlyDeclaration) { +void CFDE_CSSSyntaxParser::Reset(bool bOnlyDeclaration) { m_TextPlane.Reset(); m_TextData.Reset(); m_pStream = nullptr; @@ -81,7 +81,7 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() { } return m_eStatus = FDE_CSSSYNTAXSTATUS_EOS; } - FX_BOOL bEOS; + bool bEOS; int32_t iLen = m_TextPlane.LoadFromStream(m_pStream, m_iStreamPos, m_iPlaneSize, bEOS); m_iStreamPos = m_pStream->GetPosition(); @@ -251,7 +251,7 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() { return FDE_CSSSYNTAXSTATUS_MediaType; } } else { - FX_BOOL bEnabled = IsImportEnabled(); + bool bEnabled = IsImportEnabled(); m_TextPlane.MoveNext(); m_ModeStack.Pop(); SwitchMode(FDE_CSSSYNTAXMODE_RuleSet); @@ -354,29 +354,29 @@ FDE_CSSSYNTAXSTATUS CFDE_CSSSyntaxParser::DoSyntaxParse() { m_TextPlane.MoveNext(); break; default: - ASSERT(FALSE); + ASSERT(false); break; } } } return m_eStatus; } -FX_BOOL CFDE_CSSSyntaxParser::IsImportEnabled() const { +bool CFDE_CSSSyntaxParser::IsImportEnabled() const { if ((m_dwCheck & FDE_CSSSYNTAXCHECK_AllowImport) == 0) { - return FALSE; + return false; } if (m_ModeStack.GetSize() > 1) { - return FALSE; + return false; } - return TRUE; + return true; } -FX_BOOL CFDE_CSSSyntaxParser::AppendChar(FX_WCHAR wch) { +bool CFDE_CSSSyntaxParser::AppendChar(FX_WCHAR wch) { m_TextPlane.MoveNext(); if (m_TextData.GetLength() > 0 || wch > ' ') { m_TextData.AppendChar(wch); - return TRUE; + return true; } - return FALSE; + return false; } int32_t CFDE_CSSSyntaxParser::SaveTextData() { m_iTextDatLen = m_TextData.TrimEnd(); @@ -393,21 +393,21 @@ int32_t CFDE_CSSSyntaxParser::SwitchToComment() { SwitchMode(FDE_CSSSYNTAXMODE_Comment); return iLength; } -FX_BOOL CFDE_CSSSyntaxParser::RestoreMode() { +bool CFDE_CSSSyntaxParser::RestoreMode() { FDE_CSSSYNTAXMODE* pMode = m_ModeStack.GetTopElement(); if (!pMode) - return FALSE; + return false; SwitchMode(*pMode); m_ModeStack.Pop(); - return TRUE; + return true; } const FX_WCHAR* CFDE_CSSSyntaxParser::GetCurrentString(int32_t& iLength) const { iLength = m_iTextDatLen; return m_TextData.GetBuffer(); } CFDE_CSSTextBuf::CFDE_CSSTextBuf() - : m_bExtBuf(FALSE), + : m_bExtBuf(false), m_pBuffer(nullptr), m_iBufLen(0), m_iDatLen(0), @@ -422,26 +422,25 @@ void CFDE_CSSTextBuf::Reset() { } m_iDatPos = m_iDatLen = m_iBufLen; } -FX_BOOL CFDE_CSSTextBuf::AttachBuffer(const FX_WCHAR* pBuffer, - int32_t iBufLen) { +bool CFDE_CSSTextBuf::AttachBuffer(const FX_WCHAR* pBuffer, int32_t iBufLen) { Reset(); m_pBuffer = const_cast<FX_WCHAR*>(pBuffer); m_iDatLen = m_iBufLen = iBufLen; - return m_bExtBuf = TRUE; + return m_bExtBuf = true; } -FX_BOOL CFDE_CSSTextBuf::EstimateSize(int32_t iAllocSize) { +bool CFDE_CSSTextBuf::EstimateSize(int32_t iAllocSize) { ASSERT(iAllocSize > 0); Clear(); - m_bExtBuf = FALSE; + m_bExtBuf = false; return ExpandBuf(iAllocSize); } int32_t CFDE_CSSTextBuf::LoadFromStream(IFX_Stream* pTxtStream, int32_t iStreamOffset, int32_t iMaxChars, - FX_BOOL& bEOS) { + bool& bEOS) { ASSERT(iStreamOffset >= 0 && iMaxChars > 0); Clear(); - m_bExtBuf = FALSE; + m_bExtBuf = false; if (!ExpandBuf(iMaxChars)) { return 0; } @@ -451,23 +450,23 @@ int32_t CFDE_CSSTextBuf::LoadFromStream(IFX_Stream* pTxtStream, m_iDatLen = pTxtStream->ReadString(m_pBuffer, iMaxChars, bEOS); return m_iDatLen; } -FX_BOOL CFDE_CSSTextBuf::ExpandBuf(int32_t iDesiredSize) { +bool CFDE_CSSTextBuf::ExpandBuf(int32_t iDesiredSize) { if (m_bExtBuf) { - return FALSE; + return false; } if (!m_pBuffer) { m_pBuffer = FX_Alloc(FX_WCHAR, iDesiredSize); } else if (m_iBufLen != iDesiredSize) { m_pBuffer = FX_Realloc(FX_WCHAR, m_pBuffer, iDesiredSize); } else { - return TRUE; + return true; } if (!m_pBuffer) { m_iBufLen = 0; - return FALSE; + return false; } m_iBufLen = iDesiredSize; - return TRUE; + return true; } void CFDE_CSSTextBuf::Subtract(int32_t iStart, int32_t iLength) { ASSERT(iStart >= 0 && iLength > 0); diff --git a/xfa/fde/css/fde_csssyntax.h b/xfa/fde/css/fde_csssyntax.h index af1d444144..c2c80c5e67 100644 --- a/xfa/fde/css/fde_csssyntax.h +++ b/xfa/fde/css/fde_csssyntax.h @@ -16,12 +16,12 @@ class CFDE_CSSTextBuf : public CFX_Target { CFDE_CSSTextBuf(); ~CFDE_CSSTextBuf() override; - FX_BOOL AttachBuffer(const FX_WCHAR* pBuffer, int32_t iBufLen); - FX_BOOL EstimateSize(int32_t iAllocSize); + bool AttachBuffer(const FX_WCHAR* pBuffer, int32_t iBufLen); + bool EstimateSize(int32_t iAllocSize); int32_t LoadFromStream(IFX_Stream* pTxtStream, int32_t iStreamOffset, int32_t iMaxChars, - FX_BOOL& bEOS); + bool& bEOS); bool AppendChar(FX_WCHAR wch) { if (m_iDatLen >= m_iBufLen && !ExpandBuf(m_iBufLen * 2)) return false; @@ -38,7 +38,7 @@ class CFDE_CSSTextBuf : public CFX_Target { return --m_iDatLen; } void Subtract(int32_t iStart, int32_t iLength); - FX_BOOL IsEOF() const { return m_iDatPos >= m_iDatLen; } + bool IsEOF() const { return m_iDatPos >= m_iDatLen; } FX_WCHAR GetAt(int32_t index) const { return m_pBuffer[index]; } FX_WCHAR GetChar() const { return m_pBuffer[m_iDatPos]; } FX_WCHAR GetNextChar() const { @@ -49,8 +49,8 @@ class CFDE_CSSTextBuf : public CFX_Target { const FX_WCHAR* GetBuffer() const { return m_pBuffer; } protected: - FX_BOOL ExpandBuf(int32_t iDesiredSize); - FX_BOOL m_bExtBuf; + bool ExpandBuf(int32_t iDesiredSize); + bool m_bExtBuf; FX_WCHAR* m_pBuffer; int32_t m_iBufLen; int32_t m_iDatLen; @@ -80,30 +80,30 @@ class CFDE_CSSSyntaxParser : public CFX_Target { CFDE_CSSSyntaxParser(); ~CFDE_CSSSyntaxParser() override; - FX_BOOL Init(IFX_Stream* pStream, - int32_t iCSSPlaneSize, - int32_t iTextDataSize = 32, - FX_BOOL bOnlyDeclaration = FALSE); - FX_BOOL Init(const FX_WCHAR* pBuffer, - int32_t iBufferSize, - int32_t iTextDatSize = 32, - FX_BOOL bOnlyDeclaration = FALSE); + bool Init(IFX_Stream* pStream, + int32_t iCSSPlaneSize, + int32_t iTextDataSize = 32, + bool bOnlyDeclaration = false); + bool Init(const FX_WCHAR* pBuffer, + int32_t iBufferSize, + int32_t iTextDatSize = 32, + bool bOnlyDeclaration = false); FDE_CSSSYNTAXSTATUS DoSyntaxParse(); const FX_WCHAR* GetCurrentString(int32_t& iLength) const; protected: - void Reset(FX_BOOL bOnlyDeclaration); + void Reset(bool bOnlyDeclaration); void SwitchMode(FDE_CSSSYNTAXMODE eMode); int32_t SwitchToComment(); - FX_BOOL RestoreMode(); - FX_BOOL AppendChar(FX_WCHAR wch); + bool RestoreMode(); + bool AppendChar(FX_WCHAR wch); int32_t SaveTextData(); - FX_BOOL IsCharsetEnabled() const { + bool IsCharsetEnabled() const { return (m_dwCheck & FDE_CSSSYNTAXCHECK_AllowCharset) != 0; } void DisableCharset() { m_dwCheck = FDE_CSSSYNTAXCHECK_AllowImport; } - FX_BOOL IsImportEnabled() const; + bool IsImportEnabled() const; void DisableImport() { m_dwCheck = 0; } IFX_Stream* m_pStream; diff --git a/xfa/fde/fde_gedevice.cpp b/xfa/fde/fde_gedevice.cpp index 076e70dedf..314d17cdc1 100644 --- a/xfa/fde/fde_gedevice.cpp +++ b/xfa/fde/fde_gedevice.cpp @@ -18,10 +18,8 @@ #include "xfa/fgas/font/fgas_gefont.h" CFDE_RenderDevice::CFDE_RenderDevice(CFX_RenderDevice* pDevice, - FX_BOOL bOwnerDevice) - : m_pDevice(pDevice), - m_bOwnerDevice(bOwnerDevice), - m_iCharCount(0) { + bool bOwnerDevice) + : m_pDevice(pDevice), m_bOwnerDevice(bOwnerDevice), m_iCharCount(0) { ASSERT(pDevice); FX_RECT rt = m_pDevice->GetClipBox(); @@ -48,7 +46,7 @@ void CFDE_RenderDevice::RestoreState() { m_rtClip.Set((FX_FLOAT)rt.left, (FX_FLOAT)rt.top, (FX_FLOAT)rt.Width(), (FX_FLOAT)rt.Height()); } -FX_BOOL CFDE_RenderDevice::SetClipRect(const CFX_RectF& rtClip) { +bool CFDE_RenderDevice::SetClipRect(const CFX_RectF& rtClip) { m_rtClip = rtClip; return m_pDevice->SetClip_Rect(FX_RECT((int32_t)FXSYS_floor(rtClip.left), (int32_t)FXSYS_floor(rtClip.top), @@ -58,8 +56,8 @@ FX_BOOL CFDE_RenderDevice::SetClipRect(const CFX_RectF& rtClip) { const CFX_RectF& CFDE_RenderDevice::GetClipRect() { return m_rtClip; } -FX_BOOL CFDE_RenderDevice::SetClipPath(const CFDE_Path* pClip) { - return FALSE; +bool CFDE_RenderDevice::SetClipPath(const CFDE_Path* pClip) { + return false; } CFDE_Path* CFDE_RenderDevice::GetClipPath() const { return nullptr; @@ -70,11 +68,11 @@ FX_FLOAT CFDE_RenderDevice::GetDpiX() const { FX_FLOAT CFDE_RenderDevice::GetDpiY() const { return 96; } -FX_BOOL CFDE_RenderDevice::DrawImage(CFX_DIBSource* pDib, - const CFX_RectF* pSrcRect, - const CFX_RectF& dstRect, - const CFX_Matrix* pImgMatrix, - const CFX_Matrix* pDevMatrix) { +bool CFDE_RenderDevice::DrawImage(CFX_DIBSource* pDib, + const CFX_RectF* pSrcRect, + const CFX_RectF& dstRect, + const CFX_Matrix* pImgMatrix, + const CFX_Matrix* pDevMatrix) { CFX_RectF srcRect; if (pSrcRect) { srcRect = *pSrcRect; @@ -82,7 +80,7 @@ FX_BOOL CFDE_RenderDevice::DrawImage(CFX_DIBSource* pDib, srcRect.Set(0, 0, (FX_FLOAT)pDib->GetWidth(), (FX_FLOAT)pDib->GetHeight()); } if (srcRect.IsEmpty()) { - return FALSE; + return false; } CFX_Matrix dib2fxdev; if (pImgMatrix) { @@ -105,12 +103,12 @@ FX_BOOL CFDE_RenderDevice::DrawImage(CFX_DIBSource* pDib, m_pDevice->CancelDIBits(handle); return !!handle; } -FX_BOOL CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, - CFGAS_GEFont* pFont, - const FXTEXT_CHARPOS* pCharPos, - int32_t iCount, - FX_FLOAT fFontSize, - const CFX_Matrix* pMatrix) { +bool CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, + CFGAS_GEFont* pFont, + const FXTEXT_CHARPOS* pCharPos, + int32_t iCount, + FX_FLOAT fFontSize, + const CFX_Matrix* pMatrix) { ASSERT(pBrush && pFont && pCharPos && iCount > 0); CFX_Font* pFxFont = pFont->GetDevFont(); FX_ARGB argb = pBrush->GetColor(); @@ -173,7 +171,7 @@ FX_BOOL CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, pFxFont = pCurFont->GetDevFont(); #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ FxFont.SetFace(pFxFont->GetFace()); - FX_BOOL bRet = m_pDevice->DrawNormalText( + bool bRet = m_pDevice->DrawNormalText( iCurCount, pCurCP, &FxFont, -fFontSize, (const CFX_Matrix*)pMatrix, argb, FXTEXT_CLEARTYPE); FxFont.SetFace(nullptr); @@ -189,16 +187,16 @@ FX_BOOL CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, FxFont.SetFace(nullptr); #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - return TRUE; + return true; } -FX_BOOL CFDE_RenderDevice::DrawBezier(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, - const CFX_PointF& pt1, - const CFX_PointF& pt2, - const CFX_PointF& pt3, - const CFX_PointF& pt4, - const CFX_Matrix* pMatrix) { +bool CFDE_RenderDevice::DrawBezier(CFDE_Pen* pPen, + FX_FLOAT fPenWidth, + const CFX_PointF& pt1, + const CFX_PointF& pt2, + const CFX_PointF& pt3, + const CFX_PointF& pt4, + const CFX_Matrix* pMatrix) { CFX_PointsF points; points.Add(pt1); points.Add(pt2); @@ -208,123 +206,123 @@ FX_BOOL CFDE_RenderDevice::DrawBezier(CFDE_Pen* pPen, path.AddBezier(points); return DrawPath(pPen, fPenWidth, &path, pMatrix); } -FX_BOOL CFDE_RenderDevice::DrawCurve(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, - const CFX_PointsF& points, - FX_BOOL bClosed, - FX_FLOAT fTension, - const CFX_Matrix* pMatrix) { +bool CFDE_RenderDevice::DrawCurve(CFDE_Pen* pPen, + FX_FLOAT fPenWidth, + const CFX_PointsF& points, + bool bClosed, + FX_FLOAT fTension, + const CFX_Matrix* pMatrix) { CFDE_Path path; path.AddCurve(points, bClosed, fTension); return DrawPath(pPen, fPenWidth, &path, pMatrix); } -FX_BOOL CFDE_RenderDevice::DrawEllipse(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix) { +bool CFDE_RenderDevice::DrawEllipse(CFDE_Pen* pPen, + FX_FLOAT fPenWidth, + const CFX_RectF& rect, + const CFX_Matrix* pMatrix) { CFDE_Path path; path.AddEllipse(rect); return DrawPath(pPen, fPenWidth, &path, pMatrix); } -FX_BOOL CFDE_RenderDevice::DrawLines(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, - const CFX_PointsF& points, - const CFX_Matrix* pMatrix) { +bool CFDE_RenderDevice::DrawLines(CFDE_Pen* pPen, + FX_FLOAT fPenWidth, + const CFX_PointsF& points, + const CFX_Matrix* pMatrix) { CFDE_Path path; path.AddLines(points); return DrawPath(pPen, fPenWidth, &path, pMatrix); } -FX_BOOL CFDE_RenderDevice::DrawLine(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, - const CFX_PointF& pt1, - const CFX_PointF& pt2, - const CFX_Matrix* pMatrix) { +bool CFDE_RenderDevice::DrawLine(CFDE_Pen* pPen, + FX_FLOAT fPenWidth, + const CFX_PointF& pt1, + const CFX_PointF& pt2, + const CFX_Matrix* pMatrix) { CFDE_Path path; path.AddLine(pt1, pt2); return DrawPath(pPen, fPenWidth, &path, pMatrix); } -FX_BOOL CFDE_RenderDevice::DrawPath(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, - const CFDE_Path* pPath, - const CFX_Matrix* pMatrix) { +bool CFDE_RenderDevice::DrawPath(CFDE_Pen* pPen, + FX_FLOAT fPenWidth, + const CFDE_Path* pPath, + const CFX_Matrix* pMatrix) { CFDE_Path* pGePath = (CFDE_Path*)pPath; if (!pGePath) - return FALSE; + return false; CFX_GraphStateData graphState; if (!CreatePen(pPen, fPenWidth, graphState)) { - return FALSE; + return false; } return m_pDevice->DrawPath(&pGePath->m_Path, (const CFX_Matrix*)pMatrix, &graphState, 0, pPen->GetColor(), 0); } -FX_BOOL CFDE_RenderDevice::DrawPolygon(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, - const CFX_PointsF& points, - const CFX_Matrix* pMatrix) { +bool CFDE_RenderDevice::DrawPolygon(CFDE_Pen* pPen, + FX_FLOAT fPenWidth, + const CFX_PointsF& points, + const CFX_Matrix* pMatrix) { CFDE_Path path; path.AddPolygon(points); return DrawPath(pPen, fPenWidth, &path, pMatrix); } -FX_BOOL CFDE_RenderDevice::DrawRectangle(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix) { +bool CFDE_RenderDevice::DrawRectangle(CFDE_Pen* pPen, + FX_FLOAT fPenWidth, + const CFX_RectF& rect, + const CFX_Matrix* pMatrix) { CFDE_Path path; path.AddRectangle(rect); return DrawPath(pPen, fPenWidth, &path, pMatrix); } -FX_BOOL CFDE_RenderDevice::FillClosedCurve(CFDE_Brush* pBrush, - const CFX_PointsF& points, - FX_FLOAT fTension, - const CFX_Matrix* pMatrix) { +bool CFDE_RenderDevice::FillClosedCurve(CFDE_Brush* pBrush, + const CFX_PointsF& points, + FX_FLOAT fTension, + const CFX_Matrix* pMatrix) { CFDE_Path path; - path.AddCurve(points, TRUE, fTension); + path.AddCurve(points, true, fTension); return FillPath(pBrush, &path, pMatrix); } -FX_BOOL CFDE_RenderDevice::FillEllipse(CFDE_Brush* pBrush, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix) { +bool CFDE_RenderDevice::FillEllipse(CFDE_Brush* pBrush, + const CFX_RectF& rect, + const CFX_Matrix* pMatrix) { CFDE_Path path; path.AddEllipse(rect); return FillPath(pBrush, &path, pMatrix); } -FX_BOOL CFDE_RenderDevice::FillPolygon(CFDE_Brush* pBrush, - const CFX_PointsF& points, - const CFX_Matrix* pMatrix) { +bool CFDE_RenderDevice::FillPolygon(CFDE_Brush* pBrush, + const CFX_PointsF& points, + const CFX_Matrix* pMatrix) { CFDE_Path path; path.AddPolygon(points); return FillPath(pBrush, &path, pMatrix); } -FX_BOOL CFDE_RenderDevice::FillRectangle(CFDE_Brush* pBrush, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix) { +bool CFDE_RenderDevice::FillRectangle(CFDE_Brush* pBrush, + const CFX_RectF& rect, + const CFX_Matrix* pMatrix) { CFDE_Path path; path.AddRectangle(rect); return FillPath(pBrush, &path, pMatrix); } -FX_BOOL CFDE_RenderDevice::CreatePen(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, - CFX_GraphStateData& graphState) { +bool CFDE_RenderDevice::CreatePen(CFDE_Pen* pPen, + FX_FLOAT fPenWidth, + CFX_GraphStateData& graphState) { if (!pPen) - return FALSE; + return false; graphState.m_LineCap = CFX_GraphStateData::LineCapButt; graphState.m_LineJoin = CFX_GraphStateData::LineJoinMiter; graphState.m_LineWidth = fPenWidth; graphState.m_MiterLimit = 10; graphState.m_DashPhase = 0; - return TRUE; + return true; } -FX_BOOL CFDE_RenderDevice::FillPath(CFDE_Brush* pBrush, - const CFDE_Path* pPath, - const CFX_Matrix* pMatrix) { +bool CFDE_RenderDevice::FillPath(CFDE_Brush* pBrush, + const CFDE_Path* pPath, + const CFX_Matrix* pMatrix) { CFDE_Path* pGePath = (CFDE_Path*)pPath; if (!pGePath) - return FALSE; + return false; if (!pBrush) - return FALSE; + return false; return m_pDevice->DrawPath(&pGePath->m_Path, pMatrix, nullptr, pBrush->GetColor(), 0, FXFILL_WINDING); } diff --git a/xfa/fde/fde_gedevice.h b/xfa/fde/fde_gedevice.h index d290f166a8..cb8e3fa42a 100644 --- a/xfa/fde/fde_gedevice.h +++ b/xfa/fde/fde_gedevice.h @@ -18,108 +18,108 @@ class CFX_GraphStateData; class CFDE_RenderDevice : public CFX_Target { public: - CFDE_RenderDevice(CFX_RenderDevice* pDevice, FX_BOOL bOwnerDevice); + CFDE_RenderDevice(CFX_RenderDevice* pDevice, bool bOwnerDevice); ~CFDE_RenderDevice() override; int32_t GetWidth() const; int32_t GetHeight() const; void SaveState(); void RestoreState(); - FX_BOOL SetClipPath(const CFDE_Path* pClip); + bool SetClipPath(const CFDE_Path* pClip); CFDE_Path* GetClipPath() const; - FX_BOOL SetClipRect(const CFX_RectF& rtClip); + bool SetClipRect(const CFX_RectF& rtClip); const CFX_RectF& GetClipRect(); FX_FLOAT GetDpiX() const; FX_FLOAT GetDpiY() const; - FX_BOOL DrawImage(CFX_DIBSource* pDib, - const CFX_RectF* pSrcRect, - const CFX_RectF& dstRect, - const CFX_Matrix* pImgMatrix = nullptr, - const CFX_Matrix* pDevMatrix = nullptr); - FX_BOOL DrawString(CFDE_Brush* pBrush, - CFGAS_GEFont* pFont, - const FXTEXT_CHARPOS* pCharPos, - int32_t iCount, - FX_FLOAT fFontSize, - const CFX_Matrix* pMatrix = nullptr); - FX_BOOL DrawBezier(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, - const CFX_PointF& pt1, - const CFX_PointF& pt2, - const CFX_PointF& pt3, - const CFX_PointF& pt4, - const CFX_Matrix* pMatrix = nullptr); - FX_BOOL DrawCurve(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, - const CFX_PointsF& points, - FX_BOOL bClosed, - FX_FLOAT fTension = 0.5f, - const CFX_Matrix* pMatrix = nullptr); - FX_BOOL DrawEllipse(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix = nullptr); - FX_BOOL DrawLines(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, - const CFX_PointsF& points, - const CFX_Matrix* pMatrix = nullptr); - FX_BOOL DrawLine(CFDE_Pen* pPen, + bool DrawImage(CFX_DIBSource* pDib, + const CFX_RectF* pSrcRect, + const CFX_RectF& dstRect, + const CFX_Matrix* pImgMatrix = nullptr, + const CFX_Matrix* pDevMatrix = nullptr); + bool DrawString(CFDE_Brush* pBrush, + CFGAS_GEFont* pFont, + const FXTEXT_CHARPOS* pCharPos, + int32_t iCount, + FX_FLOAT fFontSize, + const CFX_Matrix* pMatrix = nullptr); + bool DrawBezier(CFDE_Pen* pPen, + FX_FLOAT fPenWidth, + const CFX_PointF& pt1, + const CFX_PointF& pt2, + const CFX_PointF& pt3, + const CFX_PointF& pt4, + const CFX_Matrix* pMatrix = nullptr); + bool DrawCurve(CFDE_Pen* pPen, + FX_FLOAT fPenWidth, + const CFX_PointsF& points, + bool bClosed, + FX_FLOAT fTension = 0.5f, + const CFX_Matrix* pMatrix = nullptr); + bool DrawEllipse(CFDE_Pen* pPen, FX_FLOAT fPenWidth, - const CFX_PointF& pt1, - const CFX_PointF& pt2, + const CFX_RectF& rect, const CFX_Matrix* pMatrix = nullptr); - FX_BOOL DrawPath(CFDE_Pen* pPen, + bool DrawLines(CFDE_Pen* pPen, + FX_FLOAT fPenWidth, + const CFX_PointsF& points, + const CFX_Matrix* pMatrix = nullptr); + bool DrawLine(CFDE_Pen* pPen, + FX_FLOAT fPenWidth, + const CFX_PointF& pt1, + const CFX_PointF& pt2, + const CFX_Matrix* pMatrix = nullptr); + bool DrawPath(CFDE_Pen* pPen, + FX_FLOAT fPenWidth, + const CFDE_Path* pPath, + const CFX_Matrix* pMatrix = nullptr); + bool DrawPolygon(CFDE_Pen* pPen, FX_FLOAT fPenWidth, - const CFDE_Path* pPath, + const CFX_PointsF& points, const CFX_Matrix* pMatrix = nullptr); - FX_BOOL DrawPolygon(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, - const CFX_PointsF& points, - const CFX_Matrix* pMatrix = nullptr); - FX_BOOL DrawRectangle(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix = nullptr); - FX_BOOL FillClosedCurve(CFDE_Brush* pBrush, - const CFX_PointsF& points, - FX_FLOAT fTension = 0.5f, - const CFX_Matrix* pMatrix = nullptr); - FX_BOOL FillEllipse(CFDE_Brush* pBrush, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix = nullptr); - FX_BOOL FillPath(CFDE_Brush* pBrush, - const CFDE_Path* pPath, + bool DrawRectangle(CFDE_Pen* pPen, + FX_FLOAT fPenWidth, + const CFX_RectF& rect, + const CFX_Matrix* pMatrix = nullptr); + bool FillClosedCurve(CFDE_Brush* pBrush, + const CFX_PointsF& points, + FX_FLOAT fTension = 0.5f, + const CFX_Matrix* pMatrix = nullptr); + bool FillEllipse(CFDE_Brush* pBrush, + const CFX_RectF& rect, + const CFX_Matrix* pMatrix = nullptr); + bool FillPath(CFDE_Brush* pBrush, + const CFDE_Path* pPath, + const CFX_Matrix* pMatrix = nullptr); + bool FillPolygon(CFDE_Brush* pBrush, + const CFX_PointsF& points, const CFX_Matrix* pMatrix = nullptr); - FX_BOOL FillPolygon(CFDE_Brush* pBrush, - const CFX_PointsF& points, - const CFX_Matrix* pMatrix = nullptr); - FX_BOOL FillRectangle(CFDE_Brush* pBrush, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix = nullptr); + bool FillRectangle(CFDE_Brush* pBrush, + const CFX_RectF& rect, + const CFX_Matrix* pMatrix = nullptr); - FX_BOOL DrawSolidString(CFDE_Brush* pBrush, - CFGAS_GEFont* pFont, - const FXTEXT_CHARPOS* pCharPos, - int32_t iCount, - FX_FLOAT fFontSize, - const CFX_Matrix* pMatrix); - FX_BOOL DrawStringPath(CFDE_Brush* pBrush, - CFGAS_GEFont* pFont, - const FXTEXT_CHARPOS* pCharPos, - int32_t iCount, - FX_FLOAT fFontSize, - const CFX_Matrix* pMatrix); + bool DrawSolidString(CFDE_Brush* pBrush, + CFGAS_GEFont* pFont, + const FXTEXT_CHARPOS* pCharPos, + int32_t iCount, + FX_FLOAT fFontSize, + const CFX_Matrix* pMatrix); + bool DrawStringPath(CFDE_Brush* pBrush, + CFGAS_GEFont* pFont, + const FXTEXT_CHARPOS* pCharPos, + int32_t iCount, + FX_FLOAT fFontSize, + const CFX_Matrix* pMatrix); protected: - FX_BOOL CreatePen(CFDE_Pen* pPen, - FX_FLOAT fPenWidth, - CFX_GraphStateData& graphState); + bool CreatePen(CFDE_Pen* pPen, + FX_FLOAT fPenWidth, + CFX_GraphStateData& graphState); CFX_RenderDevice* const m_pDevice; CFX_RectF m_rtClip; - FX_BOOL m_bOwnerDevice; + bool m_bOwnerDevice; int32_t m_iCharCount; }; diff --git a/xfa/fde/fde_iterator.cpp b/xfa/fde/fde_iterator.cpp index a51b8ad90a..9ca02da6a0 100644 --- a/xfa/fde/fde_iterator.cpp +++ b/xfa/fde/fde_iterator.cpp @@ -12,26 +12,26 @@ CFDE_VisualSetIterator::CFDE_VisualSetIterator() : m_dwFilter(0), m_CanvasStack(100) {} CFDE_VisualSetIterator::~CFDE_VisualSetIterator() { - m_CanvasStack.RemoveAll(FALSE); + m_CanvasStack.RemoveAll(false); } -FX_BOOL CFDE_VisualSetIterator::AttachCanvas(IFDE_CanvasSet* pCanvas) { +bool CFDE_VisualSetIterator::AttachCanvas(IFDE_CanvasSet* pCanvas) { ASSERT(pCanvas); - m_CanvasStack.RemoveAll(FALSE); + m_CanvasStack.RemoveAll(false); FDE_CANVASITEM canvas; canvas.hCanvas = nullptr; canvas.pCanvas = pCanvas; canvas.hPos = pCanvas->GetFirstPosition(); if (!canvas.hPos) - return FALSE; + return false; return m_CanvasStack.Push(canvas) == 0; } -FX_BOOL CFDE_VisualSetIterator::FilterObjects(uint32_t dwObjects) { +bool CFDE_VisualSetIterator::FilterObjects(uint32_t dwObjects) { if (m_CanvasStack.GetSize() == 0) - return FALSE; + return false; while (m_CanvasStack.GetSize() > 1) m_CanvasStack.Pop(); diff --git a/xfa/fde/fde_iterator.h b/xfa/fde/fde_iterator.h index d162e24af3..444c92a191 100644 --- a/xfa/fde/fde_iterator.h +++ b/xfa/fde/fde_iterator.h @@ -22,8 +22,8 @@ class CFDE_VisualSetIterator : public CFX_Target { CFDE_VisualSetIterator(); ~CFDE_VisualSetIterator() override; - FX_BOOL AttachCanvas(IFDE_CanvasSet* pCanvas); - FX_BOOL FilterObjects(uint32_t dwObjects = 0xFFFFFFFF); + bool AttachCanvas(IFDE_CanvasSet* pCanvas); + bool FilterObjects(uint32_t dwObjects = 0xFFFFFFFF); void Reset(); FDE_TEXTEDITPIECE* GetNext(IFDE_VisualSet*& pVisualSet, diff --git a/xfa/fde/fde_render.cpp b/xfa/fde/fde_render.cpp index f3189b0877..e1d46f55f9 100644 --- a/xfa/fde/fde_render.cpp +++ b/xfa/fde/fde_render.cpp @@ -24,15 +24,15 @@ CFDE_RenderContext::~CFDE_RenderContext() { StopRender(); } -FX_BOOL CFDE_RenderContext::StartRender(CFDE_RenderDevice* pRenderDevice, - IFDE_CanvasSet* pCanvasSet, - const CFX_Matrix& tmDoc2Device) { +bool CFDE_RenderContext::StartRender(CFDE_RenderDevice* pRenderDevice, + IFDE_CanvasSet* pCanvasSet, + const CFX_Matrix& tmDoc2Device) { if (m_pRenderDevice) - return FALSE; + return false; if (!pRenderDevice) - return FALSE; + return false; if (!pCanvasSet) - return FALSE; + return false; m_eStatus = FDE_RENDERSTATUS_Paused; m_pRenderDevice = pRenderDevice; @@ -63,7 +63,7 @@ FDE_RENDERSTATUS CFDE_RenderContext::DoRender(IFX_Pause* pPause) { FDE_TEXTEDITPIECE* pPiece; CFX_RectF rtObj; int32_t iCount = 0; - while (TRUE) { + while (true) { pPiece = m_pIterator->GetNext(pVisualSet); if (!pPiece || !pVisualSet) { eStatus = FDE_RENDERSTATUS_Done; @@ -80,7 +80,7 @@ FDE_RENDERSTATUS CFDE_RenderContext::DoRender(IFX_Pause* pPause) { iCount += 5; break; case FDE_VISUALOBJ_Canvas: - ASSERT(FALSE); + ASSERT(false); break; default: break; @@ -111,7 +111,7 @@ void CFDE_RenderContext::RenderText(IFDE_TextSet* pTextSet, if (!pFont) return; - int32_t iCount = pTextSet->GetDisplayPos(pText, nullptr, FALSE); + int32_t iCount = pTextSet->GetDisplayPos(pText, nullptr, false); if (iCount < 1) return; @@ -121,7 +121,7 @@ void CFDE_RenderContext::RenderText(IFDE_TextSet* pTextSet, if (m_CharPos.size() < static_cast<size_t>(iCount)) m_CharPos.resize(iCount, FXTEXT_CHARPOS()); - iCount = pTextSet->GetDisplayPos(pText, m_CharPos.data(), FALSE); + iCount = pTextSet->GetDisplayPos(pText, m_CharPos.data(), false); FX_FLOAT fFontSize = pTextSet->GetFontSize(); FX_ARGB dwColor = pTextSet->GetFontColor(); m_pBrush->SetColor(dwColor); diff --git a/xfa/fde/fde_render.h b/xfa/fde/fde_render.h index 45cceabac4..8bd09510a5 100644 --- a/xfa/fde/fde_render.h +++ b/xfa/fde/fde_render.h @@ -29,9 +29,9 @@ class CFDE_RenderContext : public CFX_Target { CFDE_RenderContext(); ~CFDE_RenderContext() override; - FX_BOOL StartRender(CFDE_RenderDevice* pRenderDevice, - IFDE_CanvasSet* pCanvasSet, - const CFX_Matrix& tmDoc2Device); + bool StartRender(CFDE_RenderDevice* pRenderDevice, + IFDE_CanvasSet* pCanvasSet, + const CFX_Matrix& tmDoc2Device); FDE_RENDERSTATUS GetStatus() const { return m_eStatus; } FDE_RENDERSTATUS DoRender(IFX_Pause* pPause = nullptr); void StopRender(); diff --git a/xfa/fde/fde_visualset.h b/xfa/fde/fde_visualset.h index 103e7258ca..58ac4b99e4 100644 --- a/xfa/fde/fde_visualset.h +++ b/xfa/fde/fde_visualset.h @@ -53,11 +53,11 @@ class IFDE_TextSet : public IFDE_VisualSet { virtual FX_ARGB GetFontColor() = 0; virtual int32_t GetDisplayPos(FDE_TEXTEDITPIECE* hText, FXTEXT_CHARPOS* pCharPos, - FX_BOOL bCharCode = FALSE, + bool bCharCode = false, CFX_WideString* pWSForms = nullptr) = 0; virtual int32_t GetCharRects(const FDE_TEXTEDITPIECE* hText, CFX_RectFArray& rtArray, - FX_BOOL bbox) = 0; + bool bbox) = 0; }; #endif // XFA_FDE_FDE_VISUALSET_H_ diff --git a/xfa/fde/ifde_txtedtdorecord.h b/xfa/fde/ifde_txtedtdorecord.h index e36a59539a..b6a4100d99 100644 --- a/xfa/fde/ifde_txtedtdorecord.h +++ b/xfa/fde/ifde_txtedtdorecord.h @@ -13,8 +13,8 @@ class IFDE_TxtEdtDoRecord { public: virtual ~IFDE_TxtEdtDoRecord() {} - virtual FX_BOOL Redo() const = 0; - virtual FX_BOOL Undo() const = 0; + virtual bool Redo() const = 0; + virtual bool Undo() const = 0; }; #endif // XFA_FDE_IFDE_TXTEDTDORECORD_H_ diff --git a/xfa/fde/ifde_txtedtengine.h b/xfa/fde/ifde_txtedtengine.h index ff36deaa66..960edd36b7 100644 --- a/xfa/fde/ifde_txtedtengine.h +++ b/xfa/fde/ifde_txtedtengine.h @@ -95,7 +95,7 @@ struct FDE_TXTEDTPARAMS { FX_ARGB dwFontColor; FX_FLOAT fLineSpace; FX_FLOAT fTabWidth; - FX_BOOL bTabEquidistant; + bool bTabEquidistant; FX_WCHAR wDefChar; FX_WCHAR wLineBreakChar; int32_t nCharRotation; diff --git a/xfa/fde/ifde_txtedtpage.h b/xfa/fde/ifde_txtedtpage.h index 3132727c5b..ecc7d1699e 100644 --- a/xfa/fde/ifde_txtedtpage.h +++ b/xfa/fde/ifde_txtedtpage.h @@ -20,8 +20,8 @@ class IFDE_TxtEdtPage : public IFDE_CanvasSet, public IFX_TxtAccess { virtual CFDE_TxtEdtEngine* GetEngine() const = 0; virtual int32_t GetCharRect(int32_t nIndex, CFX_RectF& rect, - FX_BOOL bBBox = FALSE) const = 0; - virtual int32_t GetCharIndex(const CFX_PointF& fPoint, FX_BOOL& bBefore) = 0; + bool bBBox = false) const = 0; + virtual int32_t GetCharIndex(const CFX_PointF& fPoint, bool& bBefore) = 0; virtual void CalcRangeRectArray(int32_t nStart, int32_t nCount, CFX_RectFArray& RectFArr) const = 0; @@ -32,7 +32,7 @@ class IFDE_TxtEdtPage : public IFDE_CanvasSet, public IFX_TxtAccess { virtual int32_t GetDisplayPos(const CFX_RectF& rtClip, FXTEXT_CHARPOS*& pCharPos, CFX_RectF* pBBox) const = 0; - virtual FX_BOOL IsLoaded(const CFX_RectF* pClipBox) = 0; + virtual bool IsLoaded(const CFX_RectF* pClipBox) = 0; virtual int32_t LoadPage(const CFX_RectF* pClipBox, IFX_Pause* pPause) = 0; virtual void UnloadPage(const CFX_RectF* pClipBox) = 0; virtual const CFX_RectF& GetContentsBox() = 0; diff --git a/xfa/fde/ifx_chariter.h b/xfa/fde/ifx_chariter.h index 6c3fa00107..c967efd4d6 100644 --- a/xfa/fde/ifx_chariter.h +++ b/xfa/fde/ifx_chariter.h @@ -13,11 +13,11 @@ class IFX_CharIter { public: virtual ~IFX_CharIter() {} - virtual FX_BOOL Next(FX_BOOL bPrev = FALSE) = 0; + virtual bool Next(bool bPrev = false) = 0; virtual FX_WCHAR GetChar() = 0; virtual void SetAt(int32_t nIndex) = 0; virtual int32_t GetAt() const = 0; - virtual FX_BOOL IsEOF(FX_BOOL bTail = TRUE) const = 0; + virtual bool IsEOF(bool bTail = true) const = 0; virtual IFX_CharIter* Clone() = 0; }; diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp index 3010fc7f78..68a68565d1 100644 --- a/xfa/fde/tto/fde_textout.cpp +++ b/xfa/fde/tto/fde_textout.cpp @@ -30,7 +30,7 @@ CFDE_TextOut::CFDE_TextOut() m_TxtColor(0xFF000000), m_dwStyles(0), m_dwTxtBkStyles(0), - m_bElliChanged(FALSE), + m_bElliChanged(false), m_iEllipsisWidth(0), m_ttoLines(5), m_iCurLine(0), @@ -42,7 +42,7 @@ CFDE_TextOut::CFDE_TextOut() } CFDE_TextOut::~CFDE_TextOut() { - m_ttoLines.RemoveAll(FALSE); + m_ttoLines.RemoveAll(false); } void CFDE_TextOut::SetFont(CFGAS_GEFont* pFont) { @@ -88,11 +88,11 @@ void CFDE_TextOut::SetStyles(uint32_t dwStyles) { void CFDE_TextOut::SetTabWidth(FX_FLOAT fTabWidth) { ASSERT(fTabWidth > 1.0f); - m_pTxtBreak->SetTabWidth(fTabWidth, FALSE); + m_pTxtBreak->SetTabWidth(fTabWidth, false); } void CFDE_TextOut::SetEllipsisString(const CFX_WideString& wsEllipsis) { - m_bElliChanged = TRUE; + m_bElliChanged = true; m_wsEllipsis = wsEllipsis; } @@ -132,12 +132,12 @@ void CFDE_TextOut::SetDIBitmap(CFX_DIBitmap* pDIB) { m_pRenderDevice.reset(); CFX_FxgeDevice* device = new CFX_FxgeDevice; device->Attach(pDIB, false, nullptr, false); - m_pRenderDevice.reset(new CFDE_RenderDevice(device, FALSE)); + m_pRenderDevice.reset(new CFDE_RenderDevice(device, false)); } void CFDE_TextOut::SetRenderDevice(CFX_RenderDevice* pDevice) { ASSERT(pDevice); - m_pRenderDevice.reset(new CFDE_RenderDevice(pDevice, FALSE)); + m_pRenderDevice.reset(new CFDE_RenderDevice(pDevice, false)); } void CFDE_TextOut::SetClipRect(const CFX_Rect& rtClip) { @@ -240,8 +240,8 @@ void CFDE_TextOut::CalcTextSize(const FX_WCHAR* pwsStr, SetLineWidth(rect); m_iTotalLines = 0; const FX_WCHAR* pStr = pwsStr; - FX_BOOL bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey); - FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); + bool bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey); + bool bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); FX_FLOAT fWidth = 0.0f; FX_FLOAT fHeight = 0.0f; FX_FLOAT fStartPos = bVertical ? rect.bottom() : rect.right(); @@ -314,16 +314,16 @@ void CFDE_TextOut::SetLineWidth(CFX_RectF& rect) { } } -FX_BOOL CFDE_TextOut::RetrieveLineWidth(uint32_t dwBreakStatus, - FX_FLOAT& fStartPos, - FX_FLOAT& fWidth, - FX_FLOAT& fHeight) { +bool CFDE_TextOut::RetrieveLineWidth(uint32_t dwBreakStatus, + FX_FLOAT& fStartPos, + FX_FLOAT& fWidth, + FX_FLOAT& fHeight) { if (dwBreakStatus <= FX_TXTBREAK_PieceBreak) { - return FALSE; + return false; } FX_FLOAT fLineStep = (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize; - FX_BOOL bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap); + bool bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap); FX_FLOAT fLineWidth = 0.0f; int32_t iCount = m_pTxtBreak->CountBreakPieces(); for (int32_t i = 0; i < iCount; i++) { @@ -342,7 +342,7 @@ FX_BOOL CFDE_TextOut::RetrieveLineWidth(uint32_t dwBreakStatus, fHeight += fLineStep; } m_iTotalLines++; - return TRUE; + return true; } void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, @@ -419,7 +419,7 @@ void CFDE_TextOut::DrawText(const FX_WCHAR* pwsStr, fLineWidth = rect.height; } m_pTxtBreak->SetLineWidth(fLineWidth); - m_ttoLines.RemoveAll(TRUE); + m_ttoLines.RemoveAll(true); m_wsText.clear(); LoadText(pwsStr, iLength, rect); if (m_dwStyles & FDE_TTOSTYLE_Ellipsis) { @@ -453,7 +453,7 @@ void CFDE_TextOut::LoadEllipsis() { if (!m_bElliChanged) { return; } - m_bElliChanged = FALSE; + m_bElliChanged = false; m_iEllipsisWidth = 0; int32_t iLength = m_wsEllipsis.GetLength(); if (iLength < 1) { @@ -497,9 +497,9 @@ void CFDE_TextOut::LoadText(const FX_WCHAR* pwsStr, FX_WCHAR* pStr = m_wsText.GetBuffer(iLength); int32_t iTxtLength = iLength; ExpandBuffer(iTxtLength, 0); - FX_BOOL bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey); - FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); - FX_BOOL bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap); + bool bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey); + bool bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); + bool bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap); FX_FLOAT fLineStep = (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize; FX_FLOAT fLineStop = bVertical ? rect.left : rect.bottom(); @@ -513,7 +513,7 @@ void CFDE_TextOut::LoadText(const FX_WCHAR* pwsStr, int32_t iPieceWidths = 0; uint32_t dwBreakStatus; FX_WCHAR wch; - FX_BOOL bRet = FALSE; + bool bRet = false; while (iTxtLength-- > 0) { wch = *pwsStr++; if (bHotKey && wch == L'&' && *(pStr - 1) != L'&') { @@ -525,8 +525,8 @@ void CFDE_TextOut::LoadText(const FX_WCHAR* pwsStr, iChars++; dwBreakStatus = m_pTxtBreak->AppendChar(wch); if (dwBreakStatus > FX_TXTBREAK_PieceBreak) { - FX_BOOL bEndofLine = - RetriecePieces(dwBreakStatus, iStartChar, iPieceWidths, FALSE, rect); + bool bEndofLine = + RetriecePieces(dwBreakStatus, iStartChar, iPieceWidths, false, rect); if (bEndofLine && (bLineWrap || (dwBreakStatus > FX_TXTBREAK_LineBreak && !bLineWrap))) { iPieceWidths = 0; @@ -540,36 +540,36 @@ void CFDE_TextOut::LoadText(const FX_WCHAR* pwsStr, iCurLine--; } CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(iCurLine); - pLine->m_bNewReload = TRUE; - bRet = TRUE; + pLine->m_bNewReload = true; + bRet = true; break; } } } dwBreakStatus = m_pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); if (dwBreakStatus > FX_TXTBREAK_PieceBreak && !bRet) { - RetriecePieces(dwBreakStatus, iStartChar, iPieceWidths, FALSE, rect); + RetriecePieces(dwBreakStatus, iStartChar, iPieceWidths, false, rect); } m_pTxtBreak->ClearBreakPieces(); m_pTxtBreak->Reset(); m_wsText.ReleaseBuffer(iLength); } -FX_BOOL CFDE_TextOut::RetriecePieces(uint32_t dwBreakStatus, - int32_t& iStartChar, - int32_t& iPieceWidths, - FX_BOOL bReload, - const CFX_RectF& rect) { - FX_BOOL bSingleLine = !!(m_dwStyles & FDE_TTOSTYLE_SingleLine); - FX_BOOL bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap); - FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); +bool CFDE_TextOut::RetriecePieces(uint32_t dwBreakStatus, + int32_t& iStartChar, + int32_t& iPieceWidths, + bool bReload, + const CFX_RectF& rect) { + bool bSingleLine = !!(m_dwStyles & FDE_TTOSTYLE_SingleLine); + bool bLineWrap = !!(m_dwStyles & FDE_TTOSTYLE_LineWrap); + bool bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); FX_FLOAT fLineStep = (m_fLineSpace > m_fFontSize) ? m_fLineSpace : m_fFontSize; if (bVertical) { fLineStep = -fLineStep; } CFX_Char* pTC = nullptr; - FX_BOOL bNeedReload = FALSE; + bool bNeedReload = false; FX_FLOAT fLineWidth = bVertical ? rect.Height() : rect.Width(); int32_t iLineWidth = FXSYS_round(fLineWidth * 20000.0f); int32_t iCount = m_pTxtBreak->CountBreakPieces(); @@ -584,7 +584,7 @@ FX_BOOL CFDE_TextOut::RetriecePieces(uint32_t dwBreakStatus, int32_t iCurCharWidth = pTC->m_iCharWidth > 0 ? pTC->m_iCharWidth : 0; if (bSingleLine || !bLineWrap) { if (iLineWidth - iPieceWidths - iWidth < iCurCharWidth) { - bNeedReload = TRUE; + bNeedReload = true; break; } } @@ -593,7 +593,7 @@ FX_BOOL CFDE_TextOut::RetriecePieces(uint32_t dwBreakStatus, } if (j == 0 && !bReload) { CFDE_TTOLine* pLine = m_ttoLines.GetPtrAt(m_iCurLine); - pLine->m_bNewReload = TRUE; + pLine->m_bNewReload = true; } else if (j > 0) { CFX_RectF rtPiece; if (bVertical) { @@ -621,14 +621,14 @@ FX_BOOL CFDE_TextOut::RetriecePieces(uint32_t dwBreakStatus, iPieceWidths += iWidth; } m_pTxtBreak->ClearBreakPieces(); - FX_BOOL bRet = bSingleLine || bLineWrap || (!bLineWrap && bNeedReload) || - dwBreakStatus == FX_TXTBREAK_ParagraphBreak; + bool bRet = bSingleLine || bLineWrap || (!bLineWrap && bNeedReload) || + dwBreakStatus == FX_TXTBREAK_ParagraphBreak; return bRet; } void CFDE_TextOut::AppendPiece(const FDE_TTOPIECE& ttoPiece, - FX_BOOL bNeedReload, - FX_BOOL bEnd) { + bool bNeedReload, + bool bEnd) { if (m_iCurLine >= m_ttoLines.GetSize()) { CFDE_TTOLine ttoLine; ttoLine.m_bNewReload = bNeedReload; @@ -709,7 +709,7 @@ void CFDE_TextOut::Reload(const CFX_RectF& rect) { void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) { const FX_WCHAR* pwsStr = m_wsText.c_str(); - FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); + bool bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); int32_t iPieceWidths = 0; FDE_TTOPIECE* pPiece = pLine->GetPtrAt(0); int32_t iStartChar = pPiece->iStartChar; @@ -725,7 +725,7 @@ void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) { wch = *(pwsStr + iStar); dwBreakStatus = m_pTxtBreak->AppendChar(wch); if (dwBreakStatus > FX_TXTBREAK_PieceBreak) { - RetriecePieces(dwBreakStatus, iStartChar, iPieceWidths, TRUE, rect); + RetriecePieces(dwBreakStatus, iStartChar, iPieceWidths, true, rect); } iStar++; } @@ -734,13 +734,13 @@ void CFDE_TextOut::ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect) { } dwBreakStatus = m_pTxtBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); if (dwBreakStatus > FX_TXTBREAK_PieceBreak) { - RetriecePieces(dwBreakStatus, iStartChar, iPieceWidths, TRUE, rect); + RetriecePieces(dwBreakStatus, iStartChar, iPieceWidths, true, rect); } m_pTxtBreak->Reset(); } void CFDE_TextOut::DoAlignment(const CFX_RectF& rect) { - FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); + bool bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); FX_FLOAT fLineStopS = bVertical ? rect.right() : rect.bottom(); int32_t iLines = m_ttoLines.GetSize(); if (iLines < 1) @@ -836,10 +836,10 @@ FX_TXTRUN CFDE_TextOut::ToTextRun(const FDE_TTOPIECE* pPiece) { } void CFDE_TextOut::DrawLine(const FDE_TTOPIECE* pPiece, CFDE_Pen*& pPen) { - FX_BOOL bUnderLine = !!(m_dwStyles & FDE_TTOSTYLE_Underline); - FX_BOOL bStrikeOut = !!(m_dwStyles & FDE_TTOSTYLE_Strikeout); - FX_BOOL bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey); - FX_BOOL bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); + bool bUnderLine = !!(m_dwStyles & FDE_TTOSTYLE_Underline); + bool bStrikeOut = !!(m_dwStyles & FDE_TTOSTYLE_Strikeout); + bool bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey); + bool bVertical = !!(m_dwStyles & FDE_TTOSTYLE_VerticalLayout); if (!bUnderLine && !bStrikeOut && !bHotKey) return; @@ -912,7 +912,7 @@ void CFDE_TextOut::DrawLine(const FDE_TTOPIECE* pPiece, CFDE_Pen*& pPen) { } CFDE_TTOLine::CFDE_TTOLine() - : m_bNewReload(FALSE), m_pieces(5), m_iPieceCount(0) {} + : m_bNewReload(false), m_pieces(5), m_iPieceCount(0) {} CFDE_TTOLine::CFDE_TTOLine(const CFDE_TTOLine& ttoLine) : m_pieces(5) { m_bNewReload = ttoLine.m_bNewReload; @@ -948,6 +948,6 @@ void CFDE_TTOLine::RemoveLast(int32_t iCount) { m_pieces.RemoveLast(iCount); } -void CFDE_TTOLine::RemoveAll(FX_BOOL bLeaveMemory) { +void CFDE_TTOLine::RemoveAll(bool bLeaveMemory) { m_pieces.RemoveAll(bLeaveMemory); } diff --git a/xfa/fde/tto/fde_textout.h b/xfa/fde/tto/fde_textout.h index 341547185c..3aba000db1 100644 --- a/xfa/fde/tto/fde_textout.h +++ b/xfa/fde/tto/fde_textout.h @@ -65,9 +65,9 @@ class CFDE_TTOLine : public CFX_Target { int32_t GetSize() const; FDE_TTOPIECE* GetPtrAt(int32_t index); void RemoveLast(int32_t iCount); - void RemoveAll(FX_BOOL bLeaveMemory); + void RemoveAll(bool bLeaveMemory); - FX_BOOL m_bNewReload; + bool m_bNewReload; CFDE_TTOPieceArray m_pieces; protected: @@ -122,10 +122,10 @@ class CFDE_TextOut : public CFX_Target { protected: void CalcTextSize(const FX_WCHAR* pwsStr, int32_t iLength, CFX_RectF& rect); - FX_BOOL RetrieveLineWidth(uint32_t dwBreakStatus, - FX_FLOAT& fStartPos, - FX_FLOAT& fWidth, - FX_FLOAT& fHeight); + bool RetrieveLineWidth(uint32_t dwBreakStatus, + FX_FLOAT& fStartPos, + FX_FLOAT& fWidth, + FX_FLOAT& fHeight); void SetLineWidth(CFX_RectF& rect); void DrawText(const FX_WCHAR* pwsStr, int32_t iLength, @@ -138,14 +138,12 @@ class CFDE_TextOut : public CFX_Target { void Reload(const CFX_RectF& rect); void ReloadLinePiece(CFDE_TTOLine* pLine, const CFX_RectF& rect); - FX_BOOL RetriecePieces(uint32_t dwBreakStatus, - int32_t& iStartChar, - int32_t& iPieceWidths, - FX_BOOL bReload, - const CFX_RectF& rect); - void AppendPiece(const FDE_TTOPIECE& ttoPiece, - FX_BOOL bNeedReload, - FX_BOOL bEnd); + bool RetriecePieces(uint32_t dwBreakStatus, + int32_t& iStartChar, + int32_t& iPieceWidths, + bool bReload, + const CFX_RectF& rect); + void AppendPiece(const FDE_TTOPIECE& ttoPiece, bool bNeedReload, bool bEnd); void ReplaceWidthEllipsis(); void DoAlignment(const CFX_RectF& rect); void OnDraw(const CFX_RectF& rtClip); @@ -170,7 +168,7 @@ class CFDE_TextOut : public CFX_Target { uint32_t m_dwStyles; uint32_t m_dwTxtBkStyles; CFX_WideString m_wsEllipsis; - FX_BOOL m_bElliChanged; + bool m_bElliChanged; int32_t m_iEllipsisWidth; CFX_WideString m_wsText; CFX_RectF m_rtClip; diff --git a/xfa/fde/xml/cfx_saxreader.cpp b/xfa/fde/xml/cfx_saxreader.cpp index 8f18451ea0..b4d48d2937 100644 --- a/xfa/fde/xml/cfx_saxreader.cpp +++ b/xfa/fde/xml/cfx_saxreader.cpp @@ -70,45 +70,45 @@ CFX_SAXFile::CFX_SAXFile() m_pBuf(nullptr), m_dwBufSize(0), m_dwBufIndex(0) {} -FX_BOOL CFX_SAXFile::StartFile(IFX_SeekableReadStream* pFile, - uint32_t dwStart, - uint32_t dwLen) { +bool CFX_SAXFile::StartFile(IFX_SeekableReadStream* pFile, + uint32_t dwStart, + uint32_t dwLen) { ASSERT(!m_pFile && pFile); uint32_t dwSize = pFile->GetSize(); if (dwStart >= dwSize) { - return FALSE; + return false; } if (dwLen == static_cast<uint32_t>(-1) || dwStart + dwLen > dwSize) { dwLen = dwSize - dwStart; } if (dwLen == 0) { - return FALSE; + return false; } m_dwBufSize = std::min(dwLen, kSaxFileBufSize); m_pBuf = FX_Alloc(uint8_t, m_dwBufSize); if (!pFile->ReadBlock(m_pBuf, dwStart, m_dwBufSize)) { - return FALSE; + return false; } m_dwStart = dwStart; m_dwEnd = dwStart + dwLen; m_dwCur = dwStart; m_pFile = pFile; m_dwBufIndex = 0; - return TRUE; + return true; } -FX_BOOL CFX_SAXFile::ReadNextBlock() { +bool CFX_SAXFile::ReadNextBlock() { ASSERT(m_pFile); uint32_t dwSize = m_dwEnd - m_dwCur; if (dwSize == 0) { - return FALSE; + return false; } m_dwBufSize = std::min(dwSize, kSaxFileBufSize); if (!m_pFile->ReadBlock(m_pBuf, m_dwCur, m_dwBufSize)) { - return FALSE; + return false; } m_dwBufIndex = 0; - return TRUE; + return true; } void CFX_SAXFile::Reset() { @@ -210,7 +210,7 @@ void CFX_SAXReader::ReallocNameBuffer() { m_pszName = (uint8_t*)FX_Realloc(uint8_t, m_pszName, m_iNameSize); } -FX_BOOL CFX_SAXReader::SkipSpace(uint8_t ch) { +bool CFX_SAXReader::SkipSpace(uint8_t ch) { return (m_dwParseMode & CFX_SaxParseMode_NotSkipSpace) == 0 && ch < 0x21; } @@ -226,7 +226,7 @@ int32_t CFX_SAXReader::StartParse(IFX_SeekableReadStream* pFile, m_iState = 0; m_eMode = CFX_SaxMode::Text; m_ePrevMode = CFX_SaxMode::Text; - m_bCharData = FALSE; + m_bCharData = false; m_dwDataOffset = 0; m_dwParseMode = dwParseMode; m_Stack.emplace(new CFX_SAXItem(++m_dwItemID)); @@ -637,11 +637,11 @@ void CFX_SAXReader::SkipNode() { m_dwDataOffset += 7; FXSYS_memmove(m_pszData, m_pszData + 7, m_iDataLength * sizeof(uint8_t)); - m_bCharData = TRUE; + m_bCharData = true; if (m_pHandler) { NotifyData(); } - m_bCharData = FALSE; + m_bCharData = false; } else { Pop(); } @@ -728,7 +728,7 @@ void CFX_SAXReader::SkipCurrentNode() { if (!pItem) return; - pItem->m_bSkip = TRUE; + pItem->m_bSkip = true; } void CFX_SAXReader::SetHandler(CXFA_SAXReaderHandler* pHandler) { diff --git a/xfa/fde/xml/cfx_saxreader.h b/xfa/fde/xml/cfx_saxreader.h index 10ba69f1f5..667813cf76 100644 --- a/xfa/fde/xml/cfx_saxreader.h +++ b/xfa/fde/xml/cfx_saxreader.h @@ -27,21 +27,21 @@ class CFX_SAXItem { }; explicit CFX_SAXItem(uint32_t id) - : m_pNode(nullptr), m_eNode(Type::Unknown), m_dwID(id), m_bSkip(FALSE) {} + : m_pNode(nullptr), m_eNode(Type::Unknown), m_dwID(id), m_bSkip(false) {} CXFA_SAXContext* m_pNode; Type m_eNode; const uint32_t m_dwID; - FX_BOOL m_bSkip; + bool m_bSkip; }; class CFX_SAXFile { public: CFX_SAXFile(); - FX_BOOL StartFile(IFX_SeekableReadStream* pFile, - uint32_t dwStart, - uint32_t dwLen); - FX_BOOL ReadNextBlock(); + bool StartFile(IFX_SeekableReadStream* pFile, + uint32_t dwStart, + uint32_t dwLen); + bool ReadNextBlock(); void Reset(); IFX_SeekableReadStream* m_pFile; uint32_t m_dwStart; @@ -102,7 +102,7 @@ class CFX_SAXReader { void Push(); void Pop(); CFX_SAXItem* GetCurrentItem() const; - FX_BOOL SkipSpace(uint8_t ch); + bool SkipSpace(uint8_t ch); void SkipNode(); void NotifyData(); void NotifyEnter(); @@ -122,7 +122,7 @@ class CFX_SAXReader { uint32_t m_dwItemID; CFX_SaxMode m_eMode; CFX_SaxMode m_ePrevMode; - FX_BOOL m_bCharData; + bool m_bCharData; uint8_t m_CurByte; uint32_t m_dwDataOffset; CFX_ByteArray m_SkipStack; diff --git a/xfa/fde/xml/fde_xml.h b/xfa/fde/xml/fde_xml.h index 3be4020bbc..e773b30851 100644 --- a/xfa/fde/xml/fde_xml.h +++ b/xfa/fde/xml/fde_xml.h @@ -40,6 +40,6 @@ struct FDE_XMLNODE { FDE_XMLNODETYPE eNodeType; }; -FX_BOOL FDE_IsXMLValidChar(FX_WCHAR ch); +bool FDE_IsXMLValidChar(FX_WCHAR ch); #endif // XFA_FDE_XML_FDE_XML_H_ diff --git a/xfa/fde/xml/fde_xml_imp.cpp b/xfa/fde/xml/fde_xml_imp.cpp index ea4fe97dac..cf145fdb65 100644 --- a/xfa/fde/xml/fde_xml_imp.cpp +++ b/xfa/fde/xml/fde_xml_imp.cpp @@ -42,7 +42,7 @@ const FDE_XMLNAMECHAR g_XMLNameChars[] = { {0xF900, 0xFDCF, true}, {0xFDF0, 0xFFFD, true}, }; -bool FDE_IsXMLNameChar(FX_WCHAR ch, FX_BOOL bFirstChar) { +bool FDE_IsXMLNameChar(FX_WCHAR ch, bool bFirstChar) { int32_t iStart = 0; int32_t iEnd = FX_ArraySize(g_XMLNameChars) - 1; while (iStart <= iEnd) { @@ -60,7 +60,7 @@ bool FDE_IsXMLNameChar(FX_WCHAR ch, FX_BOOL bFirstChar) { } // namespace -FX_BOOL FDE_IsXMLValidChar(FX_WCHAR ch) { +bool FDE_IsXMLValidChar(FX_WCHAR ch) { int32_t iStart = 0; int32_t iEnd = FX_ArraySize(g_XMLValidCharRange) - 1; while (iStart <= iEnd) { @@ -70,10 +70,10 @@ FX_BOOL FDE_IsXMLValidChar(FX_WCHAR ch) { } else if (ch > g_XMLValidCharRange[iMid][1]) { iStart = iMid + 1; } else { - return TRUE; + return true; } } - return FALSE; + return false; } CFDE_XMLNode::CFDE_XMLNode() @@ -141,7 +141,7 @@ int32_t CFDE_XMLNode::GetChildNodeIndex(CFDE_XMLNode* pNode) const { CFDE_XMLNode* CFDE_XMLNode::GetPath(const FX_WCHAR* pPath, int32_t iLength, - FX_BOOL bQualifiedName) const { + bool bQualifiedName) const { ASSERT(pPath); if (iLength < 0) { iLength = FXSYS_wcslen(pPath); @@ -303,7 +303,7 @@ CFDE_XMLNode* CFDE_XMLNode::GetNodeItem(CFDE_XMLNode::NodeItem eItem) const { while (pItem->m_pParent) { pItem = pItem->m_pParent; } - while (TRUE) { + while (true) { while (pItem->m_pNext) pItem = pItem->m_pNext; if (!pItem->m_pChild) @@ -339,8 +339,8 @@ int32_t CFDE_XMLNode::GetNodeLevel() const { return iLevel; } -FX_BOOL CFDE_XMLNode::InsertNodeItem(CFDE_XMLNode::NodeItem eItem, - CFDE_XMLNode* pNode) { +bool CFDE_XMLNode::InsertNodeItem(CFDE_XMLNode::NodeItem eItem, + CFDE_XMLNode* pNode) { switch (eItem) { case CFDE_XMLNode::NextSibling: { pNode->m_pParent = m_pParent; @@ -350,7 +350,7 @@ FX_BOOL CFDE_XMLNode::InsertNodeItem(CFDE_XMLNode::NodeItem eItem, m_pNext->m_pPrior = pNode; } m_pNext = pNode; - return TRUE; + return true; } case CFDE_XMLNode::PriorSibling: { pNode->m_pParent = m_pParent; @@ -362,10 +362,10 @@ FX_BOOL CFDE_XMLNode::InsertNodeItem(CFDE_XMLNode::NodeItem eItem, m_pParent->m_pChild = pNode; } m_pPrior = pNode; - return TRUE; + return true; } default: - return FALSE; + return false; } } @@ -390,7 +390,7 @@ CFDE_XMLNode* CFDE_XMLNode::RemoveNodeItem(CFDE_XMLNode::NodeItem eItem) { return pNode; } -CFDE_XMLNode* CFDE_XMLNode::Clone(FX_BOOL bRecursive) { +CFDE_XMLNode* CFDE_XMLNode::Clone(bool bRecursive) { return nullptr; } @@ -509,11 +509,11 @@ void CFDE_XMLNode::CloneChildren(CFDE_XMLNode* pClone) { return; } CFDE_XMLNode* pNext = m_pChild; - CFDE_XMLNode* pCloneNext = pNext->Clone(TRUE); + CFDE_XMLNode* pCloneNext = pNext->Clone(true); pClone->InsertChildNode(pCloneNext); pNext = pNext->m_pNext; while (pNext) { - CFDE_XMLNode* pChild = pNext->Clone(TRUE); + CFDE_XMLNode* pChild = pNext->Clone(true); pCloneNext->InsertNodeItem(CFDE_XMLNode::NextSibling, pChild); pCloneNext = pChild; pNext = pNext->m_pNext; @@ -533,7 +533,7 @@ FDE_XMLNODETYPE CFDE_XMLInstruction::GetType() const { return FDE_XMLNODE_Instruction; } -CFDE_XMLNode* CFDE_XMLInstruction::Clone(FX_BOOL bRecursive) { +CFDE_XMLNode* CFDE_XMLInstruction::Clone(bool bRecursive) { CFDE_XMLInstruction* pClone = new CFDE_XMLInstruction(m_wsTarget); if (!pClone) { return pClone; @@ -550,30 +550,30 @@ int32_t CFDE_XMLInstruction::CountAttributes() const { return m_Attributes.GetSize() / 2; } -FX_BOOL CFDE_XMLInstruction::GetAttribute(int32_t index, - CFX_WideString& wsAttriName, - CFX_WideString& wsAttriValue) const { +bool CFDE_XMLInstruction::GetAttribute(int32_t index, + CFX_WideString& wsAttriName, + CFX_WideString& wsAttriValue) const { int32_t iCount = m_Attributes.GetSize(); ASSERT(index > -1 && index < iCount / 2); for (int32_t i = 0; i < iCount; i += 2) { if (index == 0) { wsAttriName = m_Attributes[i]; wsAttriValue = m_Attributes[i + 1]; - return TRUE; + return true; } index--; } - return FALSE; + return false; } -FX_BOOL CFDE_XMLInstruction::HasAttribute(const FX_WCHAR* pwsAttriName) const { +bool CFDE_XMLInstruction::HasAttribute(const FX_WCHAR* pwsAttriName) const { int32_t iCount = m_Attributes.GetSize(); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) { - return TRUE; + return true; } } - return FALSE; + return false; } void CFDE_XMLInstruction::GetString(const FX_WCHAR* pwsAttriName, @@ -655,13 +655,12 @@ int32_t CFDE_XMLInstruction::CountData() const { return m_TargetData.GetSize(); } -FX_BOOL CFDE_XMLInstruction::GetData(int32_t index, - CFX_WideString& wsData) const { +bool CFDE_XMLInstruction::GetData(int32_t index, CFX_WideString& wsData) const { if (index < 0 || index >= m_TargetData.GetSize()) { - return FALSE; + return false; } wsData = m_TargetData[index]; - return TRUE; + return true; } void CFDE_XMLInstruction::AppendData(const CFX_WideString& wsData) { @@ -691,7 +690,7 @@ FDE_XMLNODETYPE CFDE_XMLElement::GetType() const { return FDE_XMLNODE_Element; } -CFDE_XMLNode* CFDE_XMLElement::Clone(FX_BOOL bRecursive) { +CFDE_XMLNode* CFDE_XMLElement::Clone(bool bRecursive) { CFDE_XMLElement* pClone = new CFDE_XMLElement(m_wsTag); if (!pClone) { return nullptr; @@ -766,30 +765,30 @@ int32_t CFDE_XMLElement::CountAttributes() const { return m_Attributes.GetSize() / 2; } -FX_BOOL CFDE_XMLElement::GetAttribute(int32_t index, - CFX_WideString& wsAttriName, - CFX_WideString& wsAttriValue) const { +bool CFDE_XMLElement::GetAttribute(int32_t index, + CFX_WideString& wsAttriName, + CFX_WideString& wsAttriValue) const { int32_t iCount = m_Attributes.GetSize(); ASSERT(index > -1 && index < iCount / 2); for (int32_t i = 0; i < iCount; i += 2) { if (index == 0) { wsAttriName = m_Attributes[i]; wsAttriValue = m_Attributes[i + 1]; - return TRUE; + return true; } index--; } - return FALSE; + return false; } -FX_BOOL CFDE_XMLElement::HasAttribute(const FX_WCHAR* pwsAttriName) const { +bool CFDE_XMLElement::HasAttribute(const FX_WCHAR* pwsAttriName) const { int32_t iCount = m_Attributes.GetSize(); for (int32_t i = 0; i < iCount; i += 2) { if (m_Attributes[i].Compare(pwsAttriName) == 0) { - return TRUE; + return true; } } - return FALSE; + return false; } void CFDE_XMLElement::GetString(const FX_WCHAR* pwsAttriName, @@ -904,7 +903,7 @@ FDE_XMLNODETYPE CFDE_XMLText::GetType() const { return FDE_XMLNODE_Text; } -CFDE_XMLNode* CFDE_XMLText::Clone(FX_BOOL bRecursive) { +CFDE_XMLNode* CFDE_XMLText::Clone(bool bRecursive) { CFDE_XMLText* pClone = new CFDE_XMLText(m_wsText); return pClone; } @@ -922,7 +921,7 @@ FDE_XMLNODETYPE CFDE_XMLCharData::GetType() const { return FDE_XMLNODE_CharData; } -CFDE_XMLNode* CFDE_XMLCharData::Clone(FX_BOOL bRecursive) { +CFDE_XMLNode* CFDE_XMLCharData::Clone(bool bRecursive) { CFDE_XMLCharData* pClone = new CFDE_XMLCharData(m_wsCharData); return pClone; } @@ -931,16 +930,16 @@ CFDE_XMLCharData::~CFDE_XMLCharData() {} CFDE_XMLDoc::CFDE_XMLDoc() : m_pRoot(nullptr), m_pSyntaxParser(nullptr), m_pXMLParser(nullptr) { - Reset(TRUE); + Reset(true); CFDE_XMLInstruction* pXML = new CFDE_XMLInstruction(L"xml"); m_pRoot->InsertChildNode(pXML); } CFDE_XMLDoc::~CFDE_XMLDoc() { - Reset(FALSE); + Reset(false); } -void CFDE_XMLDoc::Reset(FX_BOOL bInitRoot) { +void CFDE_XMLDoc::Reset(bool bInitRoot) { m_iStatus = 0; m_pStream = nullptr; if (bInitRoot) { @@ -968,11 +967,11 @@ void CFDE_XMLDoc::ReleaseParser() { } } -FX_BOOL CFDE_XMLDoc::LoadXML(CFDE_XMLParser* pXMLParser) { +bool CFDE_XMLDoc::LoadXML(CFDE_XMLParser* pXMLParser) { if (!pXMLParser) - return FALSE; + return false; - Reset(TRUE); + Reset(true); m_pXMLParser = pXMLParser; return !!m_pXMLParser; } @@ -1097,7 +1096,7 @@ void CFDE_XMLDoc::SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pINode) { } } -void CFDE_XMLDoc::SaveXML(IFX_Stream* pXMLStream, FX_BOOL bSaveBOM) { +void CFDE_XMLDoc::SaveXML(IFX_Stream* pXMLStream, bool bSaveBOM) { if (!pXMLStream || pXMLStream == m_pStream) { m_pStream->Seek(FX_STREAMSEEK_Begin, 0); pXMLStream = m_pStream; @@ -1150,14 +1149,14 @@ FX_WCHAR* CFDE_BlockBuffer::GetAvailableBlock(int32_t& iIndexInBlock) { return m_BlockArray[iRealIndex / m_iAllocStep]; } -FX_BOOL CFDE_BlockBuffer::InitBuffer(int32_t iBufferSize) { +bool CFDE_BlockBuffer::InitBuffer(int32_t iBufferSize) { ClearBuffer(); int32_t iNumOfBlock = (iBufferSize - 1) / m_iAllocStep + 1; for (int32_t i = 0; i < iNumOfBlock; i++) { m_BlockArray.Add(FX_Alloc(FX_WCHAR, m_iAllocStep)); } m_iBufferSize = iNumOfBlock * m_iAllocStep; - return TRUE; + return true; } void CFDE_BlockBuffer::SetTextChar(int32_t iIndex, FX_WCHAR ch) { @@ -1183,12 +1182,12 @@ void CFDE_BlockBuffer::SetTextChar(int32_t iIndex, FX_WCHAR ch) { } } -int32_t CFDE_BlockBuffer::DeleteTextChars(int32_t iCount, FX_BOOL bDirection) { +int32_t CFDE_BlockBuffer::DeleteTextChars(int32_t iCount, bool bDirection) { if (iCount <= 0) { return m_iDataLength; } if (iCount >= m_iDataLength) { - Reset(FALSE); + Reset(false); return 0; } if (bDirection) { @@ -1271,7 +1270,7 @@ CFDE_XMLSyntaxParser::CFDE_XMLSyntaxParser() m_iParsedBytes(0), m_pBuffer(nullptr), m_iBufferChars(0), - m_bEOS(FALSE), + m_bEOS(false), m_pStart(nullptr), m_pEnd(nullptr), m_XMLNodeStack(16), @@ -1328,7 +1327,7 @@ FDE_XmlSyntaxResult CFDE_XMLSyntaxParser::DoSyntaxParse() { int32_t iPos; FDE_XmlSyntaxResult syntaxParserResult = FDE_XmlSyntaxResult::None; - while (TRUE) { + while (true) { if (m_pStart >= m_pEnd) { if (m_bEOS || m_iCurrentPos >= iStreamLength) { m_syntaxParserResult = FDE_XmlSyntaxResult::EndOfString; @@ -1906,7 +1905,7 @@ void CFDE_XMLSyntaxParser::ParseTextChar(FX_WCHAR character) { } } } - m_BlockBuffer.DeleteTextChars(m_iDataLength - m_iEntityStart, FALSE); + m_BlockBuffer.DeleteTextChars(m_iDataLength - m_iEntityStart, false); m_pCurrentBlock = m_BlockBuffer.GetAvailableBlock(m_iIndexInBlock); m_iEntityStart = -1; } else { diff --git a/xfa/fde/xml/fde_xml_imp.h b/xfa/fde/xml/fde_xml_imp.h index 2ce95a0f41..1119ef2ff5 100644 --- a/xfa/fde/xml/fde_xml_imp.h +++ b/xfa/fde/xml/fde_xml_imp.h @@ -44,7 +44,7 @@ class CFDE_XMLNode : public CFX_Target { virtual void Release(); virtual FDE_XMLNODETYPE GetType() const; - virtual CFDE_XMLNode* Clone(FX_BOOL bRecursive); + virtual CFDE_XMLNode* Clone(bool bRecursive); int32_t CountChildNodes() const; CFDE_XMLNode* GetChildNode(int32_t index) const; @@ -56,11 +56,11 @@ class CFDE_XMLNode : public CFX_Target { CFDE_XMLNode* GetPath(const FX_WCHAR* pPath, int32_t iLength = -1, - FX_BOOL bQualifiedName = TRUE) const; + bool bQualifiedName = true) const; int32_t GetNodeLevel() const; CFDE_XMLNode* GetNodeItem(CFDE_XMLNode::NodeItem eItem) const; - FX_BOOL InsertNodeItem(CFDE_XMLNode::NodeItem eItem, CFDE_XMLNode* pNode); + bool InsertNodeItem(CFDE_XMLNode::NodeItem eItem, CFDE_XMLNode* pNode); CFDE_XMLNode* RemoveNodeItem(CFDE_XMLNode::NodeItem eItem); void SaveXMLNode(IFX_Stream* pXMLStream); @@ -79,14 +79,14 @@ class CFDE_XMLInstruction : public CFDE_XMLNode { // CFDE_XMLNode void Release() override; FDE_XMLNODETYPE GetType() const override; - CFDE_XMLNode* Clone(FX_BOOL bRecursive) override; + CFDE_XMLNode* Clone(bool bRecursive) override; void GetTargetName(CFX_WideString& wsTarget) const { wsTarget = m_wsTarget; } int32_t CountAttributes() const; - FX_BOOL GetAttribute(int32_t index, - CFX_WideString& wsAttriName, - CFX_WideString& wsAttriValue) const; - FX_BOOL HasAttribute(const FX_WCHAR* pwsAttriName) const; + bool GetAttribute(int32_t index, + CFX_WideString& wsAttriName, + CFX_WideString& wsAttriValue) const; + bool HasAttribute(const FX_WCHAR* pwsAttriName) const; void GetString(const FX_WCHAR* pwsAttriName, CFX_WideString& wsAttriValue, const FX_WCHAR* pwsDefValue = nullptr) const; @@ -98,7 +98,7 @@ class CFDE_XMLInstruction : public CFDE_XMLNode { void SetFloat(const FX_WCHAR* pwsAttriName, FX_FLOAT fAttriValue); void RemoveAttribute(const FX_WCHAR* pwsAttriName); int32_t CountData() const; - FX_BOOL GetData(int32_t index, CFX_WideString& wsData) const; + bool GetData(int32_t index, CFX_WideString& wsData) const; void AppendData(const CFX_WideString& wsData); void RemoveData(int32_t index); @@ -115,7 +115,7 @@ class CFDE_XMLElement : public CFDE_XMLNode { // CFDE_XMLNode void Release() override; FDE_XMLNODETYPE GetType() const override; - CFDE_XMLNode* Clone(FX_BOOL bRecursive) override; + CFDE_XMLNode* Clone(bool bRecursive) override; void GetTagName(CFX_WideString& wsTag) const; void GetLocalTagName(CFX_WideString& wsTag) const; @@ -124,10 +124,10 @@ class CFDE_XMLElement : public CFDE_XMLNode { void GetNamespaceURI(CFX_WideString& wsNamespace) const; int32_t CountAttributes() const; - FX_BOOL GetAttribute(int32_t index, - CFX_WideString& wsAttriName, - CFX_WideString& wsAttriValue) const; - FX_BOOL HasAttribute(const FX_WCHAR* pwsAttriName) const; + bool GetAttribute(int32_t index, + CFX_WideString& wsAttriName, + CFX_WideString& wsAttriValue) const; + bool HasAttribute(const FX_WCHAR* pwsAttriName) const; void RemoveAttribute(const FX_WCHAR* pwsAttriName); void GetString(const FX_WCHAR* pwsAttriName, @@ -157,7 +157,7 @@ class CFDE_XMLText : public CFDE_XMLNode { // CFDE_XMLNode void Release() override; FDE_XMLNODETYPE GetType() const override; - CFDE_XMLNode* Clone(FX_BOOL bRecursive) override; + CFDE_XMLNode* Clone(bool bRecursive) override; void GetText(CFX_WideString& wsText) const { wsText = m_wsText; } void SetText(const CFX_WideString& wsText) { m_wsText = wsText; } @@ -178,7 +178,7 @@ class CFDE_XMLCharData : public CFDE_XMLDeclaration { void Release() override; FDE_XMLNODETYPE GetType() const override; - CFDE_XMLNode* Clone(FX_BOOL bRecursive) override; + CFDE_XMLNode* Clone(bool bRecursive) override; void GetCharData(CFX_WideString& wsCharData) const { wsCharData = m_wsCharData; @@ -193,15 +193,15 @@ class CFDE_XMLDoc : public CFX_Target { CFDE_XMLDoc(); ~CFDE_XMLDoc() override; - FX_BOOL LoadXML(CFDE_XMLParser* pXMLParser); + bool LoadXML(CFDE_XMLParser* pXMLParser); int32_t DoLoad(IFX_Pause* pPause = nullptr); void CloseXML(); CFDE_XMLNode* GetRoot() const { return m_pRoot; } - void SaveXML(IFX_Stream* pXMLStream = nullptr, FX_BOOL bSaveBOM = TRUE); + void SaveXML(IFX_Stream* pXMLStream = nullptr, bool bSaveBOM = true); void SaveXMLNode(IFX_Stream* pXMLStream, CFDE_XMLNode* pNode); protected: - void Reset(FX_BOOL bInitRoot); + void Reset(bool bInitRoot); void ReleaseParser(); IFX_Stream* m_pStream; @@ -224,20 +224,20 @@ class CFDE_BlockBuffer : public CFX_Target { explicit CFDE_BlockBuffer(int32_t iAllocStep = 1024 * 1024); ~CFDE_BlockBuffer() override; - FX_BOOL InitBuffer(int32_t iBufferSize = 1024 * 1024); - FX_BOOL IsInitialized() { return m_iBufferSize / m_iAllocStep >= 1; } + bool InitBuffer(int32_t iBufferSize = 1024 * 1024); + bool IsInitialized() { return m_iBufferSize / m_iAllocStep >= 1; } void ReleaseBuffer() { delete this; } FX_WCHAR* GetAvailableBlock(int32_t& iIndexInBlock); inline int32_t GetAllocStep() const { return m_iAllocStep; } inline int32_t& GetDataLengthRef() { return m_iDataLength; } - inline void Reset(FX_BOOL bReserveData = TRUE) { + inline void Reset(bool bReserveData = true) { if (!bReserveData) { m_iStartPosition = 0; } m_iDataLength = 0; } void SetTextChar(int32_t iIndex, FX_WCHAR ch); - int32_t DeleteTextChars(int32_t iCount, FX_BOOL bDirection = TRUE); + int32_t DeleteTextChars(int32_t iCount, bool bDirection = true); void GetTextData(CFX_WideString& wsTextData, int32_t iStart = 0, int32_t iLength = -1) const; @@ -329,7 +329,7 @@ class CFDE_XMLSyntaxParser : public CFX_Target { int32_t m_iParsedBytes; FX_WCHAR* m_pBuffer; int32_t m_iBufferChars; - FX_BOOL m_bEOS; + bool m_bEOS; FX_WCHAR* m_pStart; FX_WCHAR* m_pEnd; FDE_XMLNODE m_CurNode; |