summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-05-19 10:51:56 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-19 10:51:56 -0700
commitbc9164115e8aeefcc06f5bf08684a4733b25e085 (patch)
tree5cba0c100b9a89809923a42e6668d71f6d0a3ff2
parentd89fcb8f68162eef6111ce35133c80b2f7db0414 (diff)
downloadpdfium-bc9164115e8aeefcc06f5bf08684a4733b25e085.tar.xz
Cleanup unused fgas/ code.
Purely code removal. Review-Url: https://codereview.chromium.org/1991143003
-rw-r--r--BUILD.gn2
-rw-r--r--xfa.gyp2
-rw-r--r--xfa/fgas/crt/fgas_utils.h7
-rw-r--r--xfa/fgas/font/fgas_stdfontmgr.h2
-rw-r--r--xfa/fgas/layout/fgas_linebreak.cpp52
-rw-r--r--xfa/fgas/layout/fgas_linebreak.h7
-rw-r--r--xfa/fgas/layout/fgas_unicode.cpp68
-rw-r--r--xfa/fgas/layout/fgas_unicode.h19
-rw-r--r--xfa/fgas/localization/fgas_locale.cpp215
-rw-r--r--xfa/fgas/localization/fgas_locale.h5
-rw-r--r--xfa/fgas/localization/fgas_localeimp.h33
-rw-r--r--xfa/fgas/localization/fgas_localemgr.cpp96
-rw-r--r--xfa/fgas/localization/fgas_localemgr.h30
13 files changed, 3 insertions, 535 deletions
diff --git a/BUILD.gn b/BUILD.gn
index b1ecc04a32..7541de8aaa 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -984,8 +984,6 @@ if (pdf_enable_xfa) {
"xfa/fgas/localization/fgas_locale.cpp",
"xfa/fgas/localization/fgas_locale.h",
"xfa/fgas/localization/fgas_localeimp.h",
- "xfa/fgas/localization/fgas_localemgr.cpp",
- "xfa/fgas/localization/fgas_localemgr.h",
"xfa/fgas/xml/fgas_sax.cpp",
"xfa/fgas/xml/fgas_sax.h",
"xfa/fwl/basewidget/fwl_barcodeimp.cpp",
diff --git a/xfa.gyp b/xfa.gyp
index 9387629fad..f47e9e8c5e 100644
--- a/xfa.gyp
+++ b/xfa.gyp
@@ -125,8 +125,6 @@
"xfa/fgas/localization/fgas_locale.cpp",
"xfa/fgas/localization/fgas_locale.h",
"xfa/fgas/localization/fgas_localeimp.h",
- "xfa/fgas/localization/fgas_localemgr.cpp",
- "xfa/fgas/localization/fgas_localemgr.h",
"xfa/fgas/xml/fgas_sax.cpp",
"xfa/fgas/xml/fgas_sax.h",
"xfa/fwl/basewidget/fwl_barcodeimp.cpp",
diff --git a/xfa/fgas/crt/fgas_utils.h b/xfa/fgas/crt/fgas_utils.h
index 24224a02f0..56fa018ad4 100644
--- a/xfa/fgas/crt/fgas_utils.h
+++ b/xfa/fgas/crt/fgas_utils.h
@@ -80,9 +80,7 @@ class CFX_BaseArrayTemplate : public CFX_BaseArray {
CFX_BaseArray::RemoveAll(bLeaveMemory);
}
};
-typedef CFX_BaseArrayTemplate<void*> CFDE_PtrArray;
typedef CFX_BaseArrayTemplate<uint32_t> CFDE_DWordArray;
-typedef CFX_BaseArrayTemplate<uint16_t> CFDE_WordArray;
template <class baseType>
class CFX_ObjectBaseArrayTemplate : public CFX_BaseArray {
@@ -277,12 +275,7 @@ class CFX_MassArrayTemplate : public CFX_BaseMassArray {
CFX_BaseMassArray::RemoveAll(bLeaveMemory);
}
};
-typedef CFX_MassArrayTemplate<void*> CFX_PtrMassArray;
-typedef CFX_MassArrayTemplate<int32_t> CFX_Int32MassArray;
-typedef CFX_MassArrayTemplate<uint32_t> CFX_DWordMassArray;
-typedef CFX_MassArrayTemplate<uint16_t> CFX_WordMassArray;
typedef CFX_MassArrayTemplate<CFX_Rect> CFX_RectMassArray;
-typedef CFX_MassArrayTemplate<CFX_RectF> CFX_RectFMassArray;
template <class baseType>
class CFX_ObjectMassArrayTemplate : public CFX_BaseMassArray {
diff --git a/xfa/fgas/font/fgas_stdfontmgr.h b/xfa/fgas/font/fgas_stdfontmgr.h
index e66dd3131a..268c61f6ea 100644
--- a/xfa/fgas/font/fgas_stdfontmgr.h
+++ b/xfa/fgas/font/fgas_stdfontmgr.h
@@ -149,8 +149,6 @@ typedef CFX_MapPtrTemplate<uint32_t, CFX_FontDescriptorInfos*>
typedef CFX_MapPtrTemplate<uint32_t, CFX_ArrayTemplate<IFX_Font*>*>
CFX_HashFontsMap;
typedef CFX_MapPtrTemplate<FX_WCHAR, IFX_Font*> CFX_UnicodeFontMap;
-typedef CFX_MapPtrTemplate<IFX_FileAccess*, CFX_ArrayTemplate<IFX_Font*>*>
- CFX_FileFontMap;
typedef CFX_MapPtrTemplate<IFX_Font*, IFX_FileRead*> CFX_FonStreamtMap;
class CFX_FontMgrImp : public IFX_FontMgr {
diff --git a/xfa/fgas/layout/fgas_linebreak.cpp b/xfa/fgas/layout/fgas_linebreak.cpp
index 72f5d70323..519ccc590a 100644
--- a/xfa/fgas/layout/fgas_linebreak.cpp
+++ b/xfa/fgas/layout/fgas_linebreak.cpp
@@ -266,55 +266,3 @@ const FX_LINEBREAKTYPE gs_FX_LineBreak_PairTable[64][32] = {
FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN,
FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN, FX_LBUN},
};
-
-void FX_GetLineBreakPositions(const FX_WCHAR* pwsText,
- FX_LINEBREAKTYPE* pBrkType,
- int32_t iLength) {
- if (iLength < 2) {
- return;
- }
- uint32_t dwCur, dwNext;
- FX_WCHAR wch;
- wch = *pwsText++;
- dwCur = kTextLayoutCodeProperties[(uint16_t)wch] & 0x003F;
- iLength--;
- for (int32_t i = 0; i < iLength; i++) {
- wch = *pwsText++;
- dwNext = kTextLayoutCodeProperties[(uint16_t)wch] & 0x003F;
- if (dwNext == FX_CBP_SP) {
- pBrkType[i] = FX_LBT_PROHIBITED_BRK;
- } else {
- pBrkType[i] = *((const FX_LINEBREAKTYPE*)gs_FX_LineBreak_PairTable +
- (dwCur << 5) + dwNext);
- }
- dwCur = dwNext;
- }
- pBrkType[iLength] = FX_LBT_INDIRECT_BRK;
-}
-void FX_GetLineBreakPositions(const FX_WCHAR* pwsText,
- int32_t iLength,
- CFX_Int32MassArray& bp) {
- if (iLength < 2) {
- return;
- }
- FX_LINEBREAKTYPE eType;
- uint32_t dwCur, dwNext;
- FX_WCHAR wch;
- wch = *pwsText++;
- dwCur = kTextLayoutCodeProperties[(uint16_t)wch] & 0x003F;
- iLength--;
- for (int32_t i = 0; i < iLength; i++) {
- wch = *pwsText++;
- dwNext = kTextLayoutCodeProperties[(uint16_t)wch] & 0x003F;
- if (dwNext == FX_CBP_SP) {
- eType = FX_LBT_PROHIBITED_BRK;
- } else {
- eType = *((const FX_LINEBREAKTYPE*)gs_FX_LineBreak_PairTable +
- (dwCur << 5) + dwNext);
- }
- if (eType == FX_LBT_DIRECT_BRK) {
- bp.Add(i);
- }
- dwCur = dwNext;
- }
-}
diff --git a/xfa/fgas/layout/fgas_linebreak.h b/xfa/fgas/layout/fgas_linebreak.h
index 1333937db1..a96841ef7e 100644
--- a/xfa/fgas/layout/fgas_linebreak.h
+++ b/xfa/fgas/layout/fgas_linebreak.h
@@ -30,11 +30,4 @@ enum FX_LINEBREAKTYPE : uint8_t {
extern const FX_LINEBREAKTYPE gs_FX_LineBreak_PairTable[64][32];
-void FX_GetLineBreakPositions(const FX_WCHAR* pwsText,
- FX_LINEBREAKTYPE* pBrkType,
- int32_t iLength);
-void FX_GetLineBreakPositions(const FX_WCHAR* pwsText,
- int32_t iLength,
- CFX_Int32MassArray& bp);
-
#endif // XFA_FGAS_LAYOUT_FGAS_LINEBREAK_H_
diff --git a/xfa/fgas/layout/fgas_unicode.cpp b/xfa/fgas/layout/fgas_unicode.cpp
index 94f06253ac..10fdbf0810 100644
--- a/xfa/fgas/layout/fgas_unicode.cpp
+++ b/xfa/fgas/layout/fgas_unicode.cpp
@@ -47,71 +47,3 @@ void FX_TEXTLAYOUT_PieceSort(CFX_TPOArray& tpos, int32_t iStart, int32_t iEnd) {
FX_TEXTLAYOUT_PieceSort(tpos, j, iEnd);
}
}
-static const FX_JAPCHARPROPERTYEX gs_FX_JapCharPropertysEx[] = {
- {0x3001, 0x13}, {0x3002, 0x13}, {0x3041, 0x23}, {0x3043, 0x23},
- {0x3045, 0x23}, {0x3047, 0x23}, {0x3049, 0x23}, {0x3063, 0x23},
- {0x3083, 0x23}, {0x3085, 0x23}, {0x3087, 0x23}, {0x308E, 0x23},
- {0x3095, 0x23}, {0x3096, 0x23}, {0x30A1, 0x23}, {0x30A3, 0x23},
- {0x30A5, 0x23}, {0x30A7, 0x23}, {0x30A9, 0x23}, {0x30C3, 0x23},
- {0x30E3, 0x23}, {0x30E5, 0x23}, {0x30E7, 0x23}, {0x30EE, 0x23},
- {0x30F5, 0x23}, {0x30F6, 0x23}, {0x30FB, 0x22}, {0x31F0, 0x23},
- {0x31F1, 0x23}, {0x31F2, 0x23}, {0x31F3, 0x23}, {0x31F4, 0x23},
- {0x31F5, 0x23}, {0x31F6, 0x23}, {0x31F7, 0x23}, {0x31F8, 0x23},
- {0x31F9, 0x23}, {0x31FA, 0x23}, {0x31FB, 0x23}, {0x31FC, 0x23},
- {0x31FD, 0x23}, {0x31FE, 0x23}, {0x31FF, 0x23},
-};
-const FX_JAPCHARPROPERTYEX* FX_GetJapCharPropertyEx(FX_WCHAR wch) {
- int32_t iStart = 0;
- int32_t iEnd =
- sizeof(gs_FX_JapCharPropertysEx) / sizeof(FX_JAPCHARPROPERTYEX);
- while (iStart <= iEnd) {
- int32_t iMid = (iStart + iEnd) / 2;
- FX_WCHAR wJapChar = gs_FX_JapCharPropertysEx[iMid].wChar;
- if (wch == wJapChar) {
- return gs_FX_JapCharPropertysEx + iMid;
- } else if (wch < wJapChar) {
- iEnd = iMid - 1;
- } else {
- iStart = iMid + 1;
- }
- }
- return NULL;
-}
-FX_BOOL FX_AdjustJapCharDisplayPos(FX_WCHAR wch,
- FX_BOOL bMBCSCode,
- IFX_Font* pFont,
- FX_FLOAT fFontSize,
- FX_BOOL bVertical,
- CFX_PointF& ptOffset) {
- if (pFont == NULL || !bVertical) {
- return FALSE;
- }
- if (wch < 0x3001 || wch > 0x31FF) {
- return FALSE;
- }
- const FX_JAPCHARPROPERTYEX* pJapChar = FX_GetJapCharPropertyEx(wch);
- if (pJapChar == NULL) {
- return FALSE;
- }
- CFX_Rect rtBBox;
- rtBBox.Reset();
- if (pFont->GetCharBBox(wch, rtBBox, bMBCSCode)) {
- switch (pJapChar->uAlign & 0xF0) {
- case FX_JAPCHARPROPERTYEX_Top:
- ptOffset.y = fFontSize * (1000 - rtBBox.height) / 1200.0f;
- break;
- case FX_JAPCHARPROPERTYEX_Middle:
- ptOffset.y = fFontSize * (1000 - rtBBox.height) / 6000.0f;
- break;
- }
- switch (pJapChar->uAlign & 0x0F) {
- case FX_JAPCHARPROPERTYEX_Center:
- ptOffset.x = fFontSize * (600 - rtBBox.right()) / 1000.0f;
- break;
- case FX_JAPCHARPROPERTYEX_Right:
- ptOffset.x = fFontSize * (950 - rtBBox.right()) / 1000.0f;
- break;
- }
- }
- return TRUE;
-}
diff --git a/xfa/fgas/layout/fgas_unicode.h b/xfa/fgas/layout/fgas_unicode.h
index dd574026c9..139547468c 100644
--- a/xfa/fgas/layout/fgas_unicode.h
+++ b/xfa/fgas/layout/fgas_unicode.h
@@ -10,13 +10,6 @@
#include "xfa/fgas/crt/fgas_utils.h"
#include "xfa/fgas/font/fgas_font.h"
-#define FX_JAPCHARPROPERTYEX_Left 0x01
-#define FX_JAPCHARPROPERTYEX_Center 0x02
-#define FX_JAPCHARPROPERTYEX_Right 0x03
-#define FX_JAPCHARPROPERTYEX_Top 0x10
-#define FX_JAPCHARPROPERTYEX_Middle 0x20
-#define FX_JAPCHARPROPERTYEX_Bottom 0x30
-
struct FX_TPO {
int32_t index;
int32_t pos;
@@ -25,23 +18,11 @@ typedef CFX_MassArrayTemplate<FX_TPO> CFX_TPOArray;
void FX_TEXTLAYOUT_PieceSort(CFX_TPOArray& tpos, int32_t iStart, int32_t iEnd);
-struct FX_JAPCHARPROPERTYEX {
- uint16_t wChar;
- uint8_t uAlign;
-};
-
-const FX_JAPCHARPROPERTYEX* FX_GetJapCharPropertyEx(FX_WCHAR wch);
typedef FX_BOOL (*FX_AdjustCharDisplayPos)(FX_WCHAR wch,
FX_BOOL bMBCSCode,
IFX_Font* pFont,
FX_FLOAT fFontSize,
FX_BOOL bVertical,
CFX_PointF& ptOffset);
-FX_BOOL FX_AdjustJapCharDisplayPos(FX_WCHAR wch,
- FX_BOOL bMBCSCode,
- IFX_Font* pFont,
- FX_FLOAT fFontSize,
- FX_BOOL bVertical,
- CFX_PointF& ptOffset);
#endif // XFA_FGAS_LAYOUT_FGAS_UNICODE_H_
diff --git a/xfa/fgas/localization/fgas_locale.cpp b/xfa/fgas/localization/fgas_locale.cpp
index bb4fe93ba3..6eed202643 100644
--- a/xfa/fgas/localization/fgas_locale.cpp
+++ b/xfa/fgas/localization/fgas_locale.cpp
@@ -65,114 +65,6 @@ static const FX_WCHAR* const gs_LocalNumberSymbols[] = {
L"zero", L"currencySymbol", L"currencyName",
};
-IFX_Locale* IFX_Locale::Create(CXML_Element* pLocaleData) {
- return new CFX_Locale(pLocaleData);
-}
-CFX_Locale::CFX_Locale(CXML_Element* pLocaleData) {
- m_pElement = pLocaleData;
-}
-CFX_Locale::~CFX_Locale() {}
-CFX_WideString CFX_Locale::GetName() {
- return CFX_WideString();
-}
-static CFX_WideString FX_GetXMLContent(const CFX_ByteStringC& bsSpace,
- CXML_Element* pxmlElement,
- const CFX_ByteStringC& bsTag,
- const CFX_WideStringC& wsName) {
- CXML_Element* pDatePattern = NULL;
- int32_t nCount = pxmlElement->CountElements(bsSpace, bsTag);
- int32_t i = 0;
- for (; i < nCount; i++) {
- pDatePattern = pxmlElement->GetElement(bsSpace, bsTag, i);
- if (pDatePattern->GetAttrValue("name") == wsName) {
- break;
- }
- }
- if (i < nCount && pDatePattern) {
- return pDatePattern->GetContent(0);
- }
- return L"";
-}
-void CFX_Locale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType,
- CFX_WideString& wsNumSymbol) const {
- if (!m_pElement) {
- return;
- }
- CFX_ByteString bsSpace;
- CFX_WideString wsName = gs_LocalNumberSymbols[eType];
- CXML_Element* pNumberSymbols =
- m_pElement->GetElement(bsSpace.AsStringC(), "numberSymbols");
- if (!pNumberSymbols) {
- return;
- }
- wsNumSymbol = FX_GetXMLContent(bsSpace.AsStringC(), pNumberSymbols,
- "numberSymbol", wsName.AsStringC());
-}
-void CFX_Locale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const {
- if (!m_pElement) {
- return;
- }
- CFX_ByteString bsSpace;
- CXML_Element* pNumberSymbols =
- m_pElement->GetElement(bsSpace.AsStringC(), "dateTimeSymbols");
- if (!pNumberSymbols) {
- return;
- }
- wsDtSymbol = pNumberSymbols->GetContent(0);
-}
-static void FX_GetCalendarSymbol(CXML_Element* pXmlElement,
- const CFX_ByteString& symbol_type,
- int32_t index,
- FX_BOOL bAbbr,
- CFX_WideString& wsName) {
- CFX_ByteString bsSpace;
- CFX_ByteString pstrSymbolNames = symbol_type + "Names";
- CXML_Element* pChild =
- pXmlElement->GetElement(bsSpace.AsStringC(), "calendarSymbols");
- if (!pChild) {
- return;
- }
- CXML_Element* pSymbolNames =
- pChild->GetElement(bsSpace.AsStringC(), pstrSymbolNames.AsStringC());
- if (!pSymbolNames) {
- return;
- }
- if (pSymbolNames->GetAttrInteger("abbr") != bAbbr) {
- pSymbolNames =
- pChild->GetElement(bsSpace.AsStringC(), pstrSymbolNames.AsStringC(), 1);
- }
- if (pSymbolNames && pSymbolNames->GetAttrInteger("abbr") == bAbbr) {
- CXML_Element* pSymbolName = pSymbolNames->GetElement(
- bsSpace.AsStringC(), symbol_type.AsStringC(), index);
- if (pSymbolName) {
- wsName = pSymbolName->GetContent(0);
- }
- }
-}
-void CFX_Locale::GetMonthName(int32_t nMonth,
- CFX_WideString& wsMonthName,
- FX_BOOL bAbbr) const {
- if (!m_pElement) {
- return;
- }
- FX_GetCalendarSymbol(m_pElement, "month", nMonth, bAbbr, wsMonthName);
-}
-void CFX_Locale::GetDayName(int32_t nWeek,
- CFX_WideString& wsDayName,
- FX_BOOL bAbbr) const {
- if (!m_pElement) {
- return;
- }
- FX_GetCalendarSymbol(m_pElement, "day", nWeek, bAbbr, wsDayName);
-}
-void CFX_Locale::GetMeridiemName(CFX_WideString& wsMeridiemName,
- FX_BOOL bAM) const {
- if (!m_pElement) {
- return;
- }
- FX_GetCalendarSymbol(m_pElement, "meridiem", bAM ? 0 : 1, FALSE,
- wsMeridiemName);
-}
static int32_t FX_ParseTimeZone(const FX_WCHAR* pStr,
int32_t iLen,
FX_TIMEZONE& tz) {
@@ -198,64 +90,7 @@ static int32_t FX_ParseTimeZone(const FX_WCHAR* pStr,
}
return iStart;
}
-void CFX_Locale::GetTimeZone(FX_TIMEZONE& tz) const {
- tz.tzHour = 0;
- tz.tzMinute = 0;
- if (!m_pElement) {
- return;
- }
- CXML_Element* pxmlTimeZone = m_pElement->GetElement("", "timeZone");
- if (pxmlTimeZone) {
- CFX_WideString wsTimeZone = pxmlTimeZone->GetContent(0);
- FX_ParseTimeZone(wsTimeZone.c_str(), wsTimeZone.GetLength(), tz);
- }
-}
-void CFX_Locale::GetEraName(CFX_WideString& wsEraName, FX_BOOL bAD) const {
- if (!m_pElement) {
- return;
- }
- FX_GetCalendarSymbol(m_pElement, "era", bAD ? 0 : 1, FALSE, wsEraName);
-}
-static void FX_GetPattern(CXML_Element* pXmlElement,
- const CFX_ByteString& bsCategory,
- const CFX_WideString& wsSubCategory,
- CFX_WideString& wsPattern) {
- CFX_ByteString bsSpace;
- CXML_Element* pDatePatterns = pXmlElement->GetElement(
- bsSpace.AsStringC(), (bsCategory + "s").AsStringC());
- if (!pDatePatterns) {
- return;
- }
- wsPattern =
- FX_GetXMLContent(bsSpace.AsStringC(), pDatePatterns,
- bsCategory.AsStringC(), wsSubCategory.AsStringC());
-}
-static void FX_GetDateTimePattern(CXML_Element* pXmlElement,
- const CFX_ByteString& bsCategory,
- FX_LOCALEDATETIMESUBCATEGORY eType,
- CFX_WideString& wsPattern) {
- CFX_WideString wsType = g_FXLocaleDateTimeSubCatData[eType].pName;
- FX_GetPattern(pXmlElement, bsCategory, wsType, wsPattern);
-}
-void CFX_Locale::GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
- CFX_WideString& wsPattern) const {
- if (!m_pElement) {
- return;
- }
- FX_GetDateTimePattern(m_pElement, "datePattern", eType, wsPattern);
-}
-void CFX_Locale::GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
- CFX_WideString& wsPattern) const {
- if (!m_pElement) {
- return;
- }
- FX_GetDateTimePattern(m_pElement, "timePattern", eType, wsPattern);
-}
-void CFX_Locale::GetNumPattern(FX_LOCALENUMSUBCATEGORY eType,
- CFX_WideString& wsPattern) const {
- CFX_WideString wsType = g_FXLocaleNumSubCatData[eType].pName;
- FX_GetPattern(m_pElement, "numberPattern", wsType, wsPattern);
-}
+
static FX_BOOL FX_IsDigit(FX_WCHAR c) {
return c >= '0' && c <= '9';
}
@@ -1605,53 +1440,7 @@ FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum,
fValue = (FX_FLOAT)dbRetValue;
return TRUE;
}
-void FX_ParseNumString(const CFX_WideString& wsNum, CFX_WideString& wsResult) {
- int32_t iCount = wsNum.GetLength();
- const FX_WCHAR* pStr = wsNum.c_str();
- FX_WCHAR* pDst = wsResult.GetBuffer(iCount);
- int32_t nIndex = 0;
- FX_BOOL bMinus = FALSE;
- int32_t i = 0;
- for (i = 0; i < iCount; i++) {
- FX_WCHAR wc = pStr[i];
- if (wc == '.') {
- break;
- }
- if ((wc == L'0' || wc == L' ' || wc == '+') && nIndex == 0) {
- continue;
- }
- if (wc == '-') {
- pDst[nIndex++] = wc;
- bMinus = TRUE;
- continue;
- }
- if (wc == L'0' && nIndex == 1 && bMinus) {
- continue;
- }
- pDst[nIndex++] = wc;
- }
- if (bMinus && nIndex == 1) {
- pDst[nIndex++] = '0';
- }
- if (nIndex == 0) {
- wsResult.ReleaseBuffer(0);
- pDst = wsResult.GetBuffer(iCount + 1);
- pDst[nIndex++] = '0';
- }
- int32_t j = 0;
- for (j = iCount - 1; j > i; j--) {
- FX_WCHAR wc = pStr[j];
- if (wc != L'0' && wc != L' ') {
- break;
- }
- }
- if (j > i) {
- pDst[nIndex++] = '.';
- FXSYS_wcsncpy(pDst + nIndex, pStr + i + 1, j - i);
- nIndex += j - i;
- }
- wsResult.ReleaseBuffer(nIndex);
-}
+
FX_BOOL CFX_FormatString::ParseNum(const CFX_WideString& wsSrcNum,
const CFX_WideString& wsPattern,
CFX_WideString& wsValue) {
diff --git a/xfa/fgas/localization/fgas_locale.h b/xfa/fgas/localization/fgas_locale.h
index d1d862b0b5..3401d6ca5a 100644
--- a/xfa/fgas/localization/fgas_locale.h
+++ b/xfa/fgas/localization/fgas_locale.h
@@ -54,7 +54,6 @@ enum FX_DATETIMETYPE {
class IFX_Locale {
public:
- static IFX_Locale* Create(CXML_Element* pLocaleData);
virtual ~IFX_Locale() {}
virtual void Release() = 0;
@@ -92,9 +91,7 @@ class IFX_LocaleMgr {
virtual IFX_Locale* GetLocale(uint16_t lcid) = 0;
virtual IFX_Locale* GetLocaleByName(const CFX_WideString& wsLocaleName) = 0;
};
-IFX_LocaleMgr* FX_LocaleMgr_Create(const FX_WCHAR* pszLocalPath,
- uint16_t wDefaultLCID);
-void FX_ParseNumString(const CFX_WideString& wsNum, CFX_WideString& wsResult);
+
FX_BOOL FX_DateFromCanonical(const CFX_WideString& wsDate,
CFX_Unitime& datetime);
FX_BOOL FX_TimeFromCanonical(const CFX_WideStringC& wsTime,
diff --git a/xfa/fgas/localization/fgas_localeimp.h b/xfa/fgas/localization/fgas_localeimp.h
index bbbdcb17e1..969fe6b625 100644
--- a/xfa/fgas/localization/fgas_localeimp.h
+++ b/xfa/fgas/localization/fgas_localeimp.h
@@ -11,39 +11,6 @@
class CFX_LCNumeric;
-class CFX_Locale : public IFX_Locale {
- public:
- CFX_Locale(CXML_Element* pLocaleData);
- virtual void Release() { delete this; }
-
- virtual CFX_WideString GetName();
- virtual void GetNumbericSymbol(FX_LOCALENUMSYMBOL eType,
- CFX_WideString& wsNumSymbol) const;
-
- virtual void GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const;
- virtual void GetMonthName(int32_t nMonth,
- CFX_WideString& wsMonthName,
- FX_BOOL bAbbr = TRUE) const;
- virtual void GetDayName(int32_t nWeek,
- CFX_WideString& wsDayName,
- FX_BOOL bAbbr = TRUE) const;
- virtual void GetMeridiemName(CFX_WideString& wsMeridiemName,
- FX_BOOL bAM = TRUE) const;
- virtual void GetTimeZone(FX_TIMEZONE& tz) const;
- virtual void GetEraName(CFX_WideString& wsEraName, FX_BOOL bAD = TRUE) const;
-
- virtual void GetDatePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
- CFX_WideString& wsPattern) const;
- virtual void GetTimePattern(FX_LOCALEDATETIMESUBCATEGORY eType,
- CFX_WideString& wsPattern) const;
- virtual void GetNumPattern(FX_LOCALENUMSUBCATEGORY eType,
- CFX_WideString& wsPattern) const;
-
- protected:
- virtual ~CFX_Locale();
- CXML_Element* m_pElement;
-};
-
class CFX_FormatString {
public:
CFX_FormatString(IFX_LocaleMgr* pLocaleMgr, FX_BOOL bUseLCID);
diff --git a/xfa/fgas/localization/fgas_localemgr.cpp b/xfa/fgas/localization/fgas_localemgr.cpp
deleted file mode 100644
index e0ce8d9127..0000000000
--- a/xfa/fgas/localization/fgas_localemgr.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#include "xfa/fgas/localization/fgas_localemgr.h"
-
-#include "core/fxcrt/include/fx_xml.h"
-
-IFX_LocaleMgr* FX_LocaleMgr_Create(const FX_WCHAR* pszLocalPath,
- uint16_t wDefaultLCID) {
- void* pPathHandle = FX_OpenFolder(pszLocalPath);
- if (!pPathHandle) {
- return NULL;
- }
- CFX_LocaleMgr* pLocaleMgr = new CFX_LocaleMgr(wDefaultLCID);
- CFX_WideString wsFileName;
- FX_BOOL bFolder = FALSE;
- while (FX_GetNextFile(pPathHandle, wsFileName, bFolder)) {
- if (!bFolder) {
- if (wsFileName.GetLength() < 4) {
- continue;
- }
- CFX_WideString wsExt = wsFileName.Right(4);
- wsExt.MakeLower();
- if (wsExt != L".xml") {
- continue;
- }
- CFX_WideString wsFullPath(pszLocalPath);
- wsFullPath += L"\\" + wsFileName;
- IFX_FileRead* pRead = FX_CreateFileRead(wsFullPath.c_str());
- if (!pRead) {
- continue;
- }
- CXML_Element* pXmlLocale = CXML_Element::Parse(pRead);
- pRead->Release();
- CFX_ByteString bssp = pXmlLocale->GetNamespace();
- if (bssp == "http://www.foxitsoftware.com/localization") {
- CFX_WideString wsLCID = pXmlLocale->GetAttrValue("", "lcid");
- wchar_t* pEnd = NULL;
- uint32_t dwLCID = wcstol(wsLCID.c_str(), &pEnd, 16);
- if (pLocaleMgr->m_lcid2xml.GetValueAt((void*)(uintptr_t)dwLCID)) {
- delete pXmlLocale;
- } else {
- pLocaleMgr->m_lcid2xml.SetAt((void*)(uintptr_t)dwLCID, pXmlLocale);
- }
- } else {
- delete pXmlLocale;
- }
- }
- }
- FX_CloseFolder(pPathHandle);
- return pLocaleMgr;
-}
-CFX_LocaleMgr::CFX_LocaleMgr(uint16_t wDefLCID) : m_wDefLCID(wDefLCID) {}
-CFX_LocaleMgr::~CFX_LocaleMgr() {
- FX_POSITION ps = m_lcid2locale.GetStartPosition();
- while (ps) {
- void* plcid;
- IFX_Locale* pLocale = NULL;
- m_lcid2locale.GetNextAssoc(ps, plcid, (void*&)pLocale);
- pLocale->Release();
- }
- m_lcid2locale.RemoveAll();
- ps = m_lcid2xml.GetStartPosition();
- while (ps) {
- void* plcid;
- CXML_Element* pxml = NULL;
- m_lcid2xml.GetNextAssoc(ps, plcid, (void*&)pxml);
- delete pxml;
- }
- m_lcid2xml.RemoveAll();
-}
-uint16_t CFX_LocaleMgr::GetDefLocaleID() {
- return m_wDefLCID;
-}
-IFX_Locale* CFX_LocaleMgr::GetDefLocale() {
- return GetLocale(m_wDefLCID);
-}
-IFX_Locale* CFX_LocaleMgr::GetLocale(uint16_t lcid) {
- IFX_Locale* pLocale =
- (IFX_Locale*)m_lcid2locale.GetValueAt((void*)(uintptr_t)lcid);
- if (!pLocale) {
- CXML_Element* pxml =
- (CXML_Element*)m_lcid2xml.GetValueAt((void*)(uintptr_t)lcid);
- if (pxml) {
- pLocale = IFX_Locale::Create(pxml);
- m_lcid2locale.SetAt((void*)(uintptr_t)lcid, pLocale);
- }
- }
- return pLocale;
-}
-IFX_Locale* CFX_LocaleMgr::GetLocaleByName(const CFX_WideString& wsLocaleName) {
- return nullptr;
-}
diff --git a/xfa/fgas/localization/fgas_localemgr.h b/xfa/fgas/localization/fgas_localemgr.h
deleted file mode 100644
index d0ba90c9a8..0000000000
--- a/xfa/fgas/localization/fgas_localemgr.h
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2014 PDFium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-
-#ifndef XFA_FGAS_LOCALIZATION_FGAS_LOCALEMGR_H_
-#define XFA_FGAS_LOCALIZATION_FGAS_LOCALEMGR_H_
-
-#include "xfa/fgas/localization/fgas_locale.h"
-
-class CFX_LocaleMgr : public IFX_LocaleMgr {
- public:
- CFX_LocaleMgr(uint16_t wDefLCID);
-
- void Release() override { delete this; }
- uint16_t GetDefLocaleID() override;
- IFX_Locale* GetDefLocale() override;
- IFX_Locale* GetLocale(uint16_t lcid) override;
- IFX_Locale* GetLocaleByName(const CFX_WideString& wsLocaleName) override;
-
- CFX_MapPtrToPtr m_lcid2xml;
-
- protected:
- ~CFX_LocaleMgr() override;
- CFX_MapPtrToPtr m_lcid2locale;
- uint16_t m_wDefLCID;
-};
-
-#endif // XFA_FGAS_LOCALIZATION_FGAS_LOCALEMGR_H_