| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "xfa/fxfa/app/xfa_textlayout.h" | 7 #include "xfa/fxfa/app/xfa_textlayout.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "core/fxcrt/include/fx_ext.h" | 11 #include "core/fxcrt/include/fx_ext.h" |
| 12 #include "xfa/fde/cfde_path.h" | 12 #include "xfa/fde/cfde_path.h" |
| 13 #include "xfa/fde/css/fde_csscache.h" | 13 #include "xfa/fde/css/fde_csscache.h" |
| 14 #include "xfa/fde/fde_gedevice.h" | 14 #include "xfa/fde/fde_gedevice.h" |
| 15 #include "xfa/fde/fde_object.h" | 15 #include "xfa/fde/fde_object.h" |
| 16 #include "xfa/fde/xml/fde_xml_imp.h" | 16 #include "xfa/fde/xml/fde_xml_imp.h" |
| 17 #include "xfa/fgas/crt/fgas_algorithm.h" | 17 #include "xfa/fgas/crt/fgas_algorithm.h" |
| 18 #include "xfa/fgas/crt/fgas_codepage.h" | 18 #include "xfa/fgas/crt/fgas_codepage.h" |
| 19 #include "xfa/fxfa/app/xfa_ffwidgetacc.h" | 19 #include "xfa/fxfa/app/xfa_ffwidgetacc.h" |
| 20 #include "xfa/fxfa/include/xfa_ffapp.h" | 20 #include "xfa/fxfa/include/xfa_ffapp.h" |
| 21 #include "xfa/fxfa/include/xfa_ffdoc.h" | 21 #include "xfa/fxfa/include/xfa_ffdoc.h" |
| 22 #include "xfa/fxfa/include/xfa_fontmgr.h" | 22 #include "xfa/fxfa/include/xfa_fontmgr.h" |
| 23 | 23 |
| 24 CXFA_CSSTagProvider::~CXFA_CSSTagProvider() { | |
| 25 FX_POSITION pos = m_Attributes.GetStartPosition(); | |
| 26 while (pos) { | |
| 27 CFX_WideString *pName = NULL, *pValue = NULL; | |
| 28 m_Attributes.GetNextAssoc(pos, (void*&)pName, (void*&)pValue); | |
| 29 delete pName; | |
| 30 delete pValue; | |
| 31 } | |
| 32 } | |
| 33 void CXFA_CSSTagProvider::GetNextAttribute(FX_POSITION& pos, | |
| 34 CFX_WideStringC& wsAttr, | |
| 35 CFX_WideStringC& wsValue) { | |
| 36 if (pos == NULL) { | |
| 37 return; | |
| 38 } | |
| 39 CFX_WideString* pName = NULL; | |
| 40 CFX_WideString* pValue = NULL; | |
| 41 m_Attributes.GetNextAssoc(pos, (void*&)pName, (void*&)pValue); | |
| 42 wsAttr = pName->AsStringC(); | |
| 43 wsValue = pValue->AsStringC(); | |
| 44 } | |
| 45 void CXFA_CSSTagProvider::SetAttribute(const CFX_WideString& wsAttr, | |
| 46 const CFX_WideString& wsValue) { | |
| 47 CFX_WideString* pName = new CFX_WideString(); | |
| 48 CFX_WideString* pValue = new CFX_WideString(); | |
| 49 *pName = wsAttr; | |
| 50 *pValue = wsValue; | |
| 51 m_Attributes.SetAt(pName, pValue); | |
| 52 } | |
| 53 void CXFA_TextParseContext::SetDecls(const IFDE_CSSDeclaration** ppDeclArray, | 24 void CXFA_TextParseContext::SetDecls(const IFDE_CSSDeclaration** ppDeclArray, |
| 54 int32_t iDeclCount) { | 25 int32_t iDeclCount) { |
| 55 if (iDeclCount <= 0 || ppDeclArray == NULL) { | 26 if (iDeclCount <= 0 || !ppDeclArray) |
| 56 return; | 27 return; |
| 57 } | 28 |
| 58 m_dwMatchedDecls = iDeclCount; | 29 m_dwMatchedDecls = iDeclCount; |
| 59 m_ppMatchedDecls = FX_Alloc(IFDE_CSSDeclaration*, iDeclCount); | 30 m_ppMatchedDecls = FX_Alloc(IFDE_CSSDeclaration*, iDeclCount); |
| 60 FXSYS_memcpy(m_ppMatchedDecls, ppDeclArray, | 31 FXSYS_memcpy(m_ppMatchedDecls, ppDeclArray, |
| 61 iDeclCount * sizeof(IFDE_CSSDeclaration*)); | 32 iDeclCount * sizeof(IFDE_CSSDeclaration*)); |
| 62 } | 33 } |
| 63 CXFA_TextParser::~CXFA_TextParser() { | 34 CXFA_TextParser::~CXFA_TextParser() { |
| 64 if (m_pUASheet) | 35 if (m_pUASheet) |
| 65 m_pUASheet->Release(); | 36 m_pUASheet->Release(); |
| 66 if (m_pSelector) | 37 if (m_pSelector) |
| 67 m_pSelector->Release(); | 38 m_pSelector->Release(); |
| (...skipping 1924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1992 tr.iLength = iLength; | 1963 tr.iLength = iLength; |
| 1993 tr.fFontSize = pPiece->fFontSize; | 1964 tr.fFontSize = pPiece->fFontSize; |
| 1994 tr.iBidiLevel = pPiece->iBidiLevel; | 1965 tr.iBidiLevel = pPiece->iBidiLevel; |
| 1995 tr.iCharRotation = 0; | 1966 tr.iCharRotation = 0; |
| 1996 tr.wLineBreakChar = L'\n'; | 1967 tr.wLineBreakChar = L'\n'; |
| 1997 tr.iVerticalScale = pPiece->iVerScale; | 1968 tr.iVerticalScale = pPiece->iVerScale; |
| 1998 tr.dwLayoutStyles = FX_RTFLAYOUTSTYLE_ExpandTab; | 1969 tr.dwLayoutStyles = FX_RTFLAYOUTSTYLE_ExpandTab; |
| 1999 tr.iHorizontalScale = pPiece->iHorScale; | 1970 tr.iHorizontalScale = pPiece->iHorScale; |
| 2000 return TRUE; | 1971 return TRUE; |
| 2001 } | 1972 } |
| OLD | NEW |