diff options
author | tsepez <tsepez@chromium.org> | 2016-04-05 12:22:15 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-05 12:22:15 -0700 |
commit | fc58ad18b7ab32e7b0bb3959b07dbe7538a7cebd (patch) | |
tree | 8662b886d373b149fbdd6f5db9570c233cb23ce7 /xfa/fxfa/app | |
parent | c7a7349cf316af37d4ad4b71c5742159deccbf33 (diff) | |
download | pdfium-fc58ad18b7ab32e7b0bb3959b07dbe7538a7cebd.tar.xz |
Make down-conversion explicit from CFX_Widetring to CFX_WideStringC.
Companion to https://codereview.chromium.org/1853233002
BUG=
Review URL: https://codereview.chromium.org/1857073002
Diffstat (limited to 'xfa/fxfa/app')
-rw-r--r-- | xfa/fxfa/app/xfa_ffbarcode.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffchoicelist.cpp | 10 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffdocview.cpp | 7 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fffield.cpp | 6 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffimageedit.cpp | 6 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffpageview.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fftextedit.cpp | 9 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffwidget.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_ffwidgetacc.cpp | 39 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_fontmgr.cpp | 9 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_textlayout.cpp | 19 | ||||
-rw-r--r-- | xfa/fxfa/app/xfa_textlayout.h | 4 |
12 files changed, 69 insertions, 48 deletions
diff --git a/xfa/fxfa/app/xfa_ffbarcode.cpp b/xfa/fxfa/app/xfa_ffbarcode.cpp index e5ace150ab..28dfa86066 100644 --- a/xfa/fxfa/app/xfa_ffbarcode.cpp +++ b/xfa/fxfa/app/xfa_ffbarcode.cpp @@ -167,7 +167,7 @@ void CXFA_FFBarcode::UpdateWidgetProperty() { CFWL_Barcode* pBarCodeWidget = (CFWL_Barcode*)m_pNormalWidget; CFX_WideString wsType = GetDataAcc()->GetBarcodeType(); XFA_LPCBARCODETYPEENUMINFO pBarcodeTypeInfo = - XFA_GetBarcodeTypeByName(wsType); + XFA_GetBarcodeTypeByName(wsType.AsWideStringC()); pBarCodeWidget->SetType(pBarcodeTypeInfo->eBCType); CXFA_WidgetAcc* pAcc = GetDataAcc(); int32_t intVal; diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp index 44ae14264d..645b8c88fa 100644 --- a/xfa/fxfa/app/xfa_ffchoicelist.cpp +++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp @@ -44,7 +44,7 @@ FX_BOOL CXFA_FFListBox::LoadWidget() { m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE); int32_t iItems = wsLabelArray.GetSize(); for (int32_t i = 0; i < iItems; i++) { - pListBox->AddString(wsLabelArray[i]); + pListBox->AddString(wsLabelArray[i].AsWideStringC()); } uint32_t dwExtendedStyle = FWL_STYLEEXT_LTB_ShowScrollBarFocus; if (m_pDataAcc->GetChoiceListOpen() == XFA_ATTRIBUTEENUM_MultiSelect) { @@ -166,7 +166,7 @@ void CXFA_FFListBox::SetItemState(int32_t nIndex, FX_BOOL bSelected) { void CXFA_FFListBox::InsertItem(const CFX_WideStringC& wsLabel, int32_t nIndex) { CFX_WideString wsTemp(wsLabel); - ((CFWL_ListBox*)m_pNormalWidget)->AddString(wsTemp); + ((CFWL_ListBox*)m_pNormalWidget)->AddString(wsTemp.AsWideStringC()); m_pNormalWidget->Update(); AddInvalidateRect(); } @@ -240,7 +240,7 @@ FX_BOOL CXFA_FFComboBox::LoadWidget() { m_pDataAcc->GetChoiceListItems(wsLabelArray, FALSE); int32_t iItems = wsLabelArray.GetSize(); for (int32_t i = 0; i < iItems; i++) { - pComboBox->AddString(wsLabelArray[i]); + pComboBox->AddString(wsLabelArray[i].AsWideStringC()); } CFX_Int32Array iSelArray; m_pDataAcc->GetSelectedItems(iSelArray); @@ -250,7 +250,7 @@ FX_BOOL CXFA_FFComboBox::LoadWidget() { } else { CFX_WideString wsText; m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw); - pComboBox->SetEditText(wsText); + pComboBox->SetEditText(wsText.AsWideStringC()); } UpdateWidgetProperty(); m_pNormalWidget->UnlockUpdate(); @@ -382,7 +382,7 @@ FX_BOOL CXFA_FFComboBox::UpdateFWLData() { CFX_WideString wsText; ((CFWL_ComboBox*)m_pNormalWidget)->SetCurSel(-1); m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Raw); - ((CFWL_ComboBox*)m_pNormalWidget)->SetEditText(wsText); + ((CFWL_ComboBox*)m_pNormalWidget)->SetEditText(wsText.AsWideStringC()); } m_pNormalWidget->Update(); return TRUE; diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp index 5e8813542d..c82fd53bc2 100644 --- a/xfa/fxfa/app/xfa_ffdocview.cpp +++ b/xfa/fxfa/app/xfa_ffdocview.cpp @@ -162,7 +162,8 @@ void CXFA_FFDocView::ShowNullTestMsg() { } CFX_WideString wsTitle; pAppProvider->LoadString(XFA_IDS_AppName, wsTitle); - pAppProvider->MsgBox(wsMsg, wsTitle, XFA_MBICON_Status, XFA_MB_OK); + pAppProvider->MsgBox(wsMsg.AsWideStringC(), wsTitle.AsWideStringC(), + XFA_MBICON_Status, XFA_MB_OK); } m_arrNullTestMsg.RemoveAll(); } @@ -515,8 +516,8 @@ CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName( wsExpression = L"$form." + wsName; } XFA_RESOLVENODE_RS resoveNodeRS; - int32_t iRet = pScriptContext->ResolveObjects(refNode, wsExpression, - resoveNodeRS, dwStyle); + int32_t iRet = pScriptContext->ResolveObjects( + refNode, wsExpression.AsWideStringC(), resoveNodeRS, dwStyle); if (iRet < 1) { return NULL; } diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp index a0f64e9bb0..229ed43733 100644 --- a/xfa/fxfa/app/xfa_fffield.cpp +++ b/xfa/fxfa/app/xfa_fffield.cpp @@ -731,7 +731,8 @@ int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) { wsMessage += wsWarning; CFX_WideString wsTitle; pAppProvider->LoadString(XFA_IDS_CalcOverride, wsTitle); - pAppProvider->MsgBox(wsMessage, wsTitle, XFA_MBICON_Warning, + pAppProvider->MsgBox(wsMessage.AsWideStringC(), + wsTitle.AsWideStringC(), XFA_MBICON_Warning, XFA_MB_OK); } } @@ -763,7 +764,8 @@ int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) { wsMessage += wsWarning; CFX_WideString wsTitle; pAppProvider->LoadString(XFA_IDS_CalcOverride, wsTitle); - if (pAppProvider->MsgBox(wsMessage, wsTitle, XFA_MBICON_Warning, + if (pAppProvider->MsgBox(wsMessage.AsWideStringC(), + wsTitle.AsWideStringC(), XFA_MBICON_Warning, XFA_MB_YesNo) == XFA_IDYes) { pAcc->GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, TRUE, FALSE); return 1; diff --git a/xfa/fxfa/app/xfa_ffimageedit.cpp b/xfa/fxfa/app/xfa_ffimageedit.cpp index ce69b1242b..d419fbd37d 100644 --- a/xfa/fxfa/app/xfa_ffimageedit.cpp +++ b/xfa/fxfa/app/xfa_ffimageedit.cpp @@ -108,7 +108,8 @@ FX_BOOL CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags, CFX_WideString wsFilter; pAppProvider->LoadString(XFA_IDS_ImageFilter, wsFilter); CFX_WideStringArray wsPathArray; - pAppProvider->ShowFileDialog(wsTitle, wsFilter, wsPathArray); + pAppProvider->ShowFileDialog(wsTitle.AsWideStringC(), + wsFilter.AsWideStringC(), wsPathArray); int32_t iSize = wsPathArray.GetSize(); if (iSize < 1) { return TRUE; @@ -147,7 +148,8 @@ FX_BOOL CXFA_FFImageEdit::OnLButtonDown(uint32_t dwFlags, m_pDataAcc->SetImageEditImage(NULL); pFileRead->Release(); } - m_pDataAcc->SetImageEdit(wsContentType, CFX_WideStringC(), wsImage); + m_pDataAcc->SetImageEdit(wsContentType.AsWideStringC(), CFX_WideStringC(), + wsImage.AsWideStringC()); m_pDataAcc->LoadImageEditImage(); AddInvalidateRect(); m_pDocView->SetChangeMark(); diff --git a/xfa/fxfa/app/xfa_ffpageview.cpp b/xfa/fxfa/app/xfa_ffpageview.cpp index e22ddc0394..21eb8554da 100644 --- a/xfa/fxfa/app/xfa_ffpageview.cpp +++ b/xfa/fxfa/app/xfa_ffpageview.cpp @@ -270,7 +270,7 @@ CXFA_FFWidget* CXFA_FFTabOrderPageWidgetIterator::GetTraverseWidget( if (pTraverse) { CFX_WideString wsTraverseWidgetName; if (pTraverse->GetAttribute(XFA_ATTRIBUTE_Ref, wsTraverseWidgetName)) { - return FindWidgetByName(wsTraverseWidgetName, pWidget); + return FindWidgetByName(wsTraverseWidgetName.AsWideStringC(), pWidget); } } } diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp index fa530169e0..de93c031b5 100644 --- a/xfa/fxfa/app/xfa_fftextedit.cpp +++ b/xfa/fxfa/app/xfa_fftextedit.cpp @@ -201,7 +201,8 @@ void CXFA_FFTextEdit::ValidateNumberField(const CFX_WideString& wsText) { pAcc->GetNode()->GetSOMExpression(wsSomField); wsMessage.Format(wsError, (const FX_WCHAR*)wsText, (const FX_WCHAR*)wsSomField); - pAppProvider->MsgBox(wsMessage, wsTitle, XFA_MBICON_Error, XFA_MB_OK); + pAppProvider->MsgBox(wsMessage.AsWideStringC(), wsTitle.AsWideStringC(), + XFA_MBICON_Error, XFA_MB_OK); } } } @@ -593,7 +594,7 @@ FX_BOOL CXFA_FFDateTimeEdit::LoadWidget() { m_pNormalWidget->LockUpdate(); CFX_WideString wsText; m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); - pWidget->SetEditText(wsText); + pWidget->SetEditText(wsText.AsWideStringC()); if (CXFA_Value value = m_pDataAcc->GetFormValue()) { switch (value.GetChildValueClassID()) { case XFA_ELEMENT_Date: { @@ -693,7 +694,7 @@ FX_BOOL CXFA_FFDateTimeEdit::UpdateFWLData() { } CFX_WideString wsText; m_pDataAcc->GetValue(wsText, eType); - ((CFWL_DateTimePicker*)m_pNormalWidget)->SetEditText(wsText); + ((CFWL_DateTimePicker*)m_pNormalWidget)->SetEditText(wsText.AsWideStringC()); if (IsFocused() && !wsText.IsEmpty()) { CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc); CFX_Unitime date = lcValue.GetDate(); @@ -776,7 +777,7 @@ void CXFA_FFDateTimeEdit::OnSelectChanged(IFWL_Widget* pWidget, date.FormatPatterns(wsDate, wsPicture, m_pDataAcc->GetLocal(), XFA_VALUEPICTURE_Edit); CFWL_DateTimePicker* pDateTime = (CFWL_DateTimePicker*)m_pNormalWidget; - pDateTime->SetEditText(wsDate); + pDateTime->SetEditText(wsDate.AsWideStringC()); pDateTime->Update(); GetDoc()->GetDocProvider()->SetFocusWidget(GetDoc(), NULL); CXFA_EventParam eParam; diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index 241bae0fdf..3a238ad0f3 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -944,7 +944,7 @@ FX_CHAR* XFA_Base64Encode(const uint8_t* buf, int32_t buf_len) { out[j] = '\0'; return out; } -FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideStringC& wsType) { +FXCODEC_IMAGE_TYPE XFA_GetImageType(const CFX_WideString& wsType) { CFX_WideString wsContentType(wsType); wsContentType.MakeLower(); if (wsContentType == FX_WSTRC(L"image/jpg")) { @@ -1003,7 +1003,7 @@ CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc, if (wsURL.Left(7) != FX_WSTRC(L"http://") && wsURL.Left(6) != FX_WSTRC(L"ftp://")) { CFX_DIBitmap* pBitmap = - pDoc->GetPDFNamedImage(wsURL, iImageXDpi, iImageYDpi); + pDoc->GetPDFNamedImage(wsURL.AsWideStringC(), iImageXDpi, iImageYDpi); if (pBitmap) { bNameImage = TRUE; return pBitmap; diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index 271f9261f0..fb2b0c3ffd 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -229,7 +229,8 @@ void CXFA_WidgetAcc::ResetData() { image.GetContentType(wsContentType); image.GetHref(wsHref); } - SetImageEdit(wsContentType, wsHref, wsValue); + SetImageEdit(wsContentType.AsWideStringC(), wsHref.AsWideStringC(), + wsValue.AsWideStringC()); } break; case XFA_ELEMENT_ExclGroup: { CXFA_Node* pNextChild = m_pNode->GetNodeItem( @@ -411,11 +412,13 @@ void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate validate, GetValidateMessage(pAppProvider, wsScriptMsg, FALSE, bVersionFlag); } if (bVersionFlag) { - pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning, + pAppProvider->MsgBox(wsScriptMsg.AsWideStringC(), + wsTitle.AsWideStringC(), XFA_MBICON_Warning, XFA_MB_OK); return; } - if (pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Warning, + if (pAppProvider->MsgBox(wsScriptMsg.AsWideStringC(), + wsTitle.AsWideStringC(), XFA_MBICON_Warning, XFA_MB_YesNo) == XFA_IDYes) { GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, TRUE, FALSE); } @@ -423,7 +426,9 @@ void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate validate, if (wsScriptMsg.IsEmpty()) { GetValidateMessage(pAppProvider, wsScriptMsg, TRUE, bVersionFlag); } - pAppProvider->MsgBox(wsScriptMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK); + pAppProvider->MsgBox(wsScriptMsg.AsWideStringC(), + wsTitle.AsWideStringC(), XFA_MBICON_Error, + XFA_MB_OK); } } } @@ -456,7 +461,9 @@ int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate, if (wsFormatMsg.IsEmpty()) { GetValidateMessage(pAppProvider, wsFormatMsg, TRUE, bVersionFlag); } - pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Error, XFA_MB_OK); + pAppProvider->MsgBox(wsFormatMsg.AsWideStringC(), + wsTitle.AsWideStringC(), XFA_MBICON_Error, + XFA_MB_OK); return XFA_EVENTERROR_Success; } if (GetNode()->HasFlag(XFA_NODEFLAG_UserInteractive)) { @@ -466,11 +473,13 @@ int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate, GetValidateMessage(pAppProvider, wsFormatMsg, FALSE, bVersionFlag); } if (bVersionFlag) { - pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning, + pAppProvider->MsgBox(wsFormatMsg.AsWideStringC(), + wsTitle.AsWideStringC(), XFA_MBICON_Warning, XFA_MB_OK); return XFA_EVENTERROR_Success; } - if (pAppProvider->MsgBox(wsFormatMsg, wsTitle, XFA_MBICON_Warning, + if (pAppProvider->MsgBox(wsFormatMsg.AsWideStringC(), + wsTitle.AsWideStringC(), XFA_MBICON_Warning, XFA_MB_YesNo) == XFA_IDYes) { GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, TRUE, FALSE); } @@ -526,7 +535,8 @@ int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate, pAppProvider->LoadString(XFA_IDS_ValidateNullError, wsError); wsNullMsg.Format(wsError, (const FX_WCHAR*)wsCaptionName); } - pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Status, XFA_MB_OK); + pAppProvider->MsgBox(wsNullMsg.AsWideStringC(), wsTitle.AsWideStringC(), + XFA_MBICON_Status, XFA_MB_OK); return XFA_EVENTERROR_Error; } case XFA_ATTRIBUTEENUM_Warning: { @@ -540,7 +550,8 @@ int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate, wsNullMsg.Format(wsWarning, (const FX_WCHAR*)wsCaptionName, (const FX_WCHAR*)wsCaptionName); } - if (pAppProvider->MsgBox(wsNullMsg, wsTitle, XFA_MBICON_Warning, + if (pAppProvider->MsgBox(wsNullMsg.AsWideStringC(), + wsTitle.AsWideStringC(), XFA_MBICON_Warning, XFA_MB_YesNo) == XFA_IDYes) { GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, TRUE, FALSE); } @@ -671,8 +682,9 @@ int32_t CXFA_WidgetAcc::ExecuteScript(CXFA_Script script, } FXJSE_HVALUE hRetValue = FXJSE_Value_Create(pContext->GetRuntime()); ++m_nRecursionDepth; - FX_BOOL bRet = pContext->RunScript((XFA_SCRIPTLANGTYPE)eScriptType, - wsExpression, hRetValue, m_pNode); + FX_BOOL bRet = + pContext->RunScript((XFA_SCRIPTLANGTYPE)eScriptType, + wsExpression.AsWideStringC(), hRetValue, m_pNode); --m_nRecursionDepth; int32_t iRet = XFA_EVENTERROR_Error; if (bRet) { @@ -1700,11 +1712,12 @@ FX_BOOL CXFA_TextProvider::GetEmbbedObj(FX_BOOL bURI, CXFA_Node* pIDNode = NULL; CXFA_WidgetAcc* pEmbAcc = NULL; if (pParent) { - pIDNode = pDocument->GetNodeByID(pParent, wsAttr); + pIDNode = pDocument->GetNodeByID(pParent, wsAttr.AsWideStringC()); } if (!pIDNode) { pIDNode = pDocument->GetNodeByID( - ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Form)), wsAttr); + ToNode(pDocument->GetXFAObject(XFA_HASHCODE_Form)), + wsAttr.AsWideStringC()); } if (pIDNode) { pEmbAcc = (CXFA_WidgetAcc*)pIDNode->GetWidgetData(); diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp index 1b87f95353..8ffb7ce578 100644 --- a/xfa/fxfa/app/xfa_fontmgr.cpp +++ b/xfa/fxfa/app/xfa_fontmgr.cpp @@ -1765,7 +1765,8 @@ IFX_Font* CXFA_DefFontMgr::GetFont(CXFA_FFDoc* hDoc, IFX_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr(); IFX_Font* pFont = pFDEFontMgr->LoadFont(wsFontName, dwFontStyles, wCodePage); if (!pFont) { - const XFA_FONTINFO* pCurFont = XFA_GetFontINFOByFontName(wsFontName); + const XFA_FONTINFO* pCurFont = + XFA_GetFontINFOByFontName(wsFontName.AsWideStringC()); if (pCurFont && pCurFont->pReplaceFont) { uint32_t dwStyle = 0; if (dwFontStyles & FX_FONTSTYLE_Bold) { @@ -2029,7 +2030,8 @@ IFX_Font* CXFA_FontMgr::GetFont(CXFA_FFDoc* hDoc, CPDF_Font* pPDFFont = NULL; IFX_Font* pFont = NULL; if (pMgr) { - pFont = pMgr->GetFont(wsEnglishName, dwFontStyles, &pPDFFont); + pFont = + pMgr->GetFont(wsEnglishName.AsWideStringC(), dwFontStyles, &pPDFFont); if (pFont) return pFont; } @@ -2038,7 +2040,8 @@ IFX_Font* CXFA_FontMgr::GetFont(CXFA_FFDoc* hDoc, } if (!pFont && pMgr) { pPDFFont = NULL; - pFont = pMgr->GetFont(wsEnglishName, dwFontStyles, &pPDFFont, FALSE); + pFont = pMgr->GetFont(wsEnglishName.AsWideStringC(), dwFontStyles, + &pPDFFont, FALSE); if (pFont) return pFont; } diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp index 4cbdfd4f8e..cd323633c0 100644 --- a/xfa/fxfa/app/xfa_textlayout.cpp +++ b/xfa/fxfa/app/xfa_textlayout.cpp @@ -317,29 +317,26 @@ void CXFA_TextParser::ParseTagInfo(CFDE_XMLNode* pXMLNode, tagProvider.m_bContent = TRUE; } } + int32_t CXFA_TextParser::GetVAlgin(CXFA_TextProvider* pTextProvider) const { - int32_t iAlign = XFA_ATTRIBUTEENUM_Top; CXFA_Para para = pTextProvider->GetParaNode(); - if (para) { - iAlign = para.GetVerticalAlign(); - } - return iAlign; + return para ? para.GetVerticalAlign() : XFA_ATTRIBUTEENUM_Top; } + FX_FLOAT CXFA_TextParser::GetTabInterval(IFDE_CSSComputedStyle* pStyle) const { CFX_WideString wsValue; - if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"tab-interval"), wsValue)) { - CXFA_Measurement ms(wsValue); - return ms.ToUnit(XFA_UNIT_Pt); - } + if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"tab-interval"), wsValue)) + return CXFA_Measurement(wsValue.AsWideStringC()).ToUnit(XFA_UNIT_Pt); return 36; } + int32_t CXFA_TextParser::CountTabs(IFDE_CSSComputedStyle* pStyle) const { CFX_WideString wsValue; - if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"xfa-tab-count"), wsValue)) { + if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"xfa-tab-count"), wsValue)) return wsValue.GetInteger(); - } return 0; } + FX_BOOL CXFA_TextParser::IsSpaceRun(IFDE_CSSComputedStyle* pStyle) const { CFX_WideString wsValue; if (pStyle && pStyle->GetCustomStyle(FX_WSTRC(L"xfa-spacerun"), wsValue)) { diff --git a/xfa/fxfa/app/xfa_textlayout.h b/xfa/fxfa/app/xfa_textlayout.h index 9b92e1796a..d92a2f4058 100644 --- a/xfa/fxfa/app/xfa_textlayout.h +++ b/xfa/fxfa/app/xfa_textlayout.h @@ -25,7 +25,9 @@ class CXFA_CSSTagProvider : public IFDE_CSSTagProvider { public: CXFA_CSSTagProvider() : m_bTagAviliable(FALSE), m_bContent(FALSE) {} virtual ~CXFA_CSSTagProvider(); - virtual CFX_WideStringC GetTagName() { return m_wsTagName; } + + // Note: |this| must outlive the use of GetTagName()'s result. + virtual CFX_WideStringC GetTagName() { return m_wsTagName.AsWideStringC(); } virtual FX_POSITION GetFirstAttribute() { return m_Attributes.GetStartPosition(); } |