| 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 "../../include/fpdfdoc/fpdf_doc.h" | 7 #include "../../include/fpdfdoc/fpdf_doc.h" |
| 8 #include "doc_utils.h" | 8 #include "doc_utils.h" |
| 9 | 9 |
| 10 static const int FPDFDOC_UTILS_MAXRECURSION = 32; | 10 static const int FPDFDOC_UTILS_MAXRECURSION = 32; |
| 11 | 11 |
| 12 CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict) | 12 CFX_WideString GetFullName(CPDF_Dictionary* pFieldDict) |
| 13 { | 13 { |
| 14 CFX_WideString full_name; | 14 CFX_WideString full_name; |
| 15 CPDF_Dictionary* pLevel = pFieldDict; | 15 CPDF_Dictionary* pLevel = pFieldDict; |
| 16 while (pLevel) { | 16 while (pLevel) { |
| 17 CFX_WideString short_name = pLevel->GetUnicodeText("T"); | 17 CFX_WideString short_name = pLevel->GetUnicodeText("T"); |
| 18 if (short_name != L"") { | 18 if (short_name != L"") { |
| 19 if (full_name == L"") { | 19 if (full_name == L"") { |
| 20 full_name = short_name; | 20 full_name = short_name; |
| 21 } else { | 21 } else { |
| 22 full_name = short_name + L"." + full_name; | 22 full_name = short_name + L"." + full_name; |
| 23 } | 23 } |
| 24 } | 24 } |
| 25 pLevel = pLevel->GetDict("Parent"); | 25 pLevel = pLevel->GetDict("Parent"); |
| 26 } | 26 } |
| 27 return full_name; | 27 return full_name; |
| 28 } | 28 } |
| 29 FX_BOOL CPDF_DefaultAppearance::HasFont() | 29 bool CPDF_DefaultAppearance::HasFont() |
| 30 { | 30 { |
| 31 if (m_csDA.IsEmpty()) { | 31 if (m_csDA.IsEmpty()) { |
| 32 return FALSE; | 32 return false; |
| 33 } | 33 } |
| 34 CPDF_SimpleParser syntax(m_csDA); | 34 CPDF_SimpleParser syntax(m_csDA); |
| 35 return syntax.FindTagParam("Tf", 2); | 35 return syntax.FindTagParam("Tf", 2); |
| 36 } | 36 } |
| 37 CFX_ByteString CPDF_DefaultAppearance::GetFontString() | 37 CFX_ByteString CPDF_DefaultAppearance::GetFontString() |
| 38 { | 38 { |
| 39 CFX_ByteString csFont; | 39 CFX_ByteString csFont; |
| 40 if (m_csDA.IsEmpty()) { | 40 if (m_csDA.IsEmpty()) { |
| 41 return csFont; | 41 return csFont; |
| 42 } | 42 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 58 return; | 58 return; |
| 59 } | 59 } |
| 60 CPDF_SimpleParser syntax(m_csDA); | 60 CPDF_SimpleParser syntax(m_csDA); |
| 61 if (syntax.FindTagParam("Tf", 2)) { | 61 if (syntax.FindTagParam("Tf", 2)) { |
| 62 csFontNameTag = (CFX_ByteString)syntax.GetWord(); | 62 csFontNameTag = (CFX_ByteString)syntax.GetWord(); |
| 63 csFontNameTag.Delete(0, 1); | 63 csFontNameTag.Delete(0, 1); |
| 64 fFontSize = FX_atof((CFX_ByteString)syntax.GetWord()); | 64 fFontSize = FX_atof((CFX_ByteString)syntax.GetWord()); |
| 65 } | 65 } |
| 66 csFontNameTag = PDF_NameDecode(csFontNameTag); | 66 csFontNameTag = PDF_NameDecode(csFontNameTag); |
| 67 } | 67 } |
| 68 FX_BOOL CPDF_DefaultAppearance::HasColor(FX_BOOL bStrokingOperation) | 68 bool CPDF_DefaultAppearance::HasColor(bool bStrokingOperation) |
| 69 { | 69 { |
| 70 if (m_csDA.IsEmpty()) { | 70 if (m_csDA.IsEmpty()) { |
| 71 return FALSE; | 71 return false; |
| 72 } | 72 } |
| 73 CPDF_SimpleParser syntax(m_csDA); | 73 CPDF_SimpleParser syntax(m_csDA); |
| 74 if (syntax.FindTagParam(bStrokingOperation ? "G" : "g", 1)) { | 74 if (syntax.FindTagParam(bStrokingOperation ? "G" : "g", 1)) { |
| 75 return TRUE; | 75 return true; |
| 76 } | 76 } |
| 77 syntax.SetPos(0); | 77 syntax.SetPos(0); |
| 78 if (syntax.FindTagParam(bStrokingOperation ? "RG" : "rg", 3)) { | 78 if (syntax.FindTagParam(bStrokingOperation ? "RG" : "rg", 3)) { |
| 79 return TRUE; | 79 return true; |
| 80 } | 80 } |
| 81 syntax.SetPos(0); | 81 syntax.SetPos(0); |
| 82 return syntax.FindTagParam(bStrokingOperation ? "K" : "k", 4); | 82 return syntax.FindTagParam(bStrokingOperation ? "K" : "k", 4); |
| 83 } | 83 } |
| 84 CFX_ByteString CPDF_DefaultAppearance::GetColorString(FX_BOOL bStrokingOperation
) | 84 CFX_ByteString CPDF_DefaultAppearance::GetColorString(bool bStrokingOperation) |
| 85 { | 85 { |
| 86 CFX_ByteString csColor; | 86 CFX_ByteString csColor; |
| 87 if (m_csDA.IsEmpty()) { | 87 if (m_csDA.IsEmpty()) { |
| 88 return csColor; | 88 return csColor; |
| 89 } | 89 } |
| 90 CPDF_SimpleParser syntax(m_csDA); | 90 CPDF_SimpleParser syntax(m_csDA); |
| 91 if (syntax.FindTagParam(bStrokingOperation ? "G" : "g", 1)) { | 91 if (syntax.FindTagParam(bStrokingOperation ? "G" : "g", 1)) { |
| 92 csColor += (CFX_ByteString)syntax.GetWord(); | 92 csColor += (CFX_ByteString)syntax.GetWord(); |
| 93 csColor += " "; | 93 csColor += " "; |
| 94 csColor += (CFX_ByteString)syntax.GetWord(); | 94 csColor += (CFX_ByteString)syntax.GetWord(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 112 csColor += (CFX_ByteString)syntax.GetWord(); | 112 csColor += (CFX_ByteString)syntax.GetWord(); |
| 113 csColor += " "; | 113 csColor += " "; |
| 114 csColor += (CFX_ByteString)syntax.GetWord(); | 114 csColor += (CFX_ByteString)syntax.GetWord(); |
| 115 csColor += " "; | 115 csColor += " "; |
| 116 csColor += (CFX_ByteString)syntax.GetWord(); | 116 csColor += (CFX_ByteString)syntax.GetWord(); |
| 117 csColor += " "; | 117 csColor += " "; |
| 118 csColor += (CFX_ByteString)syntax.GetWord(); | 118 csColor += (CFX_ByteString)syntax.GetWord(); |
| 119 } | 119 } |
| 120 return csColor; | 120 return csColor; |
| 121 } | 121 } |
| 122 void CPDF_DefaultAppearance::GetColor(int& iColorType, FX_FLOAT fc[4], FX_BOOL b
StrokingOperation) | 122 void CPDF_DefaultAppearance::GetColor(int& iColorType, FX_FLOAT fc[4], bool bStr
okingOperation) |
| 123 { | 123 { |
| 124 iColorType = COLORTYPE_TRANSPARENT; | 124 iColorType = COLORTYPE_TRANSPARENT; |
| 125 for (int c = 0; c < 4; c ++) { | 125 for (int c = 0; c < 4; c ++) { |
| 126 fc[c] = 0; | 126 fc[c] = 0; |
| 127 } | 127 } |
| 128 if (m_csDA.IsEmpty()) { | 128 if (m_csDA.IsEmpty()) { |
| 129 return; | 129 return; |
| 130 } | 130 } |
| 131 CPDF_SimpleParser syntax(m_csDA); | 131 CPDF_SimpleParser syntax(m_csDA); |
| 132 if (syntax.FindTagParam(bStrokingOperation ? "G" : "g", 1)) { | 132 if (syntax.FindTagParam(bStrokingOperation ? "G" : "g", 1)) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 144 } | 144 } |
| 145 syntax.SetPos(0); | 145 syntax.SetPos(0); |
| 146 if (syntax.FindTagParam(bStrokingOperation ? "K" : "k", 4)) { | 146 if (syntax.FindTagParam(bStrokingOperation ? "K" : "k", 4)) { |
| 147 iColorType = COLORTYPE_CMYK; | 147 iColorType = COLORTYPE_CMYK; |
| 148 fc[0] = FX_atof((CFX_ByteString)syntax.GetWord()); | 148 fc[0] = FX_atof((CFX_ByteString)syntax.GetWord()); |
| 149 fc[1] = FX_atof((CFX_ByteString)syntax.GetWord()); | 149 fc[1] = FX_atof((CFX_ByteString)syntax.GetWord()); |
| 150 fc[2] = FX_atof((CFX_ByteString)syntax.GetWord()); | 150 fc[2] = FX_atof((CFX_ByteString)syntax.GetWord()); |
| 151 fc[3] = FX_atof((CFX_ByteString)syntax.GetWord()); | 151 fc[3] = FX_atof((CFX_ByteString)syntax.GetWord()); |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 void CPDF_DefaultAppearance::GetColor(FX_ARGB& color, int& iColorType, FX_BOOL b
StrokingOperation) | 154 void CPDF_DefaultAppearance::GetColor(FX_ARGB& color, int& iColorType, bool bStr
okingOperation) |
| 155 { | 155 { |
| 156 color = 0; | 156 color = 0; |
| 157 iColorType = COLORTYPE_TRANSPARENT; | 157 iColorType = COLORTYPE_TRANSPARENT; |
| 158 if (m_csDA.IsEmpty()) { | 158 if (m_csDA.IsEmpty()) { |
| 159 return; | 159 return; |
| 160 } | 160 } |
| 161 CPDF_SimpleParser syntax(m_csDA); | 161 CPDF_SimpleParser syntax(m_csDA); |
| 162 if (syntax.FindTagParam(bStrokingOperation ? "G" : "g", 1)) { | 162 if (syntax.FindTagParam(bStrokingOperation ? "G" : "g", 1)) { |
| 163 iColorType = COLORTYPE_GRAY; | 163 iColorType = COLORTYPE_GRAY; |
| 164 FX_FLOAT g = FX_atof((CFX_ByteString)syntax.GetWord()) * 255 + 0.5f; | 164 FX_FLOAT g = FX_atof((CFX_ByteString)syntax.GetWord()) * 255 + 0.5f; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 180 FX_FLOAT c = FX_atof((CFX_ByteString)syntax.GetWord()); | 180 FX_FLOAT c = FX_atof((CFX_ByteString)syntax.GetWord()); |
| 181 FX_FLOAT m = FX_atof((CFX_ByteString)syntax.GetWord()); | 181 FX_FLOAT m = FX_atof((CFX_ByteString)syntax.GetWord()); |
| 182 FX_FLOAT y = FX_atof((CFX_ByteString)syntax.GetWord()); | 182 FX_FLOAT y = FX_atof((CFX_ByteString)syntax.GetWord()); |
| 183 FX_FLOAT k = FX_atof((CFX_ByteString)syntax.GetWord()); | 183 FX_FLOAT k = FX_atof((CFX_ByteString)syntax.GetWord()); |
| 184 FX_FLOAT r = 1.0f - FX_MIN(1.0f, c + k); | 184 FX_FLOAT r = 1.0f - FX_MIN(1.0f, c + k); |
| 185 FX_FLOAT g = 1.0f - FX_MIN(1.0f, m + k); | 185 FX_FLOAT g = 1.0f - FX_MIN(1.0f, m + k); |
| 186 FX_FLOAT b = 1.0f - FX_MIN(1.0f, y + k); | 186 FX_FLOAT b = 1.0f - FX_MIN(1.0f, y + k); |
| 187 color = ArgbEncode(255, (int)(r * 255 + 0.5f), (int)(g * 255 + 0.5f), (i
nt)(b * 255 + 0.5f)); | 187 color = ArgbEncode(255, (int)(r * 255 + 0.5f), (int)(g * 255 + 0.5f), (i
nt)(b * 255 + 0.5f)); |
| 188 } | 188 } |
| 189 } | 189 } |
| 190 FX_BOOL CPDF_DefaultAppearance::HasTextMatrix() | 190 bool CPDF_DefaultAppearance::HasTextMatrix() |
| 191 { | 191 { |
| 192 if (m_csDA.IsEmpty()) { | 192 if (m_csDA.IsEmpty()) { |
| 193 return FALSE; | 193 return false; |
| 194 } | 194 } |
| 195 CPDF_SimpleParser syntax(m_csDA); | 195 CPDF_SimpleParser syntax(m_csDA); |
| 196 return syntax.FindTagParam("Tm", 6); | 196 return syntax.FindTagParam("Tm", 6); |
| 197 } | 197 } |
| 198 CFX_ByteString CPDF_DefaultAppearance::GetTextMatrixString() | 198 CFX_ByteString CPDF_DefaultAppearance::GetTextMatrixString() |
| 199 { | 199 { |
| 200 CFX_ByteString csTM; | 200 CFX_ByteString csTM; |
| 201 if (m_csDA.IsEmpty()) { | 201 if (m_csDA.IsEmpty()) { |
| 202 return csTM; | 202 return csTM; |
| 203 } | 203 } |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 CPDF_Font* pFont = GetDefaultInterFormFont(pFormDict, pDocument); | 461 CPDF_Font* pFont = GetDefaultInterFormFont(pFormDict, pDocument); |
| 462 if (pFont != NULL) { | 462 if (pFont != NULL) { |
| 463 pSubst = (CFX_SubstFont*)pFont->GetSubstFont(); | 463 pSubst = (CFX_SubstFont*)pFont->GetSubstFont(); |
| 464 if (pSubst != NULL && pSubst->m_Charset == (int)charSet) { | 464 if (pSubst != NULL && pSubst->m_Charset == (int)charSet) { |
| 465 FindInterFormFont(pFormDict, pFont, csNameTag); | 465 FindInterFormFont(pFormDict, pFont, csNameTag); |
| 466 return pFont; | 466 return pFont; |
| 467 } | 467 } |
| 468 } | 468 } |
| 469 return GetNativeInterFormFont(pFormDict, pDocument, charSet, csNameTag); | 469 return GetNativeInterFormFont(pFormDict, pDocument, charSet, csNameTag); |
| 470 } | 470 } |
| 471 FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont, CF
X_ByteString& csNameTag) | 471 bool FindInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont, CFX_B
yteString& csNameTag) |
| 472 { | 472 { |
| 473 if (pFormDict == NULL || pFont == NULL) { | 473 if (pFormDict == NULL || pFont == NULL) { |
| 474 return FALSE; | 474 return false; |
| 475 } | 475 } |
| 476 CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); | 476 CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); |
| 477 if (pDR == NULL) { | 477 if (pDR == NULL) { |
| 478 return FALSE; | 478 return false; |
| 479 } | 479 } |
| 480 CPDF_Dictionary* pFonts = pDR->GetDict("Font"); | 480 CPDF_Dictionary* pFonts = pDR->GetDict("Font"); |
| 481 if (pFonts == NULL) { | 481 if (pFonts == NULL) { |
| 482 return FALSE; | 482 return false; |
| 483 } | 483 } |
| 484 FX_POSITION pos = pFonts->GetStartPos(); | 484 FX_POSITION pos = pFonts->GetStartPos(); |
| 485 while (pos) { | 485 while (pos) { |
| 486 CPDF_Object* pObj = NULL; | 486 CPDF_Object* pObj = NULL; |
| 487 CFX_ByteString csKey; | 487 CFX_ByteString csKey; |
| 488 pObj = pFonts->GetNextElement(pos, csKey); | 488 pObj = pFonts->GetNextElement(pos, csKey); |
| 489 if (pObj == NULL) { | 489 if (pObj == NULL) { |
| 490 continue; | 490 continue; |
| 491 } | 491 } |
| 492 CPDF_Object* pDirect = pObj->GetDirect(); | 492 CPDF_Object* pDirect = pObj->GetDirect(); |
| 493 if (pDirect == NULL || pDirect->GetType() != PDFOBJ_DICTIONARY) { | 493 if (pDirect == NULL || pDirect->GetType() != PDFOBJ_DICTIONARY) { |
| 494 continue; | 494 continue; |
| 495 } | 495 } |
| 496 CPDF_Dictionary* pElement = (CPDF_Dictionary*)pDirect; | 496 CPDF_Dictionary* pElement = (CPDF_Dictionary*)pDirect; |
| 497 if (pElement->GetString("Type") != "Font") { | 497 if (pElement->GetString("Type") != "Font") { |
| 498 continue; | 498 continue; |
| 499 } | 499 } |
| 500 if (pFont->GetFontDict() == pElement) { | 500 if (pFont->GetFontDict() == pElement) { |
| 501 csNameTag = csKey; | 501 csNameTag = csKey; |
| 502 return TRUE; | 502 return true; |
| 503 } | 503 } |
| 504 } | 504 } |
| 505 return FALSE; | 505 return false; |
| 506 } | 506 } |
| 507 FX_BOOL FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument,
CFX_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag) | 507 bool FindInterFormFont(CPDF_Dictionary* pFormDict, CPDF_Document* pDocument, CFX
_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag) |
| 508 { | 508 { |
| 509 if (pFormDict == NULL) { | 509 if (pFormDict == NULL) { |
| 510 return FALSE; | 510 return false; |
| 511 } | 511 } |
| 512 CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); | 512 CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); |
| 513 if (pDR == NULL) { | 513 if (pDR == NULL) { |
| 514 return FALSE; | 514 return false; |
| 515 } | 515 } |
| 516 CPDF_Dictionary* pFonts = pDR->GetDict("Font"); | 516 CPDF_Dictionary* pFonts = pDR->GetDict("Font"); |
| 517 if (pFonts == NULL) { | 517 if (pFonts == NULL) { |
| 518 return FALSE; | 518 return false; |
| 519 } | 519 } |
| 520 if (csFontName.GetLength() > 0) { | 520 if (csFontName.GetLength() > 0) { |
| 521 csFontName.Remove(' '); | 521 csFontName.Remove(' '); |
| 522 } | 522 } |
| 523 FX_POSITION pos = pFonts->GetStartPos(); | 523 FX_POSITION pos = pFonts->GetStartPos(); |
| 524 while (pos) { | 524 while (pos) { |
| 525 CPDF_Object* pObj = NULL; | 525 CPDF_Object* pObj = NULL; |
| 526 CFX_ByteString csKey, csTmp; | 526 CFX_ByteString csKey, csTmp; |
| 527 pObj = pFonts->GetNextElement(pos, csKey); | 527 pObj = pFonts->GetNextElement(pos, csKey); |
| 528 if (pObj == NULL) { | 528 if (pObj == NULL) { |
| 529 continue; | 529 continue; |
| 530 } | 530 } |
| 531 CPDF_Object* pDirect = pObj->GetDirect(); | 531 CPDF_Object* pDirect = pObj->GetDirect(); |
| 532 if (pDirect == NULL || pDirect->GetType() != PDFOBJ_DICTIONARY) { | 532 if (pDirect == NULL || pDirect->GetType() != PDFOBJ_DICTIONARY) { |
| 533 continue; | 533 continue; |
| 534 } | 534 } |
| 535 CPDF_Dictionary* pElement = (CPDF_Dictionary*)pDirect; | 535 CPDF_Dictionary* pElement = (CPDF_Dictionary*)pDirect; |
| 536 if (pElement->GetString("Type") != "Font") { | 536 if (pElement->GetString("Type") != "Font") { |
| 537 continue; | 537 continue; |
| 538 } | 538 } |
| 539 pFont = pDocument->LoadFont(pElement); | 539 pFont = pDocument->LoadFont(pElement); |
| 540 if (pFont == NULL) { | 540 if (pFont == NULL) { |
| 541 continue; | 541 continue; |
| 542 } | 542 } |
| 543 CFX_ByteString csBaseFont; | 543 CFX_ByteString csBaseFont; |
| 544 csBaseFont = pFont->GetBaseFont(); | 544 csBaseFont = pFont->GetBaseFont(); |
| 545 csBaseFont.Remove(' '); | 545 csBaseFont.Remove(' '); |
| 546 if (csBaseFont == csFontName) { | 546 if (csBaseFont == csFontName) { |
| 547 csNameTag = csKey; | 547 csNameTag = csKey; |
| 548 return TRUE; | 548 return true; |
| 549 } | 549 } |
| 550 } | 550 } |
| 551 return FALSE; | 551 return false; |
| 552 } | 552 } |
| 553 void AddInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, con
st CPDF_Font* pFont, CFX_ByteString& csNameTag) | 553 void AddInterFormFont(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument, con
st CPDF_Font* pFont, CFX_ByteString& csNameTag) |
| 554 { | 554 { |
| 555 if (pFont == NULL) { | 555 if (pFont == NULL) { |
| 556 return; | 556 return; |
| 557 } | 557 } |
| 558 if (pFormDict == NULL) { | 558 if (pFormDict == NULL) { |
| 559 InitInterFormDict(pFormDict, pDocument); | 559 InitInterFormDict(pFormDict, pDocument); |
| 560 } | 560 } |
| 561 CFX_ByteString csTag; | 561 CFX_ByteString csTag; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 CFX_ByteString csSW = m_pDict->GetString("SW", "A"); | 661 CFX_ByteString csSW = m_pDict->GetString("SW", "A"); |
| 662 if (csSW == "B") { | 662 if (csSW == "B") { |
| 663 return Bigger; | 663 return Bigger; |
| 664 } else if (csSW == "S") { | 664 } else if (csSW == "S") { |
| 665 return Smaller; | 665 return Smaller; |
| 666 } else if (csSW == "N") { | 666 } else if (csSW == "N") { |
| 667 return Never; | 667 return Never; |
| 668 } | 668 } |
| 669 return Always; | 669 return Always; |
| 670 } | 670 } |
| 671 FX_BOOL CPDF_IconFit::IsProportionalScale() | 671 bool CPDF_IconFit::IsProportionalScale() |
| 672 { | 672 { |
| 673 if (m_pDict == NULL) { | 673 if (m_pDict == NULL) { |
| 674 return TRUE; | 674 return true; |
| 675 } | 675 } |
| 676 return m_pDict->GetString("S", "P") != "A"; | 676 return m_pDict->GetString("S", "P") != "A"; |
| 677 } | 677 } |
| 678 void CPDF_IconFit::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) | 678 void CPDF_IconFit::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) |
| 679 { | 679 { |
| 680 fLeft = fBottom = 0.5; | 680 fLeft = fBottom = 0.5; |
| 681 if (m_pDict == NULL) { | 681 if (m_pDict == NULL) { |
| 682 return; | 682 return; |
| 683 } | 683 } |
| 684 CPDF_Array* pA = m_pDict->GetArray("A"); | 684 CPDF_Array* pA = m_pDict->GetArray("A"); |
| 685 if (pA != NULL) { | 685 if (pA != NULL) { |
| 686 FX_DWORD dwCount = pA->GetCount(); | 686 FX_DWORD dwCount = pA->GetCount(); |
| 687 if (dwCount > 0) { | 687 if (dwCount > 0) { |
| 688 fLeft = pA->GetNumber(0); | 688 fLeft = pA->GetNumber(0); |
| 689 } | 689 } |
| 690 if (dwCount > 1) { | 690 if (dwCount > 1) { |
| 691 fBottom = pA->GetNumber(1); | 691 fBottom = pA->GetNumber(1); |
| 692 } | 692 } |
| 693 } | 693 } |
| 694 } | 694 } |
| 695 FX_BOOL CPDF_IconFit::GetFittingBounds() | 695 bool CPDF_IconFit::GetFittingBounds() |
| 696 { | 696 { |
| 697 if (m_pDict == NULL) { | 697 if (m_pDict == NULL) { |
| 698 return FALSE; | 698 return false; |
| 699 } | 699 } |
| 700 return m_pDict->GetBoolean("FB"); | 700 return m_pDict->GetBoolean("FB"); |
| 701 } | 701 } |
| 702 void SaveCheckedFieldStatus(CPDF_FormField* pField, CFX_ByteArray& statusArray) | 702 void SaveCheckedFieldStatus(CPDF_FormField* pField, CFX_ByteArray& statusArray) |
| 703 { | 703 { |
| 704 int iCount = pField->CountControls(); | 704 int iCount = pField->CountControls(); |
| 705 for (int i = 0; i < iCount; i ++) { | 705 for (int i = 0; i < iCount; i ++) { |
| 706 CPDF_FormControl* pControl = pField->GetControl(i); | 706 CPDF_FormControl* pControl = pField->GetControl(i); |
| 707 if (pControl == NULL) { | 707 if (pControl == NULL) { |
| 708 continue; | 708 continue; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 721 CPDF_Object* pAttr = pFieldDict->GetElementValue(name); | 721 CPDF_Object* pAttr = pFieldDict->GetElementValue(name); |
| 722 if (pAttr) { | 722 if (pAttr) { |
| 723 return pAttr; | 723 return pAttr; |
| 724 } | 724 } |
| 725 CPDF_Dictionary* pParent = pFieldDict->GetDict("Parent"); | 725 CPDF_Dictionary* pParent = pFieldDict->GetDict("Parent"); |
| 726 if (pParent == NULL) { | 726 if (pParent == NULL) { |
| 727 return NULL; | 727 return NULL; |
| 728 } | 728 } |
| 729 return FPDF_GetFieldAttr(pParent, name, nLevel + 1); | 729 return FPDF_GetFieldAttr(pParent, name, nLevel + 1); |
| 730 } | 730 } |
| OLD | NEW |