From bfa9a824a20f37c2dd7111012b46c929cf2ed8a0 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Tue, 9 Jun 2015 13:24:12 -0700 Subject: Merge to XFA: Use stdint.h types throughout PDFium. Near-automatic merge, plus re-running scripts to update additional usage. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1172793002 --- core/src/fpdfdoc/doc_action.cpp | 2 +- core/src/fpdfdoc/doc_annot.cpp | 6 +- core/src/fpdfdoc/doc_ap.cpp | 42 +++---- core/src/fpdfdoc/doc_basic.cpp | 10 +- core/src/fpdfdoc/doc_form.cpp | 32 +++--- core/src/fpdfdoc/doc_link.cpp | 4 +- core/src/fpdfdoc/doc_metadata.cpp | 2 +- core/src/fpdfdoc/doc_ocg.cpp | 26 ++--- core/src/fpdfdoc/doc_utils.cpp | 10 +- core/src/fpdfdoc/doc_utils.h | 4 +- core/src/fpdfdoc/doc_viewerPreferences.cpp | 2 +- core/src/fpdfdoc/doc_vt.cpp | 169 ++++++++++++++--------------- core/src/fpdfdoc/pdf_vt.h | 96 ++++++++-------- 13 files changed, 201 insertions(+), 204 deletions(-) (limited to 'core/src/fpdfdoc') diff --git a/core/src/fpdfdoc/doc_action.cpp b/core/src/fpdfdoc/doc_action.cpp index ac40335a4c..e98d3af9e7 100644 --- a/core/src/fpdfdoc/doc_action.cpp +++ b/core/src/fpdfdoc/doc_action.cpp @@ -218,7 +218,7 @@ CPDF_Dictionary* CPDF_Action::GetAnnot() const } return NULL; } -FX_INT32 CPDF_Action::GetOperationType() const +int32_t CPDF_Action::GetOperationType() const { if (m_pDict == NULL) { return 0; diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp index 908333c0f6..ef6c34701b 100644 --- a/core/src/fpdfdoc/doc_annot.cpp +++ b/core/src/fpdfdoc/doc_annot.cpp @@ -332,9 +332,9 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, const CFX_AffineMatrix* p CPDF_Array* pColor = m_pAnnotDict->GetArray("C"); FX_DWORD argb = 0xff000000; if (pColor != NULL) { - int R = (FX_INT32)(pColor->GetNumber(0) * 255); - int G = (FX_INT32)(pColor->GetNumber(1) * 255); - int B = (FX_INT32)(pColor->GetNumber(2) * 255); + int R = (int32_t)(pColor->GetNumber(0) * 255); + int G = (int32_t)(pColor->GetNumber(1) * 255); + int B = (int32_t)(pColor->GetNumber(2) * 255); argb = ArgbEncode(0xff, R, G, B); } CPDF_GraphStateData graph_state; diff --git a/core/src/fpdfdoc/doc_ap.cpp b/core/src/fpdfdoc/doc_ap.cpp index 8a195a747d..d11b78b399 100644 --- a/core/src/fpdfdoc/doc_ap.cpp +++ b/core/src/fpdfdoc/doc_ap.cpp @@ -42,8 +42,8 @@ public: CPVT_FontMap(CPDF_Document * pDoc, CPDF_Dictionary * pResDict, CPDF_Font * pDefFont, const CFX_ByteString & sDefFontAlias); virtual ~CPVT_FontMap(); - CPDF_Font* GetPDFFont(FX_INT32 nFontIndex); - CFX_ByteString GetPDFFontAlias(FX_INT32 nFontIndex); + CPDF_Font* GetPDFFont(int32_t nFontIndex); + CFX_ByteString GetPDFFontAlias(int32_t nFontIndex); static void GetAnnotSysPDFFont(CPDF_Document * pDoc, CPDF_Dictionary * pResDict, CPDF_Font * & pSysFont, CFX_ByteString & sSysFontAlias); private: @@ -84,7 +84,7 @@ void CPVT_FontMap::GetAnnotSysPDFFont(CPDF_Document * pDoc, CPDF_Dictionary * pR } } } -CPDF_Font* CPVT_FontMap::GetPDFFont(FX_INT32 nFontIndex) +CPDF_Font* CPVT_FontMap::GetPDFFont(int32_t nFontIndex) { switch (nFontIndex) { case 0: @@ -97,7 +97,7 @@ CPDF_Font* CPVT_FontMap::GetPDFFont(FX_INT32 nFontIndex) } return NULL; } -CFX_ByteString CPVT_FontMap::GetPDFFontAlias(FX_INT32 nFontIndex) +CFX_ByteString CPVT_FontMap::GetPDFFontAlias(int32_t nFontIndex) { switch (nFontIndex) { case 0: @@ -117,7 +117,7 @@ CPVT_Provider::CPVT_Provider(IPVT_FontMap * pFontMap) : m_pFontMap(pFontMap) CPVT_Provider::~CPVT_Provider() { } -FX_INT32 CPVT_Provider::GetCharWidth(FX_INT32 nFontIndex, FX_WORD word, FX_INT32 nWordStyle) +int32_t CPVT_Provider::GetCharWidth(int32_t nFontIndex, FX_WORD word, int32_t nWordStyle) { if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) { FX_DWORD charcode = pPDFFont->CharCodeFromUnicode(word); @@ -127,21 +127,21 @@ FX_INT32 CPVT_Provider::GetCharWidth(FX_INT32 nFontIndex, FX_WORD word, FX_INT32 } return 0; } -FX_INT32 CPVT_Provider::GetTypeAscent(FX_INT32 nFontIndex) +int32_t CPVT_Provider::GetTypeAscent(int32_t nFontIndex) { if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) { return pPDFFont->GetTypeAscent(); } return 0; } -FX_INT32 CPVT_Provider::GetTypeDescent(FX_INT32 nFontIndex) +int32_t CPVT_Provider::GetTypeDescent(int32_t nFontIndex) { if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) { return pPDFFont->GetTypeDescent(); } return 0; } -FX_INT32 CPVT_Provider::GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex) +int32_t CPVT_Provider::GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex) { if (CPDF_Font* pDefFont = m_pFontMap->GetPDFFont(0)) { if (pDefFont->CharCodeFromUnicode(word) != -1) { @@ -161,11 +161,11 @@ FX_BOOL CPVT_Provider::IsLatinWord(FX_WORD word) } return FALSE; } -FX_INT32 CPVT_Provider::GetDefaultFontIndex() +int32_t CPVT_Provider::GetDefaultFontIndex() { return 0; } -static CFX_ByteString GetPDFWordString(IPVT_FontMap * pFontMap, FX_INT32 nFontIndex, FX_WORD Word, FX_WORD SubWord) +static CFX_ByteString GetPDFWordString(IPVT_FontMap * pFontMap, int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord) { CFX_ByteString sWord; if (SubWord > 0) { @@ -193,7 +193,7 @@ static CFX_ByteString GetWordRenderString(const CFX_ByteString & strWords) } return ""; } -static CFX_ByteString GetFontSetString(IPVT_FontMap * pFontMap, FX_INT32 nFontIndex, FX_FLOAT fFontSize) +static CFX_ByteString GetFontSetString(IPVT_FontMap * pFontMap, int32_t nFontIndex, FX_FLOAT fFontSize) { CFX_ByteTextBuf sRet; if (pFontMap) { @@ -244,7 +244,7 @@ static CPVT_Color ParseColor(const CPDF_Array & array) } return rt; } -static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict, const FX_INT32 & nWidgetType) +static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict, const int32_t & nWidgetType) { CPDF_Dictionary* pFormDict = NULL; if (CPDF_Dictionary * pRootDict = pDoc->GetRoot()) { @@ -310,7 +310,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict return FALSE; } CPDF_Rect rcAnnot = pAnnotDict->GetRect("Rect"); - FX_INT32 nRotate = 0; + int32_t nRotate = 0; if (CPDF_Dictionary * pMKDict = pAnnotDict->GetDict("MK")) { nRotate = pMKDict->GetInteger("R"); } @@ -333,7 +333,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict rcBBox = CPDF_Rect(0, 0, rcAnnot.top - rcAnnot.bottom, rcAnnot.right - rcAnnot.left); break; } - FX_INT32 nBorderStyle = PBS_SOLID; + int32_t nBorderStyle = PBS_SOLID; FX_FLOAT fBorderWidth = 1; CPVT_Dash dsBorder(3, 0, 0); CPVT_Color crLeftTop, crRightBottom; @@ -405,7 +405,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict if (pNormalStream == NULL) { return FALSE; } - FX_INT32 objnum = pDoc->AddIndirectObject(pNormalStream); + int32_t objnum = pDoc->AddIndirectObject(pNormalStream); pAnnotDict->GetDict("AP")->SetAtReference("N", pDoc, objnum); } CPDF_Dictionary * pStreamDict = pNormalStream->GetDict(); @@ -433,7 +433,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict switch (nWidgetType) { case 0: { CFX_WideString swValue = FPDF_GetFieldAttr(pAnnotDict, "V")? FPDF_GetFieldAttr(pAnnotDict, "V")->GetUnicodeText() : CFX_WideString(); - FX_INT32 nAlign = FPDF_GetFieldAttr(pAnnotDict, "Q")? FPDF_GetFieldAttr(pAnnotDict, "Q")->GetInteger() : 0; + int32_t nAlign = FPDF_GetFieldAttr(pAnnotDict, "Q")? FPDF_GetFieldAttr(pAnnotDict, "Q")->GetInteger() : 0; FX_DWORD dwFlags = FPDF_GetFieldAttr(pAnnotDict, "Ff")? FPDF_GetFieldAttr(pAnnotDict, "Ff")->GetInteger() : 0; FX_DWORD dwMaxLen = FPDF_GetFieldAttr(pAnnotDict, "MaxLen") ? FPDF_GetFieldAttr(pAnnotDict, "MaxLen")->GetInteger() : 0; CPVT_FontMap map(pDoc, pStreamDict ? pStreamDict->GetDict("Resources") : NULL , pDefFont, sFontName.Right(sFontName.GetLength() - 1)); @@ -540,11 +540,11 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict CPVT_Provider prd(&map); CPDF_Array * pOpts = FPDF_GetFieldAttr(pAnnotDict, "Opt") ? FPDF_GetFieldAttr(pAnnotDict, "Opt")->GetArray() : NULL; CPDF_Array * pSels = FPDF_GetFieldAttr(pAnnotDict, "I") ? FPDF_GetFieldAttr(pAnnotDict, "I")->GetArray() : NULL; - FX_INT32 nTop = FPDF_GetFieldAttr(pAnnotDict, "TI") ? FPDF_GetFieldAttr(pAnnotDict, "TI")->GetInteger() : 0; + int32_t nTop = FPDF_GetFieldAttr(pAnnotDict, "TI") ? FPDF_GetFieldAttr(pAnnotDict, "TI")->GetInteger() : 0; CFX_ByteTextBuf sBody; if (pOpts) { FX_FLOAT fy = rcBody.top; - for (FX_INT32 i = nTop, sz = pOpts->GetCount(); i < sz; i++) { + for (int32_t i = nTop, sz = pOpts->GetCount(); i < sz; i++) { if (IsFloatSmaller(fy, rcBody.bottom)) { break; } @@ -598,7 +598,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict break; } if (pNormalStream) { - pNormalStream->SetData((FX_BYTE*)sAppStream.GetBuffer(), sAppStream.GetSize(), FALSE, FALSE); + pNormalStream->SetData((uint8_t*)sAppStream.GetBuffer(), sAppStream.GetSize(), FALSE, FALSE); pStreamDict = pNormalStream->GetDict(); if (pStreamDict) { pStreamDict->SetAtMatrix("Matrix", matrix); @@ -640,7 +640,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP(IPVT_FontMap * pFontMap, IPDF_Var { CFX_ByteTextBuf sEditStream, sLineStream, sWords; CPDF_Point ptOld(0.0f, 0.0f), ptNew(0.0f, 0.0f); - FX_INT32 nCurFontIndex = -1; + int32_t nCurFontIndex = -1; if (pIterator) { if (pVisible) { pIterator->SetAt(pVisible->BeginPos); @@ -713,7 +713,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP(IPVT_FontMap * pFontMap, IPDF_Var } CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(const CPDF_Rect & rect, FX_FLOAT fWidth, const CPVT_Color & color, const CPVT_Color & crLeftTop, const CPVT_Color & crRightBottom, - FX_INT32 nStyle, const CPVT_Dash & dash) + int32_t nStyle, const CPVT_Dash & dash) { CFX_ByteTextBuf sAppStream; CFX_ByteString sColor; diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp index 48f3ccae98..dfa2e6718a 100644 --- a/core/src/fpdfdoc/doc_basic.cpp +++ b/core/src/fpdfdoc/doc_basic.cpp @@ -103,7 +103,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode, const CFX_ByteString& FX_DWORD dwCount = pNames->GetCount() / 2; for (FX_DWORD i = 0; i < dwCount; i ++) { CFX_ByteString csValue = pNames->GetString(i * 2); - FX_INT32 iCompare = csValue.Compare(csName); + int32_t iCompare = csValue.Compare(csName); if (iCompare <= 0) { if (ppFind != NULL) { *ppFind = pNames; @@ -405,7 +405,7 @@ CPDF_Stream* CPDF_FileSpec::GetFileStream() const if (m_pObj == NULL) { return NULL; } - FX_INT32 iType = m_pObj->GetType(); + int32_t iType = m_pObj->GetType(); if (iType == PDFOBJ_STREAM) { return (CPDF_Stream*)m_pObj; } else if (iType == PDFOBJ_DICTIONARY) { @@ -426,7 +426,7 @@ static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object *pObj, FX_WSTR wsFileName, } else { wsStr = FILESPEC_EncodeFileName(wsFileName); } - FX_INT32 iType = pObj->GetType(); + int32_t iType = pObj->GetType(); if (iType == PDFOBJ_STRING) { pObj->SetString(CFX_ByteString::FromUnicode(wsStr)); } else if (iType == PDFOBJ_DICTIONARY) { @@ -540,7 +540,7 @@ CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const wsLabel.Format(L"%d", nPage + 1); return wsLabel; } -FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_BSTR bsLabel) const +int32_t CPDF_PageLabel::GetPageByLabel(FX_BSTR bsLabel) const { if (m_pDocument == NULL) { return -1; @@ -565,7 +565,7 @@ FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_BSTR bsLabel) const } return -1; } -FX_INT32 CPDF_PageLabel::GetPageByLabel(FX_WSTR wsLabel) const +int32_t CPDF_PageLabel::GetPageByLabel(FX_WSTR wsLabel) const { CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr()); return GetPageByLabel(bsLabel); diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp index dff6039bc8..0fbbd1d38f 100644 --- a/core/src/fpdfdoc/doc_form.cpp +++ b/core/src/fpdfdoc/doc_form.cpp @@ -376,7 +376,7 @@ static FX_BOOL RetrieveSpecificFont(LOGFONTA& lf) } return fd.bFind; } -static FX_BOOL RetrieveSpecificFont(FX_BYTE charSet, FX_BYTE pitchAndFamily, LPCSTR pcsFontName, LOGFONTA& lf) +static FX_BOOL RetrieveSpecificFont(uint8_t charSet, uint8_t pitchAndFamily, LPCSTR pcsFontName, LOGFONTA& lf) { memset(&lf, 0, sizeof(LOGFONTA)); lf.lfCharSet = charSet; @@ -386,7 +386,7 @@ static FX_BOOL RetrieveSpecificFont(FX_BYTE charSet, FX_BYTE pitchAndFamily, LPC } return RetrieveSpecificFont(lf); } -static FX_BOOL RetrieveStockFont(int iFontObject, FX_BYTE charSet, LOGFONTA& lf) +static FX_BOOL RetrieveStockFont(int iFontObject, uint8_t charSet, LOGFONTA& lf) { HFONT hFont = (HFONT)::GetStockObject(iFontObject); if (hFont != NULL) { @@ -418,7 +418,7 @@ CPDF_Font* CPDF_InterForm::AddSystemDefaultFont(const CPDF_Document* pDocument) #endif return pFont; } -CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_ByteString csFontName, FX_BYTE iCharSet) +CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_ByteString csFontName, uint8_t iCharSet) { if (pDocument == NULL || csFontName.IsEmpty()) { return NULL; @@ -440,7 +440,7 @@ CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_Byt #endif return NULL; } -CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_WideString csFontName, FX_BYTE iCharSet) +CPDF_Font* CPDF_InterForm::AddSystemFont(const CPDF_Document* pDocument, CFX_WideString csFontName, uint8_t iCharSet) { if (pDocument == NULL || csFontName.IsEmpty()) { return NULL; @@ -476,7 +476,7 @@ CPDF_Font* CPDF_InterForm::AddStandardFont(const CPDF_Document* pDocument, CFX_B } return pFont; } -CFX_ByteString CPDF_InterForm::GetNativeFont(FX_BYTE charSet, FX_LPVOID pLogFont) +CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, FX_LPVOID pLogFont) { CFX_ByteString csFontName; #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ @@ -516,16 +516,16 @@ CFX_ByteString CPDF_InterForm::GetNativeFont(FX_BYTE charSet, FX_LPVOID pLogFont CFX_ByteString CPDF_InterForm::GetNativeFont(FX_LPVOID pLogFont) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - FX_BYTE charSet = GetNativeCharSet(); + uint8_t charSet = GetNativeCharSet(); return GetNativeFont(charSet, pLogFont); #else return CFX_ByteString(); #endif } -FX_BYTE CPDF_InterForm::GetNativeCharSet() +uint8_t CPDF_InterForm::GetNativeCharSet() { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - FX_BYTE charSet = ANSI_CHARSET; + uint8_t charSet = ANSI_CHARSET; UINT iCodePage = ::GetACP(); switch (iCodePage) { case 932: @@ -582,7 +582,7 @@ FX_BYTE CPDF_InterForm::GetNativeCharSet() return 0; #endif } -CPDF_Font* CPDF_InterForm::AddNativeFont(FX_BYTE charSet, const CPDF_Document* pDocument) +CPDF_Font* CPDF_InterForm::AddNativeFont(uint8_t charSet, const CPDF_Document* pDocument) { if (pDocument == NULL) { return NULL; @@ -607,7 +607,7 @@ CPDF_Font* CPDF_InterForm::AddNativeFont(const CPDF_Document* pDocument) return NULL; } CPDF_Font* pFont = NULL; - FX_BYTE charSet = GetNativeCharSet(); + uint8_t charSet = GetNativeCharSet(); pFont = AddNativeFont(charSet, pDocument); return pFont; } @@ -1086,7 +1086,7 @@ CPDF_Font* CPDF_InterForm::GetFormFont(CFX_ByteString csFontName, CFX_ByteString { return GetInterFormFont(m_pFormDict, m_pDocument, csFontName, csNameTag); } -CPDF_Font* CPDF_InterForm::GetNativeFormFont(FX_BYTE charSet, CFX_ByteString& csNameTag) +CPDF_Font* CPDF_InterForm::GetNativeFormFont(uint8_t charSet, CFX_ByteString& csNameTag) { return GetNativeInterFormFont(m_pFormDict, m_pDocument, charSet, csNameTag); } @@ -1107,7 +1107,7 @@ void CPDF_InterForm::AddFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameT AddInterFormFont(m_pFormDict, m_pDocument, pFont, csNameTag); m_bUpdated = TRUE; } -CPDF_Font* CPDF_InterForm::AddNativeFormFont(FX_BYTE charSet, CFX_ByteString& csNameTag) +CPDF_Font* CPDF_InterForm::AddNativeFormFont(uint8_t charSet, CFX_ByteString& csNameTag) { m_bUpdated = TRUE; return AddNativeInterFormFont(m_pFormDict, m_pDocument, charSet, csNameTag); @@ -1369,7 +1369,7 @@ CPDF_FormField* CPDF_InterForm::CheckRequiredFields(const CFX_PtrArray *fields, if (pField == NULL) { continue; } - FX_INT32 iType = pField->GetType(); + int32_t iType = pField->GetType(); if (iType == CPDF_FormField::PushButton || iType == CPDF_FormField::CheckBox || iType == CPDF_FormField::ListBox) { continue; } @@ -1472,7 +1472,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF(FX_WSTR pdf_path, CFX_PtrArray& field } const struct _SupportFieldEncoding { FX_LPCSTR m_name; - FX_INT32 m_codePage; + int32_t m_codePage; } g_fieldEncoding[] = { { "BigFive", 950 }, { "GBK", 936 }, @@ -1483,8 +1483,8 @@ static void FPDFDOC_FDF_GetFieldValue(CPDF_Dictionary *pFieldDict, CFX_WideStrin { ASSERT(pFieldDict != NULL); CFX_ByteString csBValue = pFieldDict->GetString("V"); - FX_INT32 iCount = sizeof(g_fieldEncoding) / sizeof(g_fieldEncoding[0]); - FX_INT32 i = 0; + int32_t iCount = sizeof(g_fieldEncoding) / sizeof(g_fieldEncoding[0]); + int32_t i = 0; for (; i < iCount; ++i) if (bsEncoding == g_fieldEncoding[i].m_name) { break; diff --git a/core/src/fpdfdoc/doc_link.cpp b/core/src/fpdfdoc/doc_link.cpp index 2f770d7d00..71be0c36ab 100644 --- a/core/src/fpdfdoc/doc_link.cpp +++ b/core/src/fpdfdoc/doc_link.cpp @@ -23,12 +23,12 @@ CFX_PtrArray* CPDF_LinkList::GetPageLinks(CPDF_Page* pPage) return NULL; } CFX_PtrArray* pPageLinkList = NULL; - if (!m_PageMap.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, (FX_LPVOID&)pPageLinkList)) { + if (!m_PageMap.Lookup((FX_LPVOID)(uintptr_t)objnum, (FX_LPVOID&)pPageLinkList)) { pPageLinkList = FX_NEW CFX_PtrArray; if (pPageLinkList == NULL) { return NULL; } - m_PageMap.SetAt((FX_LPVOID)(FX_UINTPTR)objnum, pPageLinkList); + m_PageMap.SetAt((FX_LPVOID)(uintptr_t)objnum, pPageLinkList); LoadPageLinks(pPage, pPageLinkList); } return pPageLinkList; diff --git a/core/src/fpdfdoc/doc_metadata.cpp b/core/src/fpdfdoc/doc_metadata.cpp index 232f6eea21..677d0e91af 100644 --- a/core/src/fpdfdoc/doc_metadata.cpp +++ b/core/src/fpdfdoc/doc_metadata.cpp @@ -74,7 +74,7 @@ void CPDF_Metadata::LoadDoc(CPDF_Document *pDoc) pElmntRdf = pXmlElmnt->GetElement(NULL, FX_BSTRC("RDF")); } } -FX_INT32 CPDF_Metadata::GetString(FX_BSTR bsItem, CFX_WideString &wsStr) +int32_t CPDF_Metadata::GetString(FX_BSTR bsItem, CFX_WideString &wsStr) { if (!((PDFDOC_LPMETADATA)m_pData)->m_pXmlElmnt) { return -1; diff --git a/core/src/fpdfdoc/doc_ocg.cpp b/core/src/fpdfdoc/doc_ocg.cpp index 0ca9fc0313..c2f77a58fa 100644 --- a/core/src/fpdfdoc/doc_ocg.cpp +++ b/core/src/fpdfdoc/doc_ocg.cpp @@ -5,12 +5,12 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../include/fpdfdoc/fpdf_doc.h" -static FX_INT32 FPDFDOC_OCG_FindGroup(const CPDF_Object *pObject, const CPDF_Dictionary *pGroupDict) +static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object *pObject, const CPDF_Dictionary *pGroupDict) { if (pObject == NULL || pGroupDict == NULL) { return -1; } - FX_INT32 iType = pObject->GetType(); + int32_t iType = pObject->GetType(); if (iType == PDFOBJ_ARRAY) { FX_DWORD dwCount = ((CPDF_Array*)pObject)->GetCount(); for (FX_DWORD i = 0; i < dwCount; i++) { @@ -64,8 +64,8 @@ static CPDF_Dictionary* FPDFDOC_OCG_GetConfig(CPDF_Document *pDoc, const CPDF_Di CPDF_Array *pConfigs = pOCProperties->GetArray(FX_BSTRC("Configs")); if (pConfigs) { CPDF_Dictionary *pFind; - FX_INT32 iCount = pConfigs->GetCount(); - for (FX_INT32 i = 0; i < iCount; i ++) { + int32_t iCount = pConfigs->GetCount(); + for (int32_t i = 0; i < iCount; i ++) { pFind = pConfigs->GetDict(i); if (!pFind) { continue; @@ -124,8 +124,8 @@ FX_BOOL CPDF_OCContext::LoadOCGStateFromConfig(FX_BSTR csConfig, const CPDF_Dict pArray = pConfig->GetArray(FX_BSTRC("AS")); if (pArray) { CFX_ByteString csFind = csConfig + FX_BSTRC("State"); - FX_INT32 iCount = pArray->GetCount(); - for (FX_INT32 i = 0; i < iCount; i ++) { + int32_t iCount = pArray->GetCount(); + for (int32_t i = 0; i < iCount; i ++) { CPDF_Dictionary *pUsage = pArray->GetDict(i); if (!pUsage) { continue; @@ -181,11 +181,11 @@ FX_BOOL CPDF_OCContext::GetOCGVisible(const CPDF_Dictionary *pOCGDict) } FX_LPVOID bState = NULL; if (m_OCGStates.Lookup(pOCGDict, bState)) { - return (FX_UINTPTR)bState != 0; + return (uintptr_t)bState != 0; } - bState = (FX_LPVOID)(FX_UINTPTR)LoadOCGState(pOCGDict); + bState = (FX_LPVOID)(uintptr_t)LoadOCGState(pOCGDict); m_OCGStates.SetAt(pOCGDict, bState); - return (FX_UINTPTR)bState != 0; + return (uintptr_t)bState != 0; } FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array *pExpression, FX_BOOL bFromConfig, int nLevel) { @@ -195,7 +195,7 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array *pExpression, FX_BOOL bFromConfig, i if (pExpression == NULL) { return FALSE; } - FX_INT32 iCount = pExpression->GetCount(); + int32_t iCount = pExpression->GetCount(); CPDF_Object *pOCGObj; CFX_ByteString csOperator = pExpression->GetString(0); if (csOperator == FX_BSTRC("Not")) { @@ -213,7 +213,7 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array *pExpression, FX_BOOL bFromConfig, i } if (csOperator == FX_BSTRC("Or") || csOperator == FX_BSTRC("And")) { FX_BOOL bValue = FALSE; - for (FX_INT32 i = 1; i < iCount; i ++) { + for (int32_t i = 1; i < iCount; i ++) { pOCGObj = pExpression->GetElementValue(1); if (pOCGObj == NULL) { continue; @@ -260,8 +260,8 @@ FX_BOOL CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary *pOCMDDict, FX_BOOL if (csP == FX_BSTRC("AllOn") || csP == FX_BSTRC("AllOff")) { bState = TRUE; } - FX_INT32 iCount = ((CPDF_Array*)pOCGObj)->GetCount(); - for (FX_INT32 i = 0; i < iCount; i ++) { + int32_t iCount = ((CPDF_Array*)pOCGObj)->GetCount(); + for (int32_t i = 0; i < iCount; i ++) { FX_BOOL bItem = TRUE; CPDF_Dictionary* pItemDict = ((CPDF_Array*)pOCGObj)->GetDict(i); if (pItemDict) { diff --git a/core/src/fpdfdoc/doc_utils.cpp b/core/src/fpdfdoc/doc_utils.cpp index 35e001ea69..df393b2f77 100644 --- a/core/src/fpdfdoc/doc_utils.cpp +++ b/core/src/fpdfdoc/doc_utils.cpp @@ -245,7 +245,7 @@ void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) if (!pFormDict->KeyExist("DR")) { CPDF_Font* pFont = NULL; CFX_ByteString csBaseName, csDefault; - FX_BYTE charSet = CPDF_InterForm::GetNativeCharSet(); + uint8_t charSet = CPDF_InterForm::GetNativeCharSet(); pFont = CPDF_InterForm::AddStandardFont(pDocument, "Helvetica"); if (pFont != NULL) { AddInterFormFont(pFormDict, pDocument, pFont, csBaseName); @@ -409,7 +409,7 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument } return NULL; } -CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, FX_BYTE charSet, CFX_ByteString& csNameTag) +CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, uint8_t charSet, CFX_ByteString& csNameTag) { if (pFormDict == NULL) { return NULL; @@ -456,7 +456,7 @@ CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDo CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString& csNameTag) { csNameTag = ""; - FX_BYTE charSet = CPDF_InterForm::GetNativeCharSet(); + uint8_t charSet = CPDF_InterForm::GetNativeCharSet(); CFX_SubstFont* pSubst; CPDF_Font* pFont = GetDefaultInterFormFont(pFormDict, pDocument); if (pFont != NULL) { @@ -586,7 +586,7 @@ void AddInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, con csNameTag = CPDF_InterForm::GenerateNewResourceName(pDR, "Font", 4, csNameTag); pFonts->SetAtReference(csNameTag, pDocument, pFont->GetFontDict()); } -CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, FX_BYTE charSet, CFX_ByteString& csNameTag) +CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, uint8_t charSet, CFX_ByteString& csNameTag) { if (pFormDict == NULL) { InitInterFormDict(pFormDict, pDocument); @@ -611,7 +611,7 @@ CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pD } CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, CFX_ByteString& csNameTag) { - FX_BYTE charSet = CPDF_InterForm::GetNativeCharSet(); + uint8_t charSet = CPDF_InterForm::GetNativeCharSet(); return AddNativeInterFormFont(pFormDict, pDocument, charSet, csNameTag); } void RemoveInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont) diff --git a/core/src/fpdfdoc/doc_utils.h b/core/src/fpdfdoc/doc_utils.h index 08c4e7e552..6bb1d30dbb 100644 --- a/core/src/fpdfdoc/doc_utils.h +++ b/core/src/fpdfdoc/doc_utils.h @@ -13,12 +13,12 @@ FX_DWORD CountInterFormFonts(CPDF_Dictionary* pFormDict); CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, FX_DWORD index, CFX_ByteString& csNameTag); CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csNameTag); CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csFontName, CFX_ByteString& csNameTag); -CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, FX_BYTE charSet, CFX_ByteString& csNameTag); +CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, uint8_t charSet, CFX_ByteString& csNameTag); CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString& csNameTag); FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont, CFX_ByteString& csNameTag); FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag); void AddInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, const CPDF_Font* pFont, CFX_ByteString& csNameTag); -CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, FX_BYTE charSet, CFX_ByteString& csNameTag); +CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, uint8_t charSet, CFX_ByteString& csNameTag); CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, CFX_ByteString& csNameTag); void RemoveInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont); void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag); diff --git a/core/src/fpdfdoc/doc_viewerPreferences.cpp b/core/src/fpdfdoc/doc_viewerPreferences.cpp index f68d3fbdc7..7ec325cfb4 100644 --- a/core/src/fpdfdoc/doc_viewerPreferences.cpp +++ b/core/src/fpdfdoc/doc_viewerPreferences.cpp @@ -29,7 +29,7 @@ FX_BOOL CPDF_ViewerPreferences::PrintScaling() const } return FX_BSTRC("None") != pDict->GetString(FX_BSTRC("PrintScaling")); } -FX_INT32 CPDF_ViewerPreferences::NumCopies() const +int32_t CPDF_ViewerPreferences::NumCopies() const { CPDF_Dictionary *pDict = m_pDoc->GetRoot(); pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences")); diff --git a/core/src/fpdfdoc/doc_vt.cpp b/core/src/fpdfdoc/doc_vt.cpp index fd3f5bafd1..7ed5b4ad3c 100644 --- a/core/src/fpdfdoc/doc_vt.cpp +++ b/core/src/fpdfdoc/doc_vt.cpp @@ -7,7 +7,7 @@ #include "../../include/fpdfdoc/fpdf_doc.h" #include "../../include/fpdfdoc/fpdf_vt.h" #include "pdf_vt.h" -const FX_BYTE gFontSizeSteps[] = { 4, 6, 8, 9, 10, 12, 14, 18, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80, 90, 100, 110, 120, 130, 144}; +const uint8_t gFontSizeSteps[] = { 4, 6, 8, 9, 10, 12, 14, 18, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80, 90, 100, 110, 120, 130, 144}; #define PVT_RETURN_LENGTH 1 #define PVT_DEFAULT_FONTSIZE 18.0f #define PVTWORD_SCRIPT_NORMAL 0 @@ -62,14 +62,14 @@ void CSection::ResetLineArray() } void CSection::ResetWordArray() { - for (FX_INT32 i = 0, sz = m_WordArray.GetSize(); i < sz; i++) { + for (int32_t i = 0, sz = m_WordArray.GetSize(); i < sz; i++) { delete m_WordArray.GetAt(i); } m_WordArray.RemoveAll(); } void CSection::ResetLinePlace() { - for (FX_INT32 i = 0, sz = m_LineArray.GetSize(); i < sz; i++) { + for (int32_t i = 0, sz = m_LineArray.GetSize(); i < sz; i++) { if (CLine * pLine = m_LineArray.GetAt(i)) { pLine->LinePlace = CPVT_WordPlace(SecPlace.nSecIndex, i, -1); } @@ -78,7 +78,7 @@ void CSection::ResetLinePlace() CPVT_WordPlace CSection::AddWord(const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo) { if (CPVT_WordInfo * pWord = FX_NEW CPVT_WordInfo(wordinfo)) { - FX_INT32 nWordIndex = FPDF_MAX(FPDF_MIN(place.nWordIndex, this->m_WordArray.GetSize()), 0); + int32_t nWordIndex = FPDF_MAX(FPDF_MIN(place.nWordIndex, this->m_WordArray.GetSize()), 0); if (nWordIndex == m_WordArray.GetSize()) { m_WordArray.Add(pWord); } else { @@ -162,9 +162,9 @@ CPVT_WordPlace CSection::GetNextWordPlace(const CPVT_WordPlace & place) const } void CSection::UpdateWordPlace(CPVT_WordPlace & place) const { - FX_INT32 nLeft = 0; - FX_INT32 nRight = m_LineArray.GetSize() - 1; - FX_INT32 nMid = (nLeft + nRight) / 2; + int32_t nLeft = 0; + int32_t nRight = m_LineArray.GetSize() - 1; + int32_t nMid = (nLeft + nRight) / 2; while (nLeft <= nRight) { if (CLine * pLine = m_LineArray.GetAt(nMid)) { if (place.nWordIndex < pLine->m_LineInfo.nBeginWordIndex) { @@ -188,9 +188,9 @@ CPVT_WordPlace CSection::SearchWordPlace(const CPDF_Point & point) const CPVT_WordPlace place = GetBeginWordPlace(); FX_BOOL bUp = TRUE; FX_BOOL bDown = TRUE; - FX_INT32 nLeft = 0; - FX_INT32 nRight = m_LineArray.GetSize() - 1; - FX_INT32 nMid = m_LineArray.GetSize() / 2; + int32_t nLeft = 0; + int32_t nRight = m_LineArray.GetSize() - 1; + int32_t nMid = m_LineArray.GetSize() / 2; FX_FLOAT fTop = 0; FX_FLOAT fBottom = 0; while (nLeft <= nRight) { @@ -243,9 +243,9 @@ CPVT_WordPlace CSection::SearchWordPlace(FX_FLOAT fx, const CPVT_WordRange & ran if (!m_pVT) { return wordplace; } - FX_INT32 nLeft = range.BeginPos.nWordIndex; - FX_INT32 nRight = range.EndPos.nWordIndex + 1; - FX_INT32 nMid = (nLeft + nRight) / 2; + int32_t nLeft = range.BeginPos.nWordIndex; + int32_t nRight = range.EndPos.nWordIndex + 1; + int32_t nMid = (nLeft + nRight) / 2; while (nLeft < nRight) { if (nMid == nLeft) { break; @@ -275,23 +275,23 @@ CPVT_WordPlace CSection::SearchWordPlace(FX_FLOAT fx, const CPVT_WordRange & ran } return wordplace; } -void CSection::ClearLeftWords(FX_INT32 nWordIndex) +void CSection::ClearLeftWords(int32_t nWordIndex) { - for (FX_INT32 i = nWordIndex; i >= 0; i--) { + for (int32_t i = nWordIndex; i >= 0; i--) { delete m_WordArray.GetAt(i); m_WordArray.RemoveAt(i); } } -void CSection::ClearRightWords(FX_INT32 nWordIndex) +void CSection::ClearRightWords(int32_t nWordIndex) { - for (FX_INT32 i = m_WordArray.GetSize() - 1; i > nWordIndex; i--) { + for (int32_t i = m_WordArray.GetSize() - 1; i > nWordIndex; i--) { delete m_WordArray.GetAt(i); m_WordArray.RemoveAt(i); } } -void CSection::ClearMidWords(FX_INT32 nBeginIndex, FX_INT32 nEndIndex) +void CSection::ClearMidWords(int32_t nBeginIndex, int32_t nEndIndex) { - for (FX_INT32 i = nEndIndex; i > nBeginIndex; i--) { + for (int32_t i = nEndIndex; i > nBeginIndex; i--) { delete m_WordArray.GetAt(i); m_WordArray.RemoveAt(i); } @@ -332,7 +332,7 @@ CPVT_FloatRect CTypeset::CharArray() m_rcRet.Default(); FX_FLOAT x = 0.0f, y = 0.0f; FX_FLOAT fNextWidth; - FX_INT32 nStart = 0; + int32_t nStart = 0; FX_FLOAT fNodeWidth = m_pVT->GetPlateWidth() / (m_pVT->m_nCharArray <= 0 ? 1 : m_pVT->m_nCharArray); if (CLine * pLine = m_pSection->m_LineArray.GetAt(0)) { x = 0.0f; @@ -352,7 +352,7 @@ CPVT_FloatRect CTypeset::CharArray() pLine->m_LineInfo.fLineX = fNodeWidth * nStart - fNodeWidth * PVT_HALF; break; } - for (FX_INT32 w = 0, sz = m_pSection->m_WordArray.GetSize(); w < sz; w++) { + for (int32_t w = 0, sz = m_pSection->m_WordArray.GetSize(); w < sz; w++) { if (w >= m_pVT->m_nCharArray) { break; } @@ -591,23 +591,23 @@ void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize) { ASSERT(m_pVT != NULL); ASSERT(m_pSection != NULL); - FX_INT32 nLineHead = 0; - FX_INT32 nLineTail = 0; + int32_t nLineHead = 0; + int32_t nLineTail = 0; FX_FLOAT fMaxX = 0.0f, fMaxY = 0.0f; FX_FLOAT fLineWidth = 0.0f, fBackupLineWidth = 0.0f; FX_FLOAT fLineAscent = 0.0f, fBackupLineAscent = 0.0f; FX_FLOAT fLineDescent = 0.0f, fBackupLineDescent = 0.0f; - FX_INT32 nWordStartPos = 0; + int32_t nWordStartPos = 0; FX_BOOL bFullWord = FALSE; - FX_INT32 nLineFullWordIndex = 0; - FX_INT32 nCharIndex = 0; + 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); - FX_INT32 nTotalWords = m_pSection->m_WordArray.GetSize(); + int32_t nTotalWords = m_pSection->m_WordArray.GetSize(); FX_BOOL bOpened = FALSE; if (nTotalWords > 0) { - FX_INT32 i = 0; + int32_t i = 0; while (i < nTotalWords) { CPVT_WordInfo * pWord = m_pSection->m_WordArray.GetAt(i); CPVT_WordInfo* pOldWord = pWord; @@ -753,10 +753,10 @@ void CTypeset::OutputLines() fMaxX = fMinX + m_rcRet.Width(); fMinY = 0.0f; fMaxY = m_rcRet.Height(); - FX_INT32 nTotalLines = m_pSection->m_LineArray.GetSize(); + int32_t nTotalLines = m_pSection->m_LineArray.GetSize(); if (nTotalLines > 0) { m_pSection->m_SecInfo.nTotalLine = nTotalLines; - for (FX_INT32 l = 0; l < nTotalLines; l++) { + for (int32_t l = 0; l < nTotalLines; l++) { if (CLine * pLine = m_pSection->m_LineArray.GetAt(l)) { switch (m_pVT->GetAlignment(m_pSection->m_SecInfo)) { default: @@ -775,7 +775,7 @@ void CTypeset::OutputLines() fPosY += pLine->m_LineInfo.fLineAscent; pLine->m_LineInfo.fLineX = fPosX - fMinX; pLine->m_LineInfo.fLineY = fPosY - fMinY; - for (FX_INT32 w = pLine->m_LineInfo.nBeginWordIndex; w <= pLine->m_LineInfo.nEndWordIndex; w++) { + for (int32_t w = pLine->m_LineInfo.nBeginWordIndex; w <= pLine->m_LineInfo.nEndWordIndex; w++) { if (CPVT_WordInfo * pWord = m_pSection->m_WordArray.GetAt(w)) { pWord->fWordX = fPosX - fMinX; if (pWord->pWordProps) { @@ -855,10 +855,10 @@ void CPDF_VariableText::ResetAll() m_bInitial = FALSE; ResetSectionArray(); } -CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WORD word, FX_INT32 charset, +CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WORD word, int32_t charset, const CPVT_WordProps * pWordProps) { - FX_INT32 nTotlaWords = this->GetTotalWords(); + int32_t nTotlaWords = this->GetTotalWords(); if (m_nLimitChar > 0 && nTotlaWords >= m_nLimitChar) { return place; } @@ -874,7 +874,7 @@ CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WO return AddWord(newplace, CPVT_WordInfo(word, charset, -1, pNewProps)); } } else { - FX_INT32 nFontIndex = GetSubWord() > 0 ? GetDefaultFontIndex() : GetWordFontIndex(word, charset, GetDefaultFontIndex()); + int32_t nFontIndex = GetSubWord() > 0 ? GetDefaultFontIndex() : GetWordFontIndex(word, charset, GetDefaultFontIndex()); return AddWord(newplace, CPVT_WordInfo(word, charset, nFontIndex, NULL)); } return place; @@ -882,7 +882,7 @@ CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WO CPVT_WordPlace CPDF_VariableText::InsertSection(const CPVT_WordPlace & place, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps) { - FX_INT32 nTotlaWords = this->GetTotalWords(); + int32_t nTotlaWords = this->GetTotalWords(); if (m_nLimitChar > 0 && nTotlaWords >= m_nLimitChar) { return place; } @@ -909,7 +909,7 @@ CPVT_WordPlace CPDF_VariableText::InsertSection(const CPVT_WordPlace & place, co AddSection(NewPlace, secinfo); newplace = NewPlace; if (CSection * pNewSection = m_SectionArray.GetAt(NewPlace.nSecIndex)) { - for (FX_INT32 w = wordplace.nWordIndex + 1, sz = pSection->m_WordArray.GetSize(); w < sz; w++) { + for (int32_t w = wordplace.nWordIndex + 1, sz = pSection->m_WordArray.GetSize(); w < sz; w++) { if (CPVT_WordInfo * pWord = pSection->m_WordArray.GetAt(w)) { NewPlace.nWordIndex++; pNewSection->AddWord(NewPlace, *pWord); @@ -920,12 +920,12 @@ CPVT_WordPlace CPDF_VariableText::InsertSection(const CPVT_WordPlace & place, co } return newplace; } -CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace & place, FX_LPCWSTR text, FX_INT32 charset, +CPVT_WordPlace CPDF_VariableText::InsertText(const CPVT_WordPlace & place, FX_LPCWSTR text, int32_t charset, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pProps) { CFX_WideString swText = text; CPVT_WordPlace wp = place; - for (FX_INT32 i = 0, sz = swText.GetLength(); i < sz; i++) { + for (int32_t i = 0, sz = swText.GetLength(); i < sz; i++) { CPVT_WordPlace oldwp = wp; FX_WORD word = swText.GetAt(i); switch (word) { @@ -980,7 +980,7 @@ CPVT_WordPlace CPDF_VariableText::BackSpaceWord(const CPVT_WordPlace & place) { return ClearLeftWord(AjustLineHeader(place, TRUE)); } -void CPDF_VariableText::SetText(FX_LPCWSTR text, FX_INT32 charset, const CPVT_SecProps * pSecProps, +void CPDF_VariableText::SetText(FX_LPCWSTR text, int32_t charset, const CPVT_SecProps * pSecProps, const CPVT_WordProps * pWordProps) { DeleteWords(CPVT_WordRange(GetBeginWordPlace(), GetEndWordPlace())); @@ -998,8 +998,8 @@ void CPDF_VariableText::SetText(FX_LPCWSTR text, FX_INT32 charset, const CPVT_Se if (CSection * pSection = m_SectionArray.GetAt(0)) { pSection->m_SecInfo = secinfo; } - FX_INT32 nCharCount = 0; - for (FX_INT32 i = 0, sz = swText.GetLength(); i < sz; i++) { + int32_t nCharCount = 0; + for (int32_t i = 0, sz = swText.GetLength(); i < sz; i++) { if (m_nLimitChar > 0 && nCharCount >= m_nLimitChar) { break; } @@ -1052,13 +1052,13 @@ void CPDF_VariableText::UpdateWordPlace(CPVT_WordPlace & place) const pSection->UpdateWordPlace(place); } } -FX_INT32 CPDF_VariableText::WordPlaceToWordIndex(const CPVT_WordPlace & place) const +int32_t CPDF_VariableText::WordPlaceToWordIndex(const CPVT_WordPlace & place) const { CPVT_WordPlace newplace = place; UpdateWordPlace(newplace); - FX_INT32 nIndex = 0; - FX_INT32 i = 0; - FX_INT32 sz = 0; + int32_t nIndex = 0; + int32_t i = 0; + int32_t sz = 0; for (i = 0, sz = m_SectionArray.GetSize(); i < sz && i < newplace.nSecIndex; i++) { if (CSection * pSection = m_SectionArray.GetAt(i)) { nIndex += pSection->m_WordArray.GetSize(); @@ -1072,12 +1072,12 @@ FX_INT32 CPDF_VariableText::WordPlaceToWordIndex(const CPVT_WordPlace & place) c } return nIndex; } -CPVT_WordPlace CPDF_VariableText::WordIndexToWordPlace(FX_INT32 index) const +CPVT_WordPlace CPDF_VariableText::WordIndexToWordPlace(int32_t index) const { CPVT_WordPlace place = GetBeginWordPlace(); - FX_INT32 nOldIndex = 0 , nIndex = 0; + int32_t nOldIndex = 0 , nIndex = 0; FX_BOOL bFind = FALSE; - for (FX_INT32 i = 0, sz = m_SectionArray.GetSize(); i < sz; i++) { + 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) { @@ -1159,9 +1159,9 @@ CPVT_WordPlace CPDF_VariableText::SearchWordPlace(const CPDF_Point & point) cons { CPDF_Point pt = OutToIn(point); CPVT_WordPlace place = GetBeginWordPlace(); - FX_INT32 nLeft = 0; - FX_INT32 nRight = m_SectionArray.GetSize() - 1; - FX_INT32 nMid = m_SectionArray.GetSize() / 2; + int32_t nLeft = 0; + int32_t nRight = m_SectionArray.GetSize() - 1; + int32_t nMid = m_SectionArray.GetSize() / 2; FX_BOOL bUp = TRUE; FX_BOOL bDown = TRUE; while (nLeft <= nRight) { @@ -1258,10 +1258,10 @@ CPVT_WordPlace CPDF_VariableText::GetSectionEndPlace(const CPVT_WordPlace & plac } return place; } -FX_INT32 CPDF_VariableText::GetTotalWords() const +int32_t CPDF_VariableText::GetTotalWords() const { - FX_INT32 nTotal = 0; - for (FX_INT32 i = 0, sz = m_SectionArray.GetSize(); i < sz; i++) + int32_t nTotal = 0; + for (int32_t i = 0, sz = m_SectionArray.GetSize(); i < sz; i++) if (CSection * pSection = m_SectionArray.GetAt(i)) { nTotal += (pSection->m_WordArray.GetSize() + PVT_RETURN_LENGTH); } @@ -1269,7 +1269,7 @@ FX_INT32 CPDF_VariableText::GetTotalWords() const } void CPDF_VariableText::ResetSectionArray() { - for (FX_INT32 s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) { + for (int32_t s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) { delete m_SectionArray.GetAt(s); } m_SectionArray.RemoveAll(); @@ -1279,11 +1279,8 @@ CPVT_WordPlace CPDF_VariableText::AddSection(const CPVT_WordPlace & place, const if (IsValid() && !m_bMultiLine) { return place; } - FX_INT32 nSecIndex = FPDF_MAX(FPDF_MIN(place.nSecIndex, m_SectionArray.GetSize()), 0); - CSection * pSection = FX_NEW CSection(this); - if (!pSection) { - return place; - } + int32_t nSecIndex = FPDF_MAX(FPDF_MIN(place.nSecIndex, m_SectionArray.GetSize()), 0); + CSection* pSection = new CSection(this); pSection->m_SecInfo = secinfo; pSection->SecPlace.nSecIndex = nSecIndex; if (nSecIndex == m_SectionArray.GetSize()) { @@ -1361,13 +1358,13 @@ FX_FLOAT CPDF_VariableText::GetWordFontSize(const CPVT_WordInfo & WordInfo, FX_B { return m_bRichText && WordInfo.pWordProps ? (WordInfo.pWordProps->nScriptType == PVTWORD_SCRIPT_NORMAL || bFactFontSize ? WordInfo.pWordProps->fFontSize : WordInfo.pWordProps->fFontSize * PVT_HALF) : GetFontSize(); } -FX_INT32 CPDF_VariableText::GetWordFontIndex(const CPVT_WordInfo & WordInfo) +int32_t CPDF_VariableText::GetWordFontIndex(const CPVT_WordInfo & WordInfo) { return m_bRichText && WordInfo.pWordProps ? WordInfo.pWordProps->nFontIndex : WordInfo.nFontIndex; } -FX_FLOAT CPDF_VariableText::GetWordWidth(FX_INT32 nFontIndex, FX_WORD Word, FX_WORD SubWord, - FX_FLOAT fCharSpace, FX_INT32 nHorzScale, - FX_FLOAT fFontSize, FX_FLOAT fWordTail, FX_INT32 nWordStyle) +FX_FLOAT CPDF_VariableText::GetWordWidth(int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord, + FX_FLOAT fCharSpace, int32_t nHorzScale, + FX_FLOAT fFontSize, FX_FLOAT fWordTail, int32_t nWordStyle) { return (GetCharWidth(nFontIndex, Word, SubWord, nWordStyle) * fFontSize * PVT_FONTSCALE + fCharSpace) * nHorzScale * PVT_PERCENT + fWordTail; } @@ -1387,11 +1384,11 @@ FX_FLOAT CPDF_VariableText::GetLineDescent(const CPVT_SectionInfo & SecInfo) return m_bRichText && SecInfo.pWordProps ? GetFontDescent(SecInfo.pWordProps->nFontIndex, SecInfo.pWordProps->fFontSize) : GetFontDescent(GetDefaultFontIndex(), GetFontSize()); } -FX_FLOAT CPDF_VariableText::GetFontAscent(FX_INT32 nFontIndex, FX_FLOAT fFontSize) +FX_FLOAT CPDF_VariableText::GetFontAscent(int32_t nFontIndex, FX_FLOAT fFontSize) { return (FX_FLOAT)GetTypeAscent(nFontIndex) * fFontSize * PVT_FONTSCALE; } -FX_FLOAT CPDF_VariableText::GetFontDescent(FX_INT32 nFontIndex, FX_FLOAT fFontSize) +FX_FLOAT CPDF_VariableText::GetFontDescent(int32_t nFontIndex, FX_FLOAT fFontSize) { return (FX_FLOAT)GetTypeDescent(nFontIndex) * fFontSize * PVT_FONTSCALE; } @@ -1419,7 +1416,7 @@ FX_FLOAT CPDF_VariableText::GetLineIndent(const CPVT_SectionInfo & SecInfo) { return m_bRichText && SecInfo.pSecProps ? SecInfo.pSecProps->fLineIndent : 0.0f; } -FX_INT32 CPDF_VariableText::GetAlignment(const CPVT_SectionInfo& SecInfo) +int32_t CPDF_VariableText::GetAlignment(const CPVT_SectionInfo& SecInfo) { return m_bRichText && SecInfo.pSecProps ? SecInfo.pSecProps->nAlignment : this->m_nAlignment; } @@ -1427,7 +1424,7 @@ FX_FLOAT CPDF_VariableText::GetCharSpace(const CPVT_WordInfo & WordInfo) { return m_bRichText && WordInfo.pWordProps ? WordInfo.pWordProps->fCharSpace : m_fCharSpace; } -FX_INT32 CPDF_VariableText::GetHorzScale(const CPVT_WordInfo & WordInfo) +int32_t CPDF_VariableText::GetHorzScale(const CPVT_WordInfo & WordInfo) { return m_bRichText && WordInfo.pWordProps ? WordInfo.pWordProps->nHorzScale : m_nHorzScale; } @@ -1435,7 +1432,7 @@ void CPDF_VariableText::ClearSectionRightWords(const CPVT_WordPlace & place) { CPVT_WordPlace wordplace = AjustLineHeader(place, TRUE); if (CSection * pSection = m_SectionArray.GetAt(place.nSecIndex)) { - for (FX_INT32 w = pSection->m_WordArray.GetSize() - 1; w > wordplace.nWordIndex; w--) { + for (int32_t w = pSection->m_WordArray.GetSize() - 1; w > wordplace.nWordIndex; w--) { delete pSection->m_WordArray.GetAt(w); pSection->m_WordArray.RemoveAt(w); } @@ -1469,7 +1466,7 @@ FX_BOOL CPDF_VariableText::ClearEmptySection(const CPVT_WordPlace & place) void CPDF_VariableText::ClearEmptySections(const CPVT_WordRange & PlaceRange) { CPVT_WordPlace wordplace; - for (FX_INT32 s = PlaceRange.EndPos.nSecIndex; s > PlaceRange.BeginPos.nSecIndex; s--) { + for (int32_t s = PlaceRange.EndPos.nSecIndex; s > PlaceRange.BeginPos.nSecIndex; s--) { wordplace.nSecIndex = s; ClearEmptySection(wordplace); } @@ -1479,7 +1476,7 @@ void CPDF_VariableText::LinkLatterSection(const CPVT_WordPlace & place) CPVT_WordPlace oldplace = AjustLineHeader(place, TRUE); if (CSection * pNextSection = m_SectionArray.GetAt(place.nSecIndex + 1)) { if (CSection * pSection = m_SectionArray.GetAt(oldplace.nSecIndex)) { - for (FX_INT32 w = 0, sz = pNextSection->m_WordArray.GetSize(); w < sz; w++) { + for (int32_t w = 0, sz = pNextSection->m_WordArray.GetSize(); w < sz; w++) { if (CPVT_WordInfo * pWord = pNextSection->m_WordArray.GetAt(w)) { oldplace.nWordIndex ++; pSection->AddWord(oldplace, *pWord); @@ -1495,7 +1492,7 @@ void CPDF_VariableText::ClearWords(const CPVT_WordRange & PlaceRange) CPVT_WordRange NewRange; NewRange.BeginPos = AjustLineHeader(PlaceRange.BeginPos, TRUE); NewRange.EndPos = AjustLineHeader(PlaceRange.EndPos, TRUE); - for (FX_INT32 s = NewRange.EndPos.nSecIndex; s >= NewRange.BeginPos.nSecIndex; s--) { + for (int32_t s = NewRange.EndPos.nSecIndex; s >= NewRange.BeginPos.nSecIndex; s--) { if (CSection * pSection = m_SectionArray.GetAt(s)) { pSection->ClearWords(NewRange); } @@ -1558,7 +1555,7 @@ CPVT_FloatRect CPDF_VariableText::Rearrange(const CPVT_WordRange & PlaceRange) } FX_FLOAT CPDF_VariableText::GetAutoFontSize() { - FX_INT32 nTotal = sizeof(gFontSizeSteps) / sizeof(FX_BYTE); + int32_t nTotal = sizeof(gFontSizeSteps) / sizeof(uint8_t); if (IsMultiLine()) { nTotal /= 4; } @@ -1568,9 +1565,9 @@ FX_FLOAT CPDF_VariableText::GetAutoFontSize() if (GetPlateWidth() <= 0) { return 0; } - FX_INT32 nLeft = 0; - FX_INT32 nRight = nTotal - 1; - FX_INT32 nMid = nTotal / 2; + int32_t nLeft = 0; + int32_t nRight = nTotal - 1; + int32_t nMid = nTotal / 2; while (nLeft <= nRight) { if (IsBigger(gFontSizeSteps[nMid])) { nRight = nMid - 1; @@ -1588,7 +1585,7 @@ FX_BOOL CPDF_VariableText::IsBigger(FX_FLOAT fFontSize) { FX_BOOL bBigger = FALSE; CPVT_Size szTotal; - for (FX_INT32 s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) { + for (int32_t s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) { if (CSection * pSection = m_SectionArray.GetAt(s)) { CPVT_Size size = pSection->GetSectionSize(fFontSize); szTotal.x = FPDF_MAX(size.x, szTotal.x); @@ -1608,10 +1605,10 @@ CPVT_FloatRect CPDF_VariableText::RearrangeSections(const CPVT_WordRange & Place CPVT_WordPlace place; FX_FLOAT fPosY = 0; FX_FLOAT fOldHeight; - FX_INT32 nSSecIndex = PlaceRange.BeginPos.nSecIndex; - FX_INT32 nESecIndex = PlaceRange.EndPos.nSecIndex; + int32_t nSSecIndex = PlaceRange.BeginPos.nSecIndex; + int32_t nESecIndex = PlaceRange.EndPos.nSecIndex; CPVT_FloatRect rcRet; - for (FX_INT32 s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) { + for (int32_t s = 0, sz = m_SectionArray.GetSize(); s < sz; s++) { place.nSecIndex = s; if (CSection * pSection = m_SectionArray.GetAt(s)) { pSection->SecPlace = place; @@ -1642,7 +1639,7 @@ CPVT_FloatRect CPDF_VariableText::RearrangeSections(const CPVT_WordRange & Place } return rcRet; } -FX_INT32 CPDF_VariableText::GetCharWidth(FX_INT32 nFontIndex, FX_WORD Word, FX_WORD SubWord, FX_INT32 nWordStyle) +int32_t CPDF_VariableText::GetCharWidth(int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord, int32_t nWordStyle) { if (m_pVTProvider) { if (SubWord > 0) { @@ -1653,19 +1650,19 @@ FX_INT32 CPDF_VariableText::GetCharWidth(FX_INT32 nFontIndex, FX_WORD Word, FX_W } return 0; } -FX_INT32 CPDF_VariableText::GetTypeAscent(FX_INT32 nFontIndex) +int32_t CPDF_VariableText::GetTypeAscent(int32_t nFontIndex) { return m_pVTProvider ? m_pVTProvider->GetTypeAscent(nFontIndex) : 0; } -FX_INT32 CPDF_VariableText::GetTypeDescent(FX_INT32 nFontIndex) +int32_t CPDF_VariableText::GetTypeDescent(int32_t nFontIndex) { return m_pVTProvider ? m_pVTProvider->GetTypeDescent(nFontIndex) : 0; } -FX_INT32 CPDF_VariableText::GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex) +int32_t CPDF_VariableText::GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex) { return m_pVTProvider ? m_pVTProvider->GetWordFontIndex(word, charset, nFontIndex) : -1; } -FX_INT32 CPDF_VariableText::GetDefaultFontIndex() +int32_t CPDF_VariableText::GetDefaultFontIndex() { return m_pVTProvider ? m_pVTProvider->GetDefaultFontIndex() : -1; } @@ -1694,7 +1691,7 @@ CPDF_VariableText_Iterator::CPDF_VariableText_Iterator(CPDF_VariableText * pVT): CPDF_VariableText_Iterator::~CPDF_VariableText_Iterator() { } -void CPDF_VariableText_Iterator::SetAt(FX_INT32 nWordIndex) +void CPDF_VariableText_Iterator::SetAt(int32_t nWordIndex) { ASSERT(m_pVT != NULL); m_CurPos = m_pVT->WordIndexToWordPlace(nWordIndex); diff --git a/core/src/fpdfdoc/pdf_vt.h b/core/src/fpdfdoc/pdf_vt.h index 9c38ffc00c..5d8b20cf52 100644 --- a/core/src/fpdfdoc/pdf_vt.h +++ b/core/src/fpdfdoc/pdf_vt.h @@ -118,7 +118,7 @@ struct CPVT_SectionInfo { } } CPVT_FloatRect rcSection; - FX_INT32 nTotalLine; + int32_t nTotalLine; CPVT_SecProps* pSecProps; CPVT_WordProps* pWordProps; }; @@ -127,9 +127,9 @@ struct CPVT_LineInfo { fLineX(0.0f), fLineY(0.0f), fLineWidth(0.0f), fLineAscent(0.0f), fLineDescent(0.0f) { } - FX_INT32 nTotalWord; - FX_INT32 nBeginWordIndex; - FX_INT32 nEndWordIndex; + int32_t nTotalWord; + int32_t nBeginWordIndex; + int32_t nEndWordIndex; FX_FLOAT fLineX; FX_FLOAT fLineY; FX_FLOAT fLineWidth; @@ -141,7 +141,7 @@ struct CPVT_WordInfo { fWordX(0.0f), fWordY(0.0f), fWordTail(0.0f), nFontIndex(-1), pWordProps(NULL) { } - CPVT_WordInfo(FX_WORD word, FX_INT32 charset, FX_INT32 fontIndex, CPVT_WordProps * pProps): + CPVT_WordInfo(FX_WORD word, int32_t charset, int32_t fontIndex, CPVT_WordProps * pProps): Word(word), nCharset(charset), fWordX(0.0f), fWordY(0.0f), fWordTail(0.0f), nFontIndex(fontIndex), pWordProps(pProps) { @@ -174,11 +174,11 @@ struct CPVT_WordInfo { } } FX_WORD Word; - FX_INT32 nCharset; + int32_t nCharset; FX_FLOAT fWordX; FX_FLOAT fWordY; FX_FLOAT fWordTail; - FX_INT32 nFontIndex; + int32_t nFontIndex; CPVT_WordProps* pWordProps; }; struct CPVT_FloatRange { @@ -235,11 +235,11 @@ public: { RemoveAll(); } - FX_INT32 GetSize() const + int32_t GetSize() const { return m_Lines.GetSize(); } - CLine * GetAt(FX_INT32 nIndex) const + CLine * GetAt(int32_t nIndex) const { return m_Lines.GetAt(nIndex); } @@ -249,13 +249,13 @@ public: } void RemoveAll() { - for (FX_INT32 i = 0, sz = GetSize(); i < sz; i++) { + for (int32_t i = 0, sz = GetSize(); i < sz; i++) { delete GetAt(i); } m_Lines.RemoveAll(); m_nTotal = 0; } - FX_INT32 Add(const CPVT_LineInfo & lineinfo) + int32_t Add(const CPVT_LineInfo & lineinfo) { if (m_nTotal >= GetSize()) { if (CLine * pLine = FX_NEW CLine) { @@ -273,14 +273,14 @@ public: } void Clear() { - for (FX_INT32 i = GetSize() - 1; i >= m_nTotal; i--) { + for (int32_t i = GetSize() - 1; i >= m_nTotal; i--) { delete GetAt(i); m_Lines.RemoveAt(i); } } private: CPVT_ArrayTemplate m_Lines; - FX_INT32 m_nTotal; + int32_t m_nTotal; }; class CSection { @@ -312,9 +312,9 @@ public: CLines m_LineArray; CPVT_ArrayTemplate m_WordArray; private: - void ClearLeftWords(FX_INT32 nWordIndex); - void ClearRightWords(FX_INT32 nWordIndex); - void ClearMidWords(FX_INT32 nBeginIndex, FX_INT32 nEndIndex); + void ClearLeftWords(int32_t nWordIndex); + void ClearRightWords(int32_t nWordIndex); + void ClearMidWords(int32_t nBeginIndex, int32_t nEndIndex); CPDF_VariableText *m_pVT; }; @@ -414,7 +414,7 @@ public: { CPDF_EditContainer::SetPlateRect(rect); } - void SetAlignment(FX_INT32 nFormat = 0) + void SetAlignment(int32_t nFormat = 0) { m_nAlignment = nFormat; } @@ -422,7 +422,7 @@ public: { m_wSubWord = wSubWord; } - void SetLimitChar(FX_INT32 nLimitChar = 0) + void SetLimitChar(int32_t nLimitChar = 0) { m_nLimitChar = nLimitChar; } @@ -430,7 +430,7 @@ public: { m_fCharSpace = fCharSpace; } - void SetHorzScale(FX_INT32 nHorzScale = 100) + void SetHorzScale(int32_t nHorzScale = 100) { m_nHorzScale = nHorzScale; } @@ -446,7 +446,7 @@ public: { m_fFontSize = fFontSize; } - void SetCharArray(FX_INT32 nCharArray = 0) + void SetCharArray(int32_t nCharArray = 0) { m_nCharArray = nCharArray; } @@ -474,13 +474,13 @@ public: void RearrangeAll(); void RearrangePart(const CPVT_WordRange & PlaceRange); void ResetAll(); - void SetText(FX_LPCWSTR text, FX_INT32 charset = 1, const CPVT_SecProps * pSecProps = NULL, + void SetText(FX_LPCWSTR text, int32_t charset = 1, const CPVT_SecProps * pSecProps = NULL, const CPVT_WordProps * pWordProps = NULL); - CPVT_WordPlace InsertWord(const CPVT_WordPlace & place, FX_WORD word, FX_INT32 charset = 1, + CPVT_WordPlace InsertWord(const CPVT_WordPlace & place, FX_WORD word, int32_t charset = 1, const CPVT_WordProps * pWordProps = NULL); CPVT_WordPlace InsertSection(const CPVT_WordPlace & place, const CPVT_SecProps * pSecProps = NULL, const CPVT_WordProps * pWordProps = NULL); - CPVT_WordPlace InsertText(const CPVT_WordPlace & place, FX_LPCWSTR text, FX_INT32 charset = 1, + CPVT_WordPlace InsertText(const CPVT_WordPlace & place, FX_LPCWSTR text, int32_t charset = 1, const CPVT_SecProps * pSecProps = NULL, const CPVT_WordProps * pWordProps = NULL); CPVT_WordPlace DeleteWords(const CPVT_WordRange & PlaceRange); CPVT_WordPlace DeleteWord(const CPVT_WordPlace & place); @@ -490,20 +490,20 @@ public: return CPDF_EditContainer::GetPlateRect(); } CPDF_Rect GetContentRect() const; - FX_INT32 GetTotalWords() const; + int32_t GetTotalWords() const; FX_FLOAT GetFontSize() const { return m_fFontSize; } - FX_INT32 GetAlignment() const + int32_t GetAlignment() const { return m_nAlignment; } - FX_INT32 GetCharArray() const + int32_t GetCharArray() const { return m_nCharArray; } - FX_INT32 GetLimitChar() const + int32_t GetLimitChar() const { return m_nLimitChar; } @@ -511,7 +511,7 @@ public: { return m_bMultiLine; } - FX_INT32 GetHorzScale() const + int32_t GetHorzScale() const { return m_nHorzScale; } @@ -532,8 +532,8 @@ public: CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace & place) const; CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace & place) const; void UpdateWordPlace(CPVT_WordPlace & place) const; - FX_INT32 WordPlaceToWordIndex(const CPVT_WordPlace & place) const; - CPVT_WordPlace WordIndexToWordPlace(FX_INT32 index) const; + int32_t WordPlaceToWordIndex(const CPVT_WordPlace & place) const; + CPVT_WordPlace WordIndexToWordPlace(int32_t index) const; FX_WORD GetPasswordChar() const { return GetSubWord(); @@ -543,11 +543,11 @@ public: return m_wSubWord; } private: - FX_INT32 GetCharWidth(FX_INT32 nFontIndex, FX_WORD Word, FX_WORD SubWord, FX_INT32 nWordStyle); - FX_INT32 GetTypeAscent(FX_INT32 nFontIndex); - FX_INT32 GetTypeDescent(FX_INT32 nFontIndex); - FX_INT32 GetWordFontIndex(FX_WORD word, FX_INT32 charset, FX_INT32 nFontIndex); - FX_INT32 GetDefaultFontIndex(); + int32_t GetCharWidth(int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord, int32_t nWordStyle); + int32_t GetTypeAscent(int32_t nFontIndex); + int32_t GetTypeDescent(int32_t nFontIndex); + int32_t GetWordFontIndex(FX_WORD word, int32_t charset, int32_t nFontIndex); + int32_t GetDefaultFontIndex(); FX_BOOL IsLatinWord(FX_WORD word); private: @@ -559,9 +559,9 @@ private: FX_BOOL GetLineInfo(const CPVT_WordPlace & place, CPVT_LineInfo & lineinfo); FX_BOOL GetSectionInfo(const CPVT_WordPlace & place, CPVT_SectionInfo & secinfo); FX_FLOAT GetWordFontSize(const CPVT_WordInfo & WordInfo, FX_BOOL bFactFontSize = FALSE); - FX_FLOAT GetWordWidth(FX_INT32 nFontIndex, FX_WORD Word, FX_WORD SubWord, - FX_FLOAT fCharSpace, FX_INT32 nHorzScale, - FX_FLOAT fFontSize, FX_FLOAT fWordTail, FX_INT32 nWordStyle); + FX_FLOAT GetWordWidth(int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord, + FX_FLOAT fCharSpace, int32_t nHorzScale, + FX_FLOAT fFontSize, FX_FLOAT fWordTail, int32_t nWordStyle); FX_FLOAT GetWordWidth(const CPVT_WordInfo & WordInfo); FX_FLOAT GetWordAscent(const CPVT_WordInfo & WordInfo, FX_FLOAT fFontSize); FX_FLOAT GetWordDescent(const CPVT_WordInfo & WordInfo, FX_FLOAT fFontSize); @@ -569,14 +569,14 @@ private: FX_FLOAT GetWordDescent(const CPVT_WordInfo & WordInfo, FX_BOOL bFactFontSize = FALSE); FX_FLOAT GetLineAscent(const CPVT_SectionInfo & SecInfo); FX_FLOAT GetLineDescent(const CPVT_SectionInfo & SecInfo); - FX_FLOAT GetFontAscent(FX_INT32 nFontIndex, FX_FLOAT fFontSize); - FX_FLOAT GetFontDescent(FX_INT32 nFontIndex, FX_FLOAT fFontSize); - FX_INT32 GetWordFontIndex(const CPVT_WordInfo & WordInfo); + FX_FLOAT GetFontAscent(int32_t nFontIndex, FX_FLOAT fFontSize); + FX_FLOAT GetFontDescent(int32_t nFontIndex, FX_FLOAT fFontSize); + int32_t GetWordFontIndex(const CPVT_WordInfo & WordInfo); FX_FLOAT GetCharSpace(const CPVT_WordInfo & WordInfo); - FX_INT32 GetHorzScale(const CPVT_WordInfo & WordInfo); + int32_t GetHorzScale(const CPVT_WordInfo & WordInfo); FX_FLOAT GetLineLeading(const CPVT_SectionInfo & SecInfo); FX_FLOAT GetLineIndent(const CPVT_SectionInfo & SecInfo); - FX_INT32 GetAlignment(const CPVT_SectionInfo& SecInfo); + int32_t GetAlignment(const CPVT_SectionInfo& SecInfo); void ClearSectionRightWords(const CPVT_WordPlace & place); CPVT_WordPlace AjustLineHeader(const CPVT_WordPlace & place, FX_BOOL bPrevOrNext) const; @@ -595,15 +595,15 @@ private: void ResetSectionArray(); private: CPVT_ArrayTemplate m_SectionArray; - FX_INT32 m_nLimitChar; - FX_INT32 m_nCharArray; + int32_t m_nLimitChar; + int32_t m_nCharArray; FX_BOOL m_bMultiLine; FX_BOOL m_bLimitWidth; FX_BOOL m_bAutoFontSize; - FX_INT32 m_nAlignment; + int32_t m_nAlignment; FX_FLOAT m_fLineLeading; FX_FLOAT m_fCharSpace; - FX_INT32 m_nHorzScale; + int32_t m_nHorzScale; FX_WORD m_wSubWord; FX_FLOAT m_fFontSize; @@ -629,7 +629,7 @@ public: FX_BOOL GetLine(CPVT_Line & line) const; FX_BOOL GetSection(CPVT_Section & section) const; FX_BOOL SetSection(const CPVT_Section & section); - void SetAt(FX_INT32 nWordIndex); + void SetAt(int32_t nWordIndex); void SetAt(const CPVT_WordPlace & place); const CPVT_WordPlace & GetAt() const { -- cgit v1.2.3