diff options
Diffstat (limited to 'xfa/src/fxfa')
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffConfigAcc.cpp | 62 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_ffConfigAcc.h | 27 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_fftextedit.cpp | 6 | ||||
-rw-r--r-- | xfa/src/fxfa/src/app/xfa_fontmgr.cpp | 17 | ||||
-rw-r--r-- | xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp | 14 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp | 5 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp | 17 | ||||
-rw-r--r-- | xfa/src/fxfa/src/parser/xfa_object_imp.cpp | 3 |
8 files changed, 17 insertions, 134 deletions
diff --git a/xfa/src/fxfa/src/app/xfa_ffConfigAcc.cpp b/xfa/src/fxfa/src/app/xfa_ffConfigAcc.cpp deleted file mode 100644 index 2a31533771..0000000000 --- a/xfa/src/fxfa/src/app/xfa_ffConfigAcc.cpp +++ /dev/null @@ -1,62 +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/src/foxitlib.h" -#include "xfa/src/fxfa/src/app/xfa_ffConfigAcc.h" -#include "xfa/src/fxfa/src/common/xfa_object.h" - -CXFA_FFConfigAcc::CXFA_FFConfigAcc(CXFA_Node* pNode) - : m_pNode(pNode), m_pPsMapNode(NULL) {} -CXFA_FFConfigAcc::~CXFA_FFConfigAcc() {} -int32_t CXFA_FFConfigAcc::CountChildren() { - GetPsMapNode(); - if (m_pPsMapNode == NULL) { - return 0; - } - int32_t iCount = 0; - CXFA_Node* pNode = m_pPsMapNode->GetNodeItem(XFA_NODEITEM_FirstChild); - for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { - iCount++; - } - return iCount; -} -FX_BOOL CXFA_FFConfigAcc::GetFontInfo(int32_t index, - CFX_WideString& wsFontFamily, - CFX_WideString& wsPsName, - FX_BOOL bBold, - FX_BOOL bItalic) { - if (index < 0 || index >= CountChildren()) { - return FALSE; - } - CXFA_Node* pFontNode = m_pPsMapNode->GetChild(index, XFA_ELEMENT_Font); - if (pFontNode == NULL) { - return FALSE; - } - wsFontFamily.Empty(); - wsPsName.Empty(); - bBold = FALSE; - bItalic = FALSE; - pFontNode->GetAttribute(XFA_ATTRIBUTE_Typeface, wsFontFamily); - pFontNode->GetAttribute(XFA_ATTRIBUTE_PsName, wsPsName); - CFX_WideString wsValue; - pFontNode->GetAttribute(XFA_ATTRIBUTE_Weight, wsValue); - wsValue.MakeLower(); - if (wsValue == FX_WSTRC(L"bold")) { - bBold = TRUE; - } - pFontNode->GetAttribute(XFA_ATTRIBUTE_Posture, wsValue); - wsValue.MakeLower(); - if (wsValue == FX_WSTRC(L"italic")) { - bItalic = TRUE; - } - return wsFontFamily.GetLength() > 0; -} -void CXFA_FFConfigAcc::GetPsMapNode() { - if (m_pNode == NULL) { - return; - } - m_pPsMapNode = m_pNode->GetChild(0, XFA_ELEMENT_PsMap); -} diff --git a/xfa/src/fxfa/src/app/xfa_ffConfigAcc.h b/xfa/src/fxfa/src/app/xfa_ffConfigAcc.h deleted file mode 100644 index c26876a4e3..0000000000 --- a/xfa/src/fxfa/src/app/xfa_ffConfigAcc.h +++ /dev/null @@ -1,27 +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_SRC_FXFA_SRC_APP_XFA_FFCONFIGACC_H_ -#define XFA_SRC_FXFA_SRC_APP_XFA_FFCONFIGACC_H_ - -class CXFA_FFConfigAcc { - public: - CXFA_FFConfigAcc(CXFA_Node* pNode); - ~CXFA_FFConfigAcc(); - int32_t CountChildren(); - FX_BOOL GetFontInfo(int32_t index, - CFX_WideString& wsFontFamily, - CFX_WideString& wsPsName, - FX_BOOL bBold, - FX_BOOL bItalic); - - private: - void GetPsMapNode(); - CXFA_Node* m_pNode; - CXFA_Node* m_pPsMapNode; -}; - -#endif // XFA_SRC_FXFA_SRC_APP_XFA_FFCONFIGACC_H_ diff --git a/xfa/src/fxfa/src/app/xfa_fftextedit.cpp b/xfa/src/fxfa/src/app/xfa_fftextedit.cpp index e9fd220272..361f70573c 100644 --- a/xfa/src/fxfa/src/app/xfa_fftextedit.cpp +++ b/xfa/src/fxfa/src/app/xfa_fftextedit.cpp @@ -601,11 +601,9 @@ FX_BOOL CXFA_FFDateTimeEdit::LoadWidget() { CFX_WideString wsText; m_pDataAcc->GetValue(wsText, XFA_VALUEPICTURE_Display); pWidget->SetEditText(wsText); - XFA_DATETIMETYPE eType = XFA_DATETIMETYPE_DateAndTime; if (CXFA_Value value = m_pDataAcc->GetFormValue()) { switch (value.GetChildValueClassID()) { case XFA_ELEMENT_Date: { - eType = XFA_DATETIMETYPE_Date; if (!wsText.IsEmpty()) { CXFA_LocaleValue lcValue = XFA_GetLocaleValue(m_pDataAcc); CFX_Unitime date = lcValue.GetDate(); @@ -614,11 +612,7 @@ FX_BOOL CXFA_FFDateTimeEdit::LoadWidget() { } } } break; - case XFA_ELEMENT_Time: - eType = XFA_DATETIMETYPE_Time; - break; default: - eType = XFA_DATETIMETYPE_DateAndTime; break; } } diff --git a/xfa/src/fxfa/src/app/xfa_fontmgr.cpp b/xfa/src/fxfa/src/app/xfa_fontmgr.cpp index 3474e0aa90..c5d175abec 100644 --- a/xfa/src/fxfa/src/app/xfa_fontmgr.cpp +++ b/xfa/src/fxfa/src/app/xfa_fontmgr.cpp @@ -7,7 +7,6 @@ #include <algorithm> #include "xfa/src/foxitlib.h" -#include "xfa/src/fxfa/src/app/xfa_ffConfigAcc.h" #include "xfa/src/fxfa/src/app/xfa_ffapp.h" #include "xfa/src/fxfa/src/app/xfa_ffdoc.h" #include "xfa/src/fxfa/src/app/xfa_fontmgr.h" @@ -1759,20 +1758,17 @@ CXFA_DefFontMgr::~CXFA_DefFontMgr() { } m_CacheFonts.RemoveAll(); } + IFX_Font* CXFA_DefFontMgr::GetFont(IXFA_Doc* hDoc, const CFX_WideStringC& wsFontFamily, FX_DWORD dwFontStyles, FX_WORD wCodePage) { CFX_WideString wsFontName = wsFontFamily; - IFX_FontMgr* pFDEFontMgr = ((CXFA_FFDoc*)hDoc)->GetApp()->GetFDEFontMgr(); - const XFA_FONTINFO* pCurFont = NULL; - FX_BOOL bGetFontInfo = TRUE; - IFX_Font* pFont = pFDEFontMgr->LoadFont((const FX_WCHAR*)wsFontName, - dwFontStyles, wCodePage); - if (!pFont && hDoc) { - if (bGetFontInfo) { - pCurFont = XFA_GetFontINFOByFontName(wsFontName); - } + IFX_FontMgr* pFDEFontMgr = + static_cast<CXFA_FFDoc*>(hDoc)->GetApp()->GetFDEFontMgr(); + IFX_Font* pFont = pFDEFontMgr->LoadFont(wsFontName, dwFontStyles, wCodePage); + if (!pFont) { + const XFA_FONTINFO* pCurFont = XFA_GetFontINFOByFontName(wsFontName); if (pCurFont && pCurFont->pReplaceFont) { FX_DWORD dwStyle = 0; if (dwFontStyles & FX_FONTSTYLE_Bold) { @@ -1806,6 +1802,7 @@ IFX_Font* CXFA_DefFontMgr::GetFont(IXFA_Doc* hDoc, } return pFont; } + IFX_Font* CXFA_DefFontMgr::GetDefaultFont(IXFA_Doc* hDoc, const CFX_WideStringC& wsFontFamily, FX_DWORD dwFontStyles, diff --git a/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp b/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp index 132f8a39c2..69fbbfb2de 100644 --- a/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/src/fxfa/src/fm2js/xfa_fm2jscontext.cpp @@ -4058,7 +4058,7 @@ void CXFA_FM2JSContext::EncodeURL(const CFX_ByteStringC& szURLString, strEncode[1] = strCode[iIndex]; strEncode[2] = strCode[ch - iIndex * 16]; wsResultBuf << FX_WSTRC(strEncode); - } else if ((ch >= 0x0 && ch <= 0x1f) || ch == 0x7f) { + } else if (ch <= 0x1f || ch == 0x7f) { int32_t iIndex = ch / 16; strEncode[1] = strCode[iIndex]; strEncode[2] = strCode[ch - iIndex * 16]; @@ -4718,16 +4718,13 @@ void CXFA_FM2JSContext::Replace(FXJSE_HOBJECT hThis, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if ((argc == 2) || (argc == 3)) { - FX_BOOL bFlags = FALSE; FXJSE_HVALUE argOne = GetSimpleHValue(hThis, args, 0); FXJSE_HVALUE argTwo = GetSimpleHValue(hThis, args, 1); FXJSE_HVALUE argThree = 0; CFX_ByteString oneString; CFX_ByteString twoString; CFX_ByteString threeString; - if ((HValueIsNull(hThis, argOne)) || (HValueIsNull(hThis, argTwo))) { - bFlags = TRUE; - } else { + if (!HValueIsNull(hThis, argOne) && !HValueIsNull(hThis, argTwo)) { HValueToUTF8String(argOne, oneString); HValueToUTF8String(argTwo, twoString); } @@ -4995,7 +4992,6 @@ void CXFA_FM2JSContext::Stuff(FXJSE_HOBJECT hThis, CFXJSE_Arguments& args) { int32_t argc = args.GetLength(); if ((argc == 3) || (argc == 4)) { - FX_BOOL bFlags = FALSE; CFX_ByteString sourceString; CFX_ByteString insertString; int32_t iLength = 0; @@ -5005,10 +5001,8 @@ void CXFA_FM2JSContext::Stuff(FXJSE_HOBJECT hThis, FXJSE_HVALUE startValue = GetSimpleHValue(hThis, args, 1); FXJSE_HVALUE deleteValue = GetSimpleHValue(hThis, args, 2); FXJSE_HVALUE insertValue = 0; - if ((FXJSE_Value_IsNull(sourceValue)) || (FXJSE_Value_IsNull(startValue)) || - (FXJSE_Value_IsNull(deleteValue))) { - bFlags = TRUE; - } else { + if (!FXJSE_Value_IsNull(sourceValue) && !FXJSE_Value_IsNull(startValue) && + !FXJSE_Value_IsNull(deleteValue)) { HValueToUTF8String(sourceValue, sourceString); iLength = sourceString.GetLength(); iStart = (int32_t)HValueToFloat(hThis, startValue); diff --git a/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp b/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp index 7e812860bf..c2a53ac70e 100644 --- a/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_document_datamerger_imp.cpp @@ -141,11 +141,10 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, int32_t iSize = wsSelTextArray.GetSize(); if (iSize >= 1) { CXFA_Node* pValue = NULL; - IFDE_XMLNode* pValueXMLNode = NULL; for (int32_t i = 0; i < iSize; i++) { pValue = pDataNode->CreateSamePacketNode(XFA_ELEMENT_DataValue); pValue->SetCData(XFA_ATTRIBUTE_Name, FX_WSTRC(L"value")); - pValueXMLNode = pValue->CreateXMLMappingNode(); + pValue->CreateXMLMappingNode(); pDataNode->InsertChild(pValue); pValue->SetCData(XFA_ATTRIBUTE_Value, wsSelTextArray[i]); } @@ -170,7 +169,6 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, break; case XFA_ELEMENT_ExclGroup: { CXFA_Node* pChecked = NULL; - XFA_ELEMENT eValueType = XFA_ELEMENT_UNKNOWN; CXFA_Node* pChild = pFormNode->GetNodeItem(XFA_NODEITEM_FirstChild); for (; pChild; pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { if (pChild->GetClassID() != XFA_ELEMENT_Field) { @@ -196,7 +194,6 @@ static void XFA_DataMerge_CreateDataBinding(CXFA_Node* pFormNode, CFX_WideString wsContent; if (pText->TryContent(wsContent) && (wsContent == wsValue)) { pChecked = pChild; - eValueType = pText->GetClassID(); wsFormatedValue = wsValue; pDataNode->SetAttributeValue(wsValue, wsFormatedValue); pFormNode->SetCData(XFA_ATTRIBUTE_Value, wsContent); diff --git a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp index 4627c4c555..e1282c1f9e 100644 --- a/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp +++ b/xfa/src/fxfa/src/parser/xfa_layout_itemlayout.cpp @@ -1384,16 +1384,13 @@ void CXFA_ItemLayoutProcessor::DoLayoutTableContainer(CXFA_Node* pLayoutNode) { FX_FLOAT fContentCalculatedWidth = 0, fContentCalculatedHeight = 0; CXFA_Node* pMarginNode = m_pFormNode->GetFirstChildByClass(XFA_ELEMENT_Margin); - FX_FLOAT fLeftInset = 0, fTopInset = 0, fRightInset = 0, fBottomInset = 0; + FX_FLOAT fLeftInset = 0; + FX_FLOAT fRightInset = 0; if (pMarginNode) { fLeftInset = pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); - fTopInset = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); fRightInset = pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); - fBottomInset = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); } FX_FLOAT fContentWidthLimit = bContainerWidthAutoSize ? XFA_LAYOUT_FLOAT_MAX @@ -1711,16 +1708,13 @@ static void XFA_ItemLayoutProcessor_AddLeaderAfterSplit( XFA_ItemLayoutProcessor_UpdatePendedItemLayout(pProcessor, pLeaderLayoutItem); CXFA_Node* pMarginNode = pProcessor->m_pFormNode->GetFirstChildByClass(XFA_ELEMENT_Margin); - FX_FLOAT fLeftInset = 0, fTopInset = 0, fRightInset = 0, fBottomInset = 0; + FX_FLOAT fLeftInset = 0; + FX_FLOAT fRightInset = 0; if (pMarginNode) { fLeftInset = pMarginNode->GetMeasure(XFA_ATTRIBUTE_LeftInset).ToUnit(XFA_UNIT_Pt); - fTopInset = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_TopInset).ToUnit(XFA_UNIT_Pt); fRightInset = pMarginNode->GetMeasure(XFA_ATTRIBUTE_RightInset).ToUnit(XFA_UNIT_Pt); - fBottomInset = - pMarginNode->GetMeasure(XFA_ATTRIBUTE_BottomInset).ToUnit(XFA_UNIT_Pt); } FX_FLOAT fHeight = pLeaderLayoutItem->m_sSize.y; for (CXFA_ContentLayoutItem* pChildItem = @@ -2510,7 +2504,6 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( } } break; case XFA_ItemLayoutProcessorStages_BreakAfter: { - XFA_ItemLayoutProcessorResult eResult; CXFA_Node *pLeaderNode = NULL, *pTrailerNode = NULL; FX_BOOL bCreatePage = FALSE; if (bUseBreakControl && m_pPageMgr && @@ -2524,7 +2517,7 @@ XFA_ItemLayoutProcessorResult CXFA_ItemLayoutProcessor::DoLayoutFlowedContainer( #ifndef _XFA_LAYOUTITEM_ProcessCACHE_ pProcessor->m_pPageMgrCreateItem = m_pPageMgrCreateItem; #endif - eResult = XFA_ItemLayoutProcessor_InsertFlowedItem( + XFA_ItemLayoutProcessor_InsertFlowedItem( this, pProcessor, bContainerWidthAutoSize, bContainerHeightAutoSize, fContainerHeight, eFlowStrategy, uCurHAlignState, rgCurLineLayoutItems, FALSE, diff --git a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp index cef42f8ba5..acbbaa754b 100644 --- a/xfa/src/fxfa/src/parser/xfa_object_imp.cpp +++ b/xfa/src/fxfa/src/parser/xfa_object_imp.cpp @@ -2948,14 +2948,11 @@ static void XFA_ScriptInstanceManager_ReorderDataNodes(CXFA_NodeSet& sSet1, pDualNodeArray->firstNodeList, rgNodeArray1, rgIdxArray1); XFA_ScriptInstanceManager_ReorderDataNodes_SortNodeArrayByDocumentIdx( pDualNodeArray->secondNodeList, rgNodeArray2, rgIdxArray2); - int32_t iLimit; CXFA_Node *pParentNode = NULL, *pBeforeNode = NULL; if (bInsertBefore) { - iLimit = rgIdxArray2[0]; pBeforeNode = rgNodeArray2[0]; pParentNode = pBeforeNode->GetNodeItem(XFA_NODEITEM_Parent); } else { - iLimit = rgIdxArray2[rgIdxArray2.GetSize() - 1]; CXFA_Node* pLastNode = rgNodeArray2[rgIdxArray2.GetSize() - 1]; pParentNode = pLastNode->GetNodeItem(XFA_NODEITEM_Parent); pBeforeNode = pLastNode->GetNodeItem(XFA_NODEITEM_NextSibling); |