summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc/doc_vt.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-07-23 13:36:00 -0700
committerTom Sepez <tsepez@chromium.org>2015-07-23 13:36:00 -0700
commitf1e7c461dfabbff6b65a072f24f6711b34159361 (patch)
tree3b0bb772a59669f06b86824a444fd06642592d4b /core/src/fpdfdoc/doc_vt.cpp
parent320b2313d19869333ed453af546e61a9fc2b81c9 (diff)
downloadpdfium-f1e7c461dfabbff6b65a072f24f6711b34159361.tar.xz
Revert "FX_BOOL considered harmful, part 2."
This reverts commit 320b2313d19869333ed453af546e61a9fc2b81c9. Reason for revert: build failure. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1255693002 .
Diffstat (limited to 'core/src/fpdfdoc/doc_vt.cpp')
-rw-r--r--core/src/fpdfdoc/doc_vt.cpp290
1 files changed, 145 insertions, 145 deletions
diff --git a/core/src/fpdfdoc/doc_vt.cpp b/core/src/fpdfdoc/doc_vt.cpp
index 8cc6b7c9f5..230ba764e4 100644
--- a/core/src/fpdfdoc/doc_vt.cpp
+++ b/core/src/fpdfdoc/doc_vt.cpp
@@ -183,8 +183,8 @@ CPVT_WordPlace CSection::SearchWordPlace(const CPDF_Point & point) const
{
ASSERT(m_pVT != NULL);
CPVT_WordPlace place = GetBeginWordPlace();
- bool bUp = true;
- bool bDown = true;
+ FX_BOOL bUp = TRUE;
+ FX_BOOL bDown = TRUE;
int32_t nLeft = 0;
int32_t nRight = m_LineArray.GetSize() - 1;
int32_t nMid = m_LineArray.GetSize() / 2;
@@ -195,10 +195,10 @@ CPVT_WordPlace CSection::SearchWordPlace(const CPDF_Point & point) const
fTop = pLine->m_LineInfo.fLineY - pLine->m_LineInfo.fLineAscent - m_pVT->GetLineLeading(m_SecInfo);
fBottom = pLine->m_LineInfo.fLineY - pLine->m_LineInfo.fLineDescent;
if (IsFloatBigger(point.y, fTop)) {
- bUp = false;
+ bUp = FALSE;
}
if (IsFloatSmaller(point.y, fBottom)) {
- bDown = false;
+ bDown = FALSE;
}
if (IsFloatSmaller(point.y, fTop)) {
nRight = nMid - 1;
@@ -394,7 +394,7 @@ CPVT_Size CTypeset::GetEditSize(FX_FLOAT fFontSize)
{
ASSERT(m_pSection != NULL);
ASSERT(m_pVT != NULL);
- SplitLines(false, fFontSize);
+ SplitLines(FALSE, fFontSize);
return CPVT_Size(m_rcRet.Width(), m_rcRet.Height());
}
CPVT_FloatRect CTypeset::Typeset()
@@ -402,7 +402,7 @@ CPVT_FloatRect CTypeset::Typeset()
ASSERT(m_pSection != NULL);
ASSERT(m_pVT != NULL);
m_pSection->m_LineArray.Empty();
- SplitLines(true, 0.0f);
+ SplitLines(TRUE, 0.0f);
m_pSection->m_LineArray.Clear();
OutputLines();
return m_rcRet;
@@ -425,11 +425,11 @@ static int special_chars[128] = {
0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001, 0x0001,
0x0001, 0x0001, 0x0001, 0x000C, 0x0000, 0x0008, 0x0000, 0x0000,
};
-static bool IsLatin(FX_WORD word)
+static FX_BOOL IsLatin(FX_WORD word)
{
if (word <= 0x007F) {
if (special_chars[word] & 0x0001) {
- return true;
+ return TRUE;
}
}
if ((word >= 0x00C0 && word <= 0x00FF) ||
@@ -439,15 +439,15 @@ static bool IsLatin(FX_WORD word)
(word >= 0xA720 && word <= 0xA7FF) ||
(word >= 0xFF21 && word <= 0xFF3A) ||
(word >= 0xFF41 && word <= 0xFF5A)) {
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
-static bool IsDigit(FX_DWORD word)
+static FX_BOOL IsDigit(FX_DWORD word)
{
- return (word >= 0x0030 && word <= 0x0039) ? true : false;
+ return (word >= 0x0030 && word <= 0x0039) ? TRUE : FALSE;
}
-static bool IsCJK(FX_DWORD word)
+static FX_BOOL IsCJK(FX_DWORD word)
{
if ((word >= 0x1100 && word <= 0x11FF) ||
(word >= 0x2E80 && word <= 0x2FFF) ||
@@ -457,33 +457,33 @@ static bool IsCJK(FX_DWORD word)
(word >= 0xFE30 && word <= 0xFE4F) ||
(word >= 0x20000 && word <= 0x2A6DF) ||
(word >= 0x2F800 && word <= 0x2FA1F)) {
- return true;
+ return TRUE;
}
if (word >= 0x3000 && word <= 0x303F) {
if (word == 0x3005 || word == 0x3006 || word == 0x3021 || word == 0x3022 ||
word == 0x3023 || word == 0x3024 || word == 0x3025 || word == 0x3026 ||
word == 0x3027 || word == 0x3028 || word == 0x3029 || word == 0x3031 ||
word == 0x3032 || word == 0x3033 || word == 0x3034 || word == 0x3035) {
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
if (word >= 0xFF66 && word <= 0xFF9D) {
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
-static bool IsPunctuation(FX_DWORD word)
+static FX_BOOL IsPunctuation(FX_DWORD word)
{
if (word <= 0x007F) {
if ((special_chars[word] >> 3) & 1) {
- return true;
+ return TRUE;
}
} else if (word >= 0x0080 && word <= 0x00FF) {
if (word == 0x0082 || word == 0x0084 || word == 0x0085 || word == 0x0091 ||
word == 0x0092 || word == 0x0093 || word <= 0x0094 || word == 0x0096 ||
word == 0x00B4 || word == 0x00B8) {
- return true;
+ return TRUE;
}
} else if (word >= 0x2000 && word <= 0x206F) {
if (word == 0x2010 || word == 0x2011 || word == 0x2012 || word == 0x2013 ||
@@ -492,7 +492,7 @@ static bool IsPunctuation(FX_DWORD word)
word == 0x2032 || word == 0x2033 || word == 0x2034 || word == 0x2035 ||
word == 0x2036 || word == 0x2037 || word == 0x203C || word == 0x203D ||
word == 0x203E || word == 0x2044) {
- return true;
+ return TRUE;
}
} else if (word >= 0x3000 && word <= 0x303F) {
if (word == 0x3001 || word == 0x3002 || word == 0x3003 || word == 0x3005 ||
@@ -501,11 +501,11 @@ static bool IsPunctuation(FX_DWORD word)
word == 0x3011 || word == 0x3014 || word == 0x3015 || word == 0x3016 ||
word == 0x3017 || word == 0x3018 || word == 0x3019 || word == 0x301A ||
word == 0x301B || word == 0x301D || word == 0x301E || word == 0x301F) {
- return true;
+ return TRUE;
}
} else if (word >= 0xFE50 && word <= 0xFE6F) {
if ((word >= 0xFE50 && word <= 0xFE5E) || word == 0xFE63) {
- return true;
+ return TRUE;
}
} else if (word >= 0xFF00 && word <= 0xFFEF) {
if (word == 0xFF01 || word == 0xFF02 || word == 0xFF07 || word == 0xFF08 ||
@@ -514,83 +514,83 @@ static bool IsPunctuation(FX_DWORD word)
word == 0xFF3D || word == 0xFF40 || word == 0xFF5B || word == 0xFF5C ||
word == 0xFF5D || word == 0xFF61 || word == 0xFF62 || word == 0xFF63 ||
word == 0xFF64 || word == 0xFF65 || word == 0xFF9E || word == 0xFF9F) {
- return true;
+ return TRUE;
}
}
- return false;
+ return FALSE;
}
-static bool IsConnectiveSymbol(FX_DWORD word)
+static FX_BOOL IsConnectiveSymbol(FX_DWORD word)
{
if (word <= 0x007F) {
if ((special_chars[word] >> 5) & 1) {
- return true;
+ return TRUE;
}
}
- return false;
+ return FALSE;
}
-static bool IsOpenStylePunctuation(FX_DWORD word)
+static FX_BOOL IsOpenStylePunctuation(FX_DWORD word)
{
if (word <= 0x007F) {
if ((special_chars[word] >> 2) & 1) {
- return true;
+ return TRUE;
}
} else if (word == 0x300A || word == 0x300C || word == 0x300E || word == 0x3010 ||
word == 0x3014 || word == 0x3016 || word == 0x3018 || word == 0x301A ||
word == 0xFF08 || word == 0xFF3B || word == 0xFF5B || word == 0xFF62) {
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
-static bool IsCurrencySymbol(FX_WORD word)
+static FX_BOOL IsCurrencySymbol(FX_WORD word)
{
if (word == 0x0024 || word == 0x0080 || word == 0x00A2 || word == 0x00A3 ||
word == 0x00A4 || word == 0x00A5 || (word >= 0x20A0 && word <= 0x20CF) ||
word == 0xFE69 || word == 0xFF04 || word == 0xFFE0 || word == 0xFFE1 ||
word == 0xFFE5 || word == 0xFFE6) {
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
-static bool IsPrefixSymbol(FX_WORD word)
+static FX_BOOL IsPrefixSymbol(FX_WORD word)
{
if (IsCurrencySymbol(word)) {
- return true;
+ return TRUE;
}
if (word == 0x2116) {
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
-static bool IsSpace(FX_WORD word)
+static FX_BOOL IsSpace(FX_WORD word)
{
- return (word == 0x0020 || word == 0x3000) ? true : false;
+ return (word == 0x0020 || word == 0x3000) ? TRUE : FALSE;
}
-static bool NeedDivision(FX_WORD prevWord, FX_WORD curWord)
+static FX_BOOL NeedDivision(FX_WORD prevWord, FX_WORD curWord)
{
if ((IsLatin(prevWord) || IsDigit(prevWord)) && (IsLatin(curWord) || IsDigit(curWord))) {
- return false;
+ return FALSE;
}
if (IsSpace(curWord) || IsPunctuation(curWord)) {
- return false;
+ return FALSE;
}
if (IsConnectiveSymbol(prevWord) || IsConnectiveSymbol(curWord)) {
- return false;
+ return FALSE;
}
if (IsSpace(prevWord) || IsPunctuation(prevWord)) {
- return true;
+ return TRUE;
}
if (IsPrefixSymbol(prevWord)) {
- return false;
+ return FALSE;
}
if (IsPrefixSymbol(curWord) || IsCJK(curWord)) {
- return true;
+ return TRUE;
}
if (IsCJK(prevWord)) {
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
-void CTypeset::SplitLines(bool bTypeset, FX_FLOAT fFontSize)
+void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize)
{
ASSERT(m_pVT != NULL);
ASSERT(m_pSection != NULL);
@@ -601,14 +601,14 @@ void CTypeset::SplitLines(bool bTypeset, FX_FLOAT fFontSize)
FX_FLOAT fLineAscent = 0.0f, fBackupLineAscent = 0.0f;
FX_FLOAT fLineDescent = 0.0f, fBackupLineDescent = 0.0f;
int32_t nWordStartPos = 0;
- bool bFullWord = false;
+ FX_BOOL bFullWord = FALSE;
int32_t nLineFullWordIndex = 0;
int32_t nCharIndex = 0;
CPVT_LineInfo line;
FX_FLOAT fWordWidth = 0;
FX_FLOAT fTypesetWidth = FPDF_MAX(m_pVT->GetPlateWidth() - m_pVT->GetLineIndent(m_pSection->m_SecInfo), 0.0f);
int32_t nTotalWords = m_pSection->m_WordArray.GetSize();
- bool bOpened = false;
+ FX_BOOL bOpened = FALSE;
if (nTotalWords > 0) {
int32_t i = 0;
while (i < nTotalWords) {
@@ -619,8 +619,8 @@ void CTypeset::SplitLines(bool bTypeset, FX_FLOAT fFontSize)
}
if (pWord) {
if (bTypeset) {
- fLineAscent = FPDF_MAX(fLineAscent, m_pVT->GetWordAscent(*pWord, true));
- fLineDescent = FPDF_MIN(fLineDescent, m_pVT->GetWordDescent(*pWord, true));
+ fLineAscent = FPDF_MAX(fLineAscent, m_pVT->GetWordAscent(*pWord, TRUE));
+ fLineDescent = FPDF_MIN(fLineDescent, m_pVT->GetWordDescent(*pWord, TRUE));
fWordWidth = m_pVT->GetWordWidth(*pWord);
} else {
fLineAscent = FPDF_MAX(fLineAscent, m_pVT->GetWordAscent(*pWord, fFontSize));
@@ -636,20 +636,20 @@ void CTypeset::SplitLines(bool bTypeset, FX_FLOAT fFontSize)
}
if (!bOpened) {
if (IsOpenStylePunctuation(pWord->Word)) {
- bOpened = true;
- bFullWord = true;
+ bOpened = TRUE;
+ bFullWord = TRUE;
} else if (pOldWord != NULL) {
if (NeedDivision(pOldWord->Word, pWord->Word)) {
- bFullWord = true;
+ bFullWord = TRUE;
}
}
} else {
if (!IsSpace(pWord->Word) && !IsOpenStylePunctuation(pWord->Word)) {
- bOpened = false;
+ bOpened = FALSE;
}
}
if (bFullWord) {
- bFullWord = false;
+ bFullWord = FALSE;
if (nCharIndex > 0) {
nLineFullWordIndex ++;
}
@@ -691,7 +691,7 @@ void CTypeset::SplitLines(bool bTypeset, FX_FLOAT fFontSize)
fLineDescent = 0.0f;
nCharIndex = 0;
nLineFullWordIndex = 0;
- bFullWord = false;
+ bFullWord = FALSE;
} else {
fLineWidth += fWordWidth;
i++;
@@ -809,17 +809,17 @@ void CTypeset::OutputLines()
CPDF_VariableText::CPDF_VariableText() :
m_nLimitChar(0),
m_nCharArray(0),
- m_bMultiLine(false),
- m_bLimitWidth(false),
- m_bAutoFontSize(false),
+ m_bMultiLine(FALSE),
+ m_bLimitWidth(FALSE),
+ m_bAutoFontSize(FALSE),
m_nAlignment(0),
m_fLineLeading(0.0f),
m_fCharSpace(0.0f),
m_nHorzScale(100),
m_wSubWord(0),
m_fFontSize(0.0f),
- m_bInitial(false),
- m_bRichText(false),
+ m_bInitial(FALSE),
+ m_bRichText(FALSE),
m_pVTProvider(NULL),
m_pVTIterator(NULL)
{
@@ -848,12 +848,12 @@ void CPDF_VariableText::Initialize()
if (CSection * pSection = m_SectionArray.GetAt(0)) {
pSection->ResetLinePlace();
}
- m_bInitial = true;
+ m_bInitial = TRUE;
}
}
void CPDF_VariableText::ResetAll()
{
- m_bInitial = false;
+ m_bInitial = FALSE;
ResetSectionArray();
}
CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WORD word, int32_t charset,
@@ -956,7 +956,7 @@ CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace & place, const
}
CPVT_WordPlace CPDF_VariableText::DeleteWords(const CPVT_WordRange & PlaceRange)
{
- bool bLastSecPos = false;
+ FX_BOOL bLastSecPos = FALSE;
if (CSection * pSection = m_SectionArray.GetAt(PlaceRange.EndPos.nSecIndex)) {
bLastSecPos = (PlaceRange.EndPos == pSection->GetEndWordPlace());
}
@@ -971,11 +971,11 @@ CPVT_WordPlace CPDF_VariableText::DeleteWords(const CPVT_WordRange & PlaceRange)
}
CPVT_WordPlace CPDF_VariableText::DeleteWord(const CPVT_WordPlace & place)
{
- return ClearRightWord(AjustLineHeader(place, true));
+ return ClearRightWord(AjustLineHeader(place, TRUE));
}
CPVT_WordPlace CPDF_VariableText::BackSpaceWord(const CPVT_WordPlace & place)
{
- return ClearLeftWord(AjustLineHeader(place, true));
+ return ClearLeftWord(AjustLineHeader(place, TRUE));
}
void CPDF_VariableText::SetText(const FX_WCHAR* text, int32_t charset, const CPVT_SecProps * pSecProps,
const CPVT_WordProps * pWordProps)
@@ -1044,7 +1044,7 @@ void CPDF_VariableText::UpdateWordPlace(CPVT_WordPlace & place) const
if (place.nSecIndex >= m_SectionArray.GetSize()) {
place = GetEndWordPlace();
}
- place = AjustLineHeader(place, true);
+ place = AjustLineHeader(place, TRUE);
if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) {
pSection->UpdateWordPlace(place);
}
@@ -1073,19 +1073,19 @@ CPVT_WordPlace CPDF_VariableText::WordIndexToWordPlace(int32_t index) const
{
CPVT_WordPlace place = GetBeginWordPlace();
int32_t nOldIndex = 0 , nIndex = 0;
- bool bFind = false;
+ FX_BOOL bFind = FALSE;
for (int32_t i = 0, sz = m_SectionArray.GetSize(); i < sz; i++) {
if (CSection * pSection = m_SectionArray.GetAt(i)) {
nIndex += pSection->m_WordArray.GetSize();
if (nIndex == index) {
place = pSection->GetEndWordPlace();
- bFind = true;
+ bFind = TRUE;
break;
} else if (nIndex > index) {
place.nSecIndex = i;
place.nWordIndex = index - nOldIndex - 1;
pSection->UpdateWordPlace(place);
- bFind = true;
+ bFind = TRUE;
break;
}
if (i != m_SectionArray.GetSize() - 1) {
@@ -1155,15 +1155,15 @@ CPVT_WordPlace CPDF_VariableText::SearchWordPlace(const CPDF_Point & point) cons
int32_t nLeft = 0;
int32_t nRight = m_SectionArray.GetSize() - 1;
int32_t nMid = m_SectionArray.GetSize() / 2;
- bool bUp = true;
- bool bDown = true;
+ FX_BOOL bUp = TRUE;
+ FX_BOOL bDown = TRUE;
while (nLeft <= nRight) {
if (CSection * pSection = m_SectionArray.GetAt(nMid)) {
if (IsFloatBigger(pt.y, pSection->m_SecInfo.rcSection.top)) {
- bUp = false;
+ bUp = FALSE;
}
if (IsFloatBigger(pSection->m_SecInfo.rcSection.bottom, pt.y)) {
- bDown = false;
+ bDown = FALSE;
}
if (IsFloatSmaller(pt.y, pSection->m_SecInfo.rcSection.top)) {
nRight = nMid - 1;
@@ -1303,49 +1303,49 @@ CPVT_WordPlace CPDF_VariableText::AddWord(const CPVT_WordPlace & place, const CP
}
return place;
}
-bool CPDF_VariableText::GetWordInfo(const CPVT_WordPlace & place, CPVT_WordInfo & wordinfo)
+FX_BOOL CPDF_VariableText::GetWordInfo(const CPVT_WordPlace & place, CPVT_WordInfo & wordinfo)
{
if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) {
if (CPVT_WordInfo * pWord = pSection->m_WordArray.GetAt(place.nWordIndex)) {
wordinfo = *pWord;
- return true;
+ return TRUE;
}
}
- return false;
+ return FALSE;
}
-bool CPDF_VariableText::SetWordInfo(const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo)
+FX_BOOL CPDF_VariableText::SetWordInfo(const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo)
{
if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) {
if (CPVT_WordInfo * pWord = pSection->m_WordArray.GetAt(place.nWordIndex)) {
*pWord = wordinfo;
- return true;
+ return TRUE;
}
}
- return false;
+ return FALSE;
}
-bool CPDF_VariableText::GetLineInfo(const CPVT_WordPlace & place, CPVT_LineInfo & lineinfo)
+FX_BOOL CPDF_VariableText::GetLineInfo(const CPVT_WordPlace & place, CPVT_LineInfo & lineinfo)
{
if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) {
if (CLine * pLine = pSection->m_LineArray.GetAt(place.nLineIndex)) {
lineinfo = pLine->m_LineInfo;
- return true;
+ return TRUE;
}
}
- return false;
+ return FALSE;
}
-bool CPDF_VariableText::GetSectionInfo(const CPVT_WordPlace & place, CPVT_SectionInfo & secinfo)
+FX_BOOL CPDF_VariableText::GetSectionInfo(const CPVT_WordPlace & place, CPVT_SectionInfo & secinfo)
{
if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) {
secinfo = pSection->m_SecInfo;
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
CPDF_Rect CPDF_VariableText::GetContentRect() const
{
return InToOut(CPDF_EditContainer::GetContentRect());
}
-FX_FLOAT CPDF_VariableText::GetWordFontSize(const CPVT_WordInfo & WordInfo, bool bFactFontSize)
+FX_FLOAT CPDF_VariableText::GetWordFontSize(const CPVT_WordInfo & WordInfo, FX_BOOL bFactFontSize)
{
return m_bRichText && WordInfo.pWordProps ? (WordInfo.pWordProps->nScriptType == PVTWORD_SCRIPT_NORMAL || bFactFontSize ? WordInfo.pWordProps->fFontSize : WordInfo.pWordProps->fFontSize * PVT_HALF) : GetFontSize();
}
@@ -1391,11 +1391,11 @@ FX_FLOAT CPDF_VariableText::GetWordDescent(const CPVT_WordInfo & WordInfo, FX_FL
{
return GetFontDescent(GetWordFontIndex(WordInfo), fFontSize);
}
-FX_FLOAT CPDF_VariableText::GetWordAscent(const CPVT_WordInfo & WordInfo, bool bFactFontSize)
+FX_FLOAT CPDF_VariableText::GetWordAscent(const CPVT_WordInfo & WordInfo, FX_BOOL bFactFontSize)
{
return GetFontAscent(GetWordFontIndex(WordInfo), GetWordFontSize(WordInfo, bFactFontSize));
}
-FX_FLOAT CPDF_VariableText::GetWordDescent(const CPVT_WordInfo & WordInfo, bool bFactFontSize)
+FX_FLOAT CPDF_VariableText::GetWordDescent(const CPVT_WordInfo & WordInfo, FX_BOOL bFactFontSize)
{
return GetFontDescent(GetWordFontIndex(WordInfo), GetWordFontSize(WordInfo, bFactFontSize));
}
@@ -1421,7 +1421,7 @@ int32_t CPDF_VariableText::GetHorzScale(const CPVT_WordInfo & WordInfo)
}
void CPDF_VariableText::ClearSectionRightWords(const CPVT_WordPlace & place)
{
- CPVT_WordPlace wordplace = AjustLineHeader(place, true);
+ CPVT_WordPlace wordplace = AjustLineHeader(place, TRUE);
if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) {
for (int32_t w = pSection->m_WordArray.GetSize() - 1; w > wordplace.nWordIndex; w--) {
delete pSection->m_WordArray.GetAt(w);
@@ -1429,26 +1429,26 @@ void CPDF_VariableText::ClearSectionRightWords(const CPVT_WordPlace & place)
}
}
}
-CPVT_WordPlace CPDF_VariableText::AjustLineHeader(const CPVT_WordPlace & place, bool bPrevOrNext) const
+CPVT_WordPlace CPDF_VariableText::AjustLineHeader(const CPVT_WordPlace & place, FX_BOOL bPrevOrNext) const
{
if (place.nWordIndex < 0 && place.nLineIndex > 0) {
return bPrevOrNext ? GetPrevWordPlace(place) : GetNextWordPlace(place);
}
return place;
}
-bool CPDF_VariableText::ClearEmptySection(const CPVT_WordPlace & place)
+FX_BOOL CPDF_VariableText::ClearEmptySection(const CPVT_WordPlace & place)
{
if (place.nSecIndex == 0 && m_SectionArray.GetSize() == 1) {
- return false;
+ return FALSE;
}
if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) {
if (pSection->m_WordArray.GetSize() == 0) {
delete pSection;
m_SectionArray.RemoveAt(place.nSecIndex);
- return true;
+ return TRUE;
}
}
- return false;
+ return FALSE;
}
void CPDF_VariableText::ClearEmptySections(const CPVT_WordRange & PlaceRange)
{
@@ -1460,7 +1460,7 @@ void CPDF_VariableText::ClearEmptySections(const CPVT_WordRange & PlaceRange)
}
void CPDF_VariableText::LinkLatterSection(const CPVT_WordPlace & place)
{
- CPVT_WordPlace oldplace = AjustLineHeader(place, true);
+ CPVT_WordPlace oldplace = AjustLineHeader(place, TRUE);
if (CSection * pNextSection = m_SectionArray.GetAt(place.nSecIndex + 1)) {
if (CSection * pSection = m_SectionArray.GetAt(oldplace.nSecIndex)) {
for (int32_t w = 0, sz = pNextSection->m_WordArray.GetSize(); w < sz; w++) {
@@ -1477,8 +1477,8 @@ void CPDF_VariableText::LinkLatterSection(const CPVT_WordPlace & place)
void CPDF_VariableText::ClearWords(const CPVT_WordRange & PlaceRange)
{
CPVT_WordRange NewRange;
- NewRange.BeginPos = AjustLineHeader(PlaceRange.BeginPos, true);
- NewRange.EndPos = AjustLineHeader(PlaceRange.EndPos, true);
+ NewRange.BeginPos = AjustLineHeader(PlaceRange.BeginPos, TRUE);
+ NewRange.EndPos = AjustLineHeader(PlaceRange.EndPos, TRUE);
for (int32_t s = NewRange.EndPos.nSecIndex; s >= NewRange.BeginPos.nSecIndex; s--) {
if (CSection * pSection = m_SectionArray.GetAt(s)) {
pSection->ClearWords(NewRange);
@@ -1507,7 +1507,7 @@ CPVT_WordPlace CPDF_VariableText::ClearLeftWord(const CPVT_WordPlace & place)
CPVT_WordPlace CPDF_VariableText::ClearRightWord(const CPVT_WordPlace & place)
{
if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) {
- CPVT_WordPlace rightplace = AjustLineHeader(GetNextWordPlace(place), false);
+ CPVT_WordPlace rightplace = AjustLineHeader(GetNextWordPlace(place), FALSE);
if (rightplace != place) {
if(rightplace.nSecIndex != place.nSecIndex) {
LinkLatterSection(place);
@@ -1568,9 +1568,9 @@ FX_FLOAT CPDF_VariableText::GetAutoFontSize()
}
return (FX_FLOAT)gFontSizeSteps[nMid];
}
-bool CPDF_VariableText::IsBigger(FX_FLOAT fFontSize)
+FX_BOOL CPDF_VariableText::IsBigger(FX_FLOAT fFontSize)
{
- bool bBigger = false;
+ FX_BOOL bBigger = FALSE;
CPVT_Size szTotal;
for (int32_t s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) {
if (CSection * pSection = m_SectionArray.GetAt(s)) {
@@ -1580,7 +1580,7 @@ bool CPDF_VariableText::IsBigger(FX_FLOAT fFontSize)
if (IsFloatBigger(szTotal.x, GetPlateWidth())
|| IsFloatBigger(szTotal.y, GetPlateHeight())
) {
- bBigger = true;
+ bBigger = TRUE;
break;
}
}
@@ -1652,9 +1652,9 @@ int32_t CPDF_VariableText::GetDefaultFontIndex()
{
return m_pVTProvider ? m_pVTProvider->GetDefaultFontIndex() : -1;
}
-bool CPDF_VariableText::IsLatinWord(FX_WORD word)
+FX_BOOL CPDF_VariableText::IsLatinWord(FX_WORD word)
{
- return m_pVTProvider ? m_pVTProvider->IsLatinWord(word) : false;
+ return m_pVTProvider ? m_pVTProvider->IsLatinWord(word) : FALSE;
}
IPDF_VariableText_Iterator * CPDF_VariableText::GetIterator()
{
@@ -1687,70 +1687,70 @@ void CPDF_VariableText_Iterator::SetAt(const CPVT_WordPlace & place)
ASSERT(m_pVT != NULL);
m_CurPos = place;
}
-bool CPDF_VariableText_Iterator::NextWord()
+FX_BOOL CPDF_VariableText_Iterator::NextWord()
{
if (m_CurPos == m_pVT->GetEndWordPlace()) {
- return false;
+ return FALSE;
}
m_CurPos = m_pVT->GetNextWordPlace(m_CurPos);
- return true;
+ return TRUE;
}
-bool CPDF_VariableText_Iterator::PrevWord()
+FX_BOOL CPDF_VariableText_Iterator::PrevWord()
{
if (m_CurPos == m_pVT->GetBeginWordPlace()) {
- return false;
+ return FALSE;
}
m_CurPos = m_pVT->GetPrevWordPlace(m_CurPos);
- return true;
+ return TRUE;
}
-bool CPDF_VariableText_Iterator::NextLine()
+FX_BOOL CPDF_VariableText_Iterator::NextLine()
{
if (CSection * pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
if (m_CurPos.nLineIndex < pSection->m_LineArray.GetSize() - 1) {
m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex + 1, -1);
- return true;
+ return TRUE;
}
if (m_CurPos.nSecIndex < m_pVT->m_SectionArray.GetSize() - 1) {
m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex + 1, 0, -1);
- return true;
+ return TRUE;
}
}
- return false;
+ return FALSE;
}
-bool CPDF_VariableText_Iterator::PrevLine()
+FX_BOOL CPDF_VariableText_Iterator::PrevLine()
{
if (m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
if (m_CurPos.nLineIndex > 0) {
m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex - 1, -1);
- return true;
+ return TRUE;
}
if (m_CurPos.nSecIndex > 0) {
if (CSection * pLastSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex - 1)) {
m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex - 1, pLastSection->m_LineArray.GetSize() - 1, -1);
- return true;
+ return TRUE;
}
}
}
- return false;
+ return FALSE;
}
-bool CPDF_VariableText_Iterator::NextSection()
+FX_BOOL CPDF_VariableText_Iterator::NextSection()
{
if (m_CurPos.nSecIndex < m_pVT->m_SectionArray.GetSize() - 1) {
m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex + 1, 0, -1);
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
-bool CPDF_VariableText_Iterator::PrevSection()
+FX_BOOL CPDF_VariableText_Iterator::PrevSection()
{
ASSERT(m_pVT != NULL);
if (m_CurPos.nSecIndex > 0) {
m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex - 1, 0, -1);
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
-bool CPDF_VariableText_Iterator::GetWord(CPVT_Word & word) const
+FX_BOOL CPDF_VariableText_Iterator::GetWord(CPVT_Word & word) const
{
ASSERT(m_pVT != NULL);
word.WordPlace = m_CurPos;
@@ -1770,13 +1770,13 @@ bool CPDF_VariableText_Iterator::GetWord(CPVT_Word & word) const
}
word.nFontIndex = m_pVT->GetWordFontIndex(*pWord);
word.fFontSize = m_pVT->GetWordFontSize(*pWord);
- return true;
+ return TRUE;
}
}
}
- return false;
+ return FALSE;
}
-bool CPDF_VariableText_Iterator::SetWord(const CPVT_Word & word)
+FX_BOOL CPDF_VariableText_Iterator::SetWord(const CPVT_Word & word)
{
ASSERT(m_pVT != NULL);
if (CSection * pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
@@ -1784,12 +1784,12 @@ bool CPDF_VariableText_Iterator::SetWord(const CPVT_Word & word)
if (pWord->pWordProps) {
*pWord->pWordProps = word.WordProps;
}
- return true;
+ return TRUE;
}
}
- return false;
+ return FALSE;
}
-bool CPDF_VariableText_Iterator::GetLine(CPVT_Line & line) const
+FX_BOOL CPDF_VariableText_Iterator::GetLine(CPVT_Line & line) const
{
ASSERT(m_pVT != NULL);
line.lineplace = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex, -1);
@@ -1802,12 +1802,12 @@ bool CPDF_VariableText_Iterator::GetLine(CPVT_Line & line) const
line.fLineAscent = pLine->m_LineInfo.fLineAscent;
line.fLineDescent = pLine->m_LineInfo.fLineDescent;
line.lineEnd = pLine->GetEndWordPlace();
- return true;
+ return TRUE;
}
}
- return false;
+ return FALSE;
}
-bool CPDF_VariableText_Iterator::GetSection(CPVT_Section & section) const
+FX_BOOL CPDF_VariableText_Iterator::GetSection(CPVT_Section & section) const
{
ASSERT(m_pVT != NULL);
section.secplace = CPVT_WordPlace(m_CurPos.nSecIndex, 0, -1);
@@ -1819,11 +1819,11 @@ bool CPDF_VariableText_Iterator::GetSection(CPVT_Section & section) const
if (pSection->m_SecInfo.pWordProps) {
section.WordProps = *pSection->m_SecInfo.pWordProps;
}
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}
-bool CPDF_VariableText_Iterator::SetSection(const CPVT_Section & section)
+FX_BOOL CPDF_VariableText_Iterator::SetSection(const CPVT_Section & section)
{
ASSERT(m_pVT != NULL);
if (CSection * pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
@@ -1833,7 +1833,7 @@ bool CPDF_VariableText_Iterator::SetSection(const CPVT_Section & section)
if (pSection->m_SecInfo.pWordProps) {
*pSection->m_SecInfo.pWordProps = section.WordProps;
}
- return true;
+ return TRUE;
}
- return false;
+ return FALSE;
}