Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: core/src/fpdfdoc/doc_vt.cpp

Issue 1512763013: Get rid of most instance of 'foo != NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nits Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fpdfdoc/doc_utils.cpp ('k') | core/src/fxcodec/codec/fx_codec_jpeg.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "core/include/fpdfdoc/fpdf_doc.h" 7 #include "core/include/fpdfdoc/fpdf_doc.h"
8 #include "core/include/fpdfdoc/fpdf_vt.h" 8 #include "core/include/fpdfdoc/fpdf_vt.h"
9 #include "pdf_vt.h" 9 #include "pdf_vt.h"
10 10
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 m_WordArray.Add(pWord); 77 m_WordArray.Add(pWord);
78 } else { 78 } else {
79 m_WordArray.InsertAt(nWordIndex, pWord); 79 m_WordArray.InsertAt(nWordIndex, pWord);
80 } 80 }
81 return place; 81 return place;
82 } 82 }
83 CPVT_WordPlace CSection::AddLine(const CPVT_LineInfo& lineinfo) { 83 CPVT_WordPlace CSection::AddLine(const CPVT_LineInfo& lineinfo) {
84 return CPVT_WordPlace(SecPlace.nSecIndex, m_LineArray.Add(lineinfo), -1); 84 return CPVT_WordPlace(SecPlace.nSecIndex, m_LineArray.Add(lineinfo), -1);
85 } 85 }
86 CPVT_FloatRect CSection::Rearrange() { 86 CPVT_FloatRect CSection::Rearrange() {
87 ASSERT(m_pVT != NULL);
88 if (m_pVT->m_nCharArray > 0) { 87 if (m_pVT->m_nCharArray > 0) {
89 return CTypeset(this).CharArray(); 88 return CTypeset(this).CharArray();
90 } 89 }
91 return CTypeset(this).Typeset(); 90 return CTypeset(this).Typeset();
92 } 91 }
93 CPVT_Size CSection::GetSectionSize(FX_FLOAT fFontSize) { 92 CPVT_Size CSection::GetSectionSize(FX_FLOAT fFontSize) {
94 return CTypeset(this).GetEditSize(fFontSize); 93 return CTypeset(this).GetEditSize(fFontSize);
95 } 94 }
96 CPVT_WordPlace CSection::GetBeginWordPlace() const { 95 CPVT_WordPlace CSection::GetBeginWordPlace() const {
97 if (CLine* pLine = m_LineArray.GetAt(0)) { 96 if (CLine* pLine = m_LineArray.GetAt(0)) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 } else { 158 } else {
160 place.nLineIndex = nMid; 159 place.nLineIndex = nMid;
161 return; 160 return;
162 } 161 }
163 } else { 162 } else {
164 break; 163 break;
165 } 164 }
166 } 165 }
167 } 166 }
168 CPVT_WordPlace CSection::SearchWordPlace(const CPDF_Point& point) const { 167 CPVT_WordPlace CSection::SearchWordPlace(const CPDF_Point& point) const {
169 ASSERT(m_pVT != NULL); 168 ASSERT(m_pVT);
170 CPVT_WordPlace place = GetBeginWordPlace(); 169 CPVT_WordPlace place = GetBeginWordPlace();
171 FX_BOOL bUp = TRUE; 170 FX_BOOL bUp = TRUE;
172 FX_BOOL bDown = TRUE; 171 FX_BOOL bDown = TRUE;
173 int32_t nLeft = 0; 172 int32_t nLeft = 0;
174 int32_t nRight = m_LineArray.GetSize() - 1; 173 int32_t nRight = m_LineArray.GetSize() - 1;
175 int32_t nMid = m_LineArray.GetSize() / 2; 174 int32_t nMid = m_LineArray.GetSize() / 2;
176 FX_FLOAT fTop = 0; 175 FX_FLOAT fTop = 0;
177 FX_FLOAT fBottom = 0; 176 FX_FLOAT fBottom = 0;
178 while (nLeft <= nRight) { 177 while (nLeft <= nRight) {
179 if (CLine* pLine = m_LineArray.GetAt(nMid)) { 178 if (CLine* pLine = m_LineArray.GetAt(nMid)) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 void CSection::ClearWord(const CPVT_WordPlace& place) { 298 void CSection::ClearWord(const CPVT_WordPlace& place) {
300 delete m_WordArray.GetAt(place.nWordIndex); 299 delete m_WordArray.GetAt(place.nWordIndex);
301 m_WordArray.RemoveAt(place.nWordIndex); 300 m_WordArray.RemoveAt(place.nWordIndex);
302 } 301 }
303 CTypeset::CTypeset(CSection* pSection) 302 CTypeset::CTypeset(CSection* pSection)
304 : m_rcRet(0.0f, 0.0f, 0.0f, 0.0f), 303 : m_rcRet(0.0f, 0.0f, 0.0f, 0.0f),
305 m_pVT(pSection->m_pVT), 304 m_pVT(pSection->m_pVT),
306 m_pSection(pSection) {} 305 m_pSection(pSection) {}
307 CTypeset::~CTypeset() {} 306 CTypeset::~CTypeset() {}
308 CPVT_FloatRect CTypeset::CharArray() { 307 CPVT_FloatRect CTypeset::CharArray() {
309 ASSERT(m_pSection != NULL); 308 ASSERT(m_pSection);
310 ASSERT(m_pVT != NULL);
311 FX_FLOAT fLineAscent = 309 FX_FLOAT fLineAscent =
312 m_pVT->GetFontAscent(m_pVT->GetDefaultFontIndex(), m_pVT->GetFontSize()); 310 m_pVT->GetFontAscent(m_pVT->GetDefaultFontIndex(), m_pVT->GetFontSize());
313 FX_FLOAT fLineDescent = 311 FX_FLOAT fLineDescent =
314 m_pVT->GetFontDescent(m_pVT->GetDefaultFontIndex(), m_pVT->GetFontSize()); 312 m_pVT->GetFontDescent(m_pVT->GetDefaultFontIndex(), m_pVT->GetFontSize());
315 m_rcRet.Default(); 313 m_rcRet.Default();
316 FX_FLOAT x = 0.0f, y = 0.0f; 314 FX_FLOAT x = 0.0f, y = 0.0f;
317 FX_FLOAT fNextWidth; 315 FX_FLOAT fNextWidth;
318 int32_t nStart = 0; 316 int32_t nStart = 0;
319 FX_FLOAT fNodeWidth = m_pVT->GetPlateWidth() / 317 FX_FLOAT fNodeWidth = m_pVT->GetPlateWidth() /
320 (m_pVT->m_nCharArray <= 0 ? 1 : m_pVT->m_nCharArray); 318 (m_pVT->m_nCharArray <= 0 ? 1 : m_pVT->m_nCharArray);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 pLine->m_LineInfo.nEndWordIndex = m_pSection->m_WordArray.GetSize() - 1; 373 pLine->m_LineInfo.nEndWordIndex = m_pSection->m_WordArray.GetSize() - 1;
376 pLine->m_LineInfo.fLineY = y; 374 pLine->m_LineInfo.fLineY = y;
377 pLine->m_LineInfo.fLineWidth = x - pLine->m_LineInfo.fLineX; 375 pLine->m_LineInfo.fLineWidth = x - pLine->m_LineInfo.fLineX;
378 pLine->m_LineInfo.fLineAscent = fLineAscent; 376 pLine->m_LineInfo.fLineAscent = fLineAscent;
379 pLine->m_LineInfo.fLineDescent = fLineDescent; 377 pLine->m_LineInfo.fLineDescent = fLineDescent;
380 y += (-fLineDescent); 378 y += (-fLineDescent);
381 } 379 }
382 return m_rcRet = CPVT_FloatRect(0, 0, x, y); 380 return m_rcRet = CPVT_FloatRect(0, 0, x, y);
383 } 381 }
384 CPVT_Size CTypeset::GetEditSize(FX_FLOAT fFontSize) { 382 CPVT_Size CTypeset::GetEditSize(FX_FLOAT fFontSize) {
385 ASSERT(m_pSection != NULL); 383 ASSERT(m_pSection);
386 ASSERT(m_pVT != NULL); 384 ASSERT(m_pVT);
387 SplitLines(FALSE, fFontSize); 385 SplitLines(FALSE, fFontSize);
388 return CPVT_Size(m_rcRet.Width(), m_rcRet.Height()); 386 return CPVT_Size(m_rcRet.Width(), m_rcRet.Height());
389 } 387 }
390 CPVT_FloatRect CTypeset::Typeset() { 388 CPVT_FloatRect CTypeset::Typeset() {
391 ASSERT(m_pSection != NULL); 389 ASSERT(m_pVT);
392 ASSERT(m_pVT != NULL);
393 m_pSection->m_LineArray.Empty(); 390 m_pSection->m_LineArray.Empty();
394 SplitLines(TRUE, 0.0f); 391 SplitLines(TRUE, 0.0f);
395 m_pSection->m_LineArray.Clear(); 392 m_pSection->m_LineArray.Clear();
396 OutputLines(); 393 OutputLines();
397 return m_rcRet; 394 return m_rcRet;
398 } 395 }
399 static int special_chars[128] = { 396 static int special_chars[128] = {
400 0x0000, 0x000C, 0x0008, 0x000C, 0x0008, 0x0000, 0x0020, 0x0000, 0x0000, 397 0x0000, 0x000C, 0x0008, 0x000C, 0x0008, 0x0000, 0x0020, 0x0000, 0x0000,
401 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 398 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
402 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 399 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 } 561 }
565 if (IsPrefixSymbol(curWord) || IsCJK(curWord)) { 562 if (IsPrefixSymbol(curWord) || IsCJK(curWord)) {
566 return TRUE; 563 return TRUE;
567 } 564 }
568 if (IsCJK(prevWord)) { 565 if (IsCJK(prevWord)) {
569 return TRUE; 566 return TRUE;
570 } 567 }
571 return FALSE; 568 return FALSE;
572 } 569 }
573 void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize) { 570 void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize) {
574 ASSERT(m_pVT != NULL); 571 ASSERT(m_pVT);
575 ASSERT(m_pSection != NULL); 572 ASSERT(m_pSection);
576 int32_t nLineHead = 0; 573 int32_t nLineHead = 0;
577 int32_t nLineTail = 0; 574 int32_t nLineTail = 0;
578 FX_FLOAT fMaxX = 0.0f, fMaxY = 0.0f; 575 FX_FLOAT fMaxX = 0.0f, fMaxY = 0.0f;
579 FX_FLOAT fLineWidth = 0.0f, fBackupLineWidth = 0.0f; 576 FX_FLOAT fLineWidth = 0.0f, fBackupLineWidth = 0.0f;
580 FX_FLOAT fLineAscent = 0.0f, fBackupLineAscent = 0.0f; 577 FX_FLOAT fLineAscent = 0.0f, fBackupLineAscent = 0.0f;
581 FX_FLOAT fLineDescent = 0.0f, fBackupLineDescent = 0.0f; 578 FX_FLOAT fLineDescent = 0.0f, fBackupLineDescent = 0.0f;
582 int32_t nWordStartPos = 0; 579 int32_t nWordStartPos = 0;
583 FX_BOOL bFullWord = FALSE; 580 FX_BOOL bFullWord = FALSE;
584 int32_t nLineFullWordIndex = 0; 581 int32_t nLineFullWordIndex = 0;
585 int32_t nCharIndex = 0; 582 int32_t nCharIndex = 0;
(...skipping 26 matching lines...) Expand all
612 FPDF_MIN(fLineDescent, m_pVT->GetWordDescent(*pWord, fFontSize)); 609 FPDF_MIN(fLineDescent, m_pVT->GetWordDescent(*pWord, fFontSize));
613 fWordWidth = m_pVT->GetWordWidth( 610 fWordWidth = m_pVT->GetWordWidth(
614 pWord->nFontIndex, pWord->Word, m_pVT->m_wSubWord, 611 pWord->nFontIndex, pWord->Word, m_pVT->m_wSubWord,
615 m_pVT->m_fCharSpace, m_pVT->m_nHorzScale, fFontSize, 612 m_pVT->m_fCharSpace, m_pVT->m_nHorzScale, fFontSize,
616 pWord->fWordTail, 0); 613 pWord->fWordTail, 0);
617 } 614 }
618 if (!bOpened) { 615 if (!bOpened) {
619 if (IsOpenStylePunctuation(pWord->Word)) { 616 if (IsOpenStylePunctuation(pWord->Word)) {
620 bOpened = TRUE; 617 bOpened = TRUE;
621 bFullWord = TRUE; 618 bFullWord = TRUE;
622 } else if (pOldWord != NULL) { 619 } else if (pOldWord) {
623 if (NeedDivision(pOldWord->Word, pWord->Word)) { 620 if (NeedDivision(pOldWord->Word, pWord->Word)) {
624 bFullWord = TRUE; 621 bFullWord = TRUE;
625 } 622 }
626 } 623 }
627 } else { 624 } else {
628 if (!IsSpace(pWord->Word) && !IsOpenStylePunctuation(pWord->Word)) { 625 if (!IsSpace(pWord->Word) && !IsOpenStylePunctuation(pWord->Word)) {
629 bOpened = FALSE; 626 bOpened = FALSE;
630 } 627 }
631 } 628 }
632 if (bFullWord) { 629 if (bFullWord) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
711 line.fLineAscent = fLineAscent; 708 line.fLineAscent = fLineAscent;
712 line.fLineDescent = fLineDescent; 709 line.fLineDescent = fLineDescent;
713 m_pSection->AddLine(line); 710 m_pSection->AddLine(line);
714 } 711 }
715 fMaxY += (m_pVT->GetLineLeading(m_pSection->m_SecInfo) + fLineAscent + 712 fMaxY += (m_pVT->GetLineLeading(m_pSection->m_SecInfo) + fLineAscent +
716 (-fLineDescent)); 713 (-fLineDescent));
717 } 714 }
718 m_rcRet = CPVT_FloatRect(0, 0, fMaxX, fMaxY); 715 m_rcRet = CPVT_FloatRect(0, 0, fMaxX, fMaxY);
719 } 716 }
720 void CTypeset::OutputLines() { 717 void CTypeset::OutputLines() {
721 ASSERT(m_pVT != NULL); 718 ASSERT(m_pVT);
722 ASSERT(m_pSection != NULL); 719 ASSERT(m_pSection);
723 FX_FLOAT fMinX = 0.0f, fMinY = 0.0f, fMaxX = 0.0f, fMaxY = 0.0f; 720 FX_FLOAT fMinX = 0.0f, fMinY = 0.0f, fMaxX = 0.0f, fMaxY = 0.0f;
724 FX_FLOAT fPosX = 0.0f, fPosY = 0.0f; 721 FX_FLOAT fPosX = 0.0f, fPosY = 0.0f;
725 FX_FLOAT fLineIndent = m_pVT->GetLineIndent(m_pSection->m_SecInfo); 722 FX_FLOAT fLineIndent = m_pVT->GetLineIndent(m_pSection->m_SecInfo);
726 FX_FLOAT fTypesetWidth = FPDF_MAX(m_pVT->GetPlateWidth() - fLineIndent, 0.0f); 723 FX_FLOAT fTypesetWidth = FPDF_MAX(m_pVT->GetPlateWidth() - fLineIndent, 0.0f);
727 switch (m_pVT->GetAlignment(m_pSection->m_SecInfo)) { 724 switch (m_pVT->GetAlignment(m_pSection->m_SecInfo)) {
728 default: 725 default:
729 case 0: 726 case 0:
730 fMinX = 0.0f; 727 fMinX = 0.0f;
731 break; 728 break;
732 case 1: 729 case 1:
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after
1670 IPDF_VariableText_Provider* CPDF_VariableText::SetProvider( 1667 IPDF_VariableText_Provider* CPDF_VariableText::SetProvider(
1671 IPDF_VariableText_Provider* pProvider) { 1668 IPDF_VariableText_Provider* pProvider) {
1672 IPDF_VariableText_Provider* pOld = m_pVTProvider; 1669 IPDF_VariableText_Provider* pOld = m_pVTProvider;
1673 m_pVTProvider = pProvider; 1670 m_pVTProvider = pProvider;
1674 return pOld; 1671 return pOld;
1675 } 1672 }
1676 CPDF_VariableText_Iterator::CPDF_VariableText_Iterator(CPDF_VariableText* pVT) 1673 CPDF_VariableText_Iterator::CPDF_VariableText_Iterator(CPDF_VariableText* pVT)
1677 : m_CurPos(-1, -1, -1), m_pVT(pVT) {} 1674 : m_CurPos(-1, -1, -1), m_pVT(pVT) {}
1678 CPDF_VariableText_Iterator::~CPDF_VariableText_Iterator() {} 1675 CPDF_VariableText_Iterator::~CPDF_VariableText_Iterator() {}
1679 void CPDF_VariableText_Iterator::SetAt(int32_t nWordIndex) { 1676 void CPDF_VariableText_Iterator::SetAt(int32_t nWordIndex) {
1680 ASSERT(m_pVT != NULL);
1681 m_CurPos = m_pVT->WordIndexToWordPlace(nWordIndex); 1677 m_CurPos = m_pVT->WordIndexToWordPlace(nWordIndex);
1682 } 1678 }
1683 void CPDF_VariableText_Iterator::SetAt(const CPVT_WordPlace& place) { 1679 void CPDF_VariableText_Iterator::SetAt(const CPVT_WordPlace& place) {
1684 ASSERT(m_pVT != NULL); 1680 ASSERT(m_pVT);
1685 m_CurPos = place; 1681 m_CurPos = place;
1686 } 1682 }
1687 FX_BOOL CPDF_VariableText_Iterator::NextWord() { 1683 FX_BOOL CPDF_VariableText_Iterator::NextWord() {
1688 if (m_CurPos == m_pVT->GetEndWordPlace()) { 1684 if (m_CurPos == m_pVT->GetEndWordPlace()) {
1689 return FALSE; 1685 return FALSE;
1690 } 1686 }
1691 m_CurPos = m_pVT->GetNextWordPlace(m_CurPos); 1687 m_CurPos = m_pVT->GetNextWordPlace(m_CurPos);
1692 return TRUE; 1688 return TRUE;
1693 } 1689 }
1694 FX_BOOL CPDF_VariableText_Iterator::PrevWord() { 1690 FX_BOOL CPDF_VariableText_Iterator::PrevWord() {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1731 return FALSE; 1727 return FALSE;
1732 } 1728 }
1733 FX_BOOL CPDF_VariableText_Iterator::NextSection() { 1729 FX_BOOL CPDF_VariableText_Iterator::NextSection() {
1734 if (m_CurPos.nSecIndex < m_pVT->m_SectionArray.GetSize() - 1) { 1730 if (m_CurPos.nSecIndex < m_pVT->m_SectionArray.GetSize() - 1) {
1735 m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex + 1, 0, -1); 1731 m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex + 1, 0, -1);
1736 return TRUE; 1732 return TRUE;
1737 } 1733 }
1738 return FALSE; 1734 return FALSE;
1739 } 1735 }
1740 FX_BOOL CPDF_VariableText_Iterator::PrevSection() { 1736 FX_BOOL CPDF_VariableText_Iterator::PrevSection() {
1741 ASSERT(m_pVT != NULL); 1737 ASSERT(m_pVT);
1742 if (m_CurPos.nSecIndex > 0) { 1738 if (m_CurPos.nSecIndex > 0) {
1743 m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex - 1, 0, -1); 1739 m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex - 1, 0, -1);
1744 return TRUE; 1740 return TRUE;
1745 } 1741 }
1746 return FALSE; 1742 return FALSE;
1747 } 1743 }
1748 FX_BOOL CPDF_VariableText_Iterator::GetWord(CPVT_Word& word) const { 1744 FX_BOOL CPDF_VariableText_Iterator::GetWord(CPVT_Word& word) const {
1749 ASSERT(m_pVT != NULL);
1750 word.WordPlace = m_CurPos; 1745 word.WordPlace = m_CurPos;
1751 if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { 1746 if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
1752 if (pSection->m_LineArray.GetAt(m_CurPos.nLineIndex)) { 1747 if (pSection->m_LineArray.GetAt(m_CurPos.nLineIndex)) {
1753 if (CPVT_WordInfo* pWord = 1748 if (CPVT_WordInfo* pWord =
1754 pSection->m_WordArray.GetAt(m_CurPos.nWordIndex)) { 1749 pSection->m_WordArray.GetAt(m_CurPos.nWordIndex)) {
1755 word.Word = pWord->Word; 1750 word.Word = pWord->Word;
1756 word.nCharset = pWord->nCharset; 1751 word.nCharset = pWord->nCharset;
1757 word.fWidth = m_pVT->GetWordWidth(*pWord); 1752 word.fWidth = m_pVT->GetWordWidth(*pWord);
1758 word.ptWord = m_pVT->InToOut( 1753 word.ptWord = m_pVT->InToOut(
1759 CPDF_Point(pWord->fWordX + pSection->m_SecInfo.rcSection.left, 1754 CPDF_Point(pWord->fWordX + pSection->m_SecInfo.rcSection.left,
1760 pWord->fWordY + pSection->m_SecInfo.rcSection.top)); 1755 pWord->fWordY + pSection->m_SecInfo.rcSection.top));
1761 word.fAscent = m_pVT->GetWordAscent(*pWord); 1756 word.fAscent = m_pVT->GetWordAscent(*pWord);
1762 word.fDescent = m_pVT->GetWordDescent(*pWord); 1757 word.fDescent = m_pVT->GetWordDescent(*pWord);
1763 if (pWord->pWordProps) { 1758 if (pWord->pWordProps) {
1764 word.WordProps = *pWord->pWordProps; 1759 word.WordProps = *pWord->pWordProps;
1765 } 1760 }
1766 word.nFontIndex = m_pVT->GetWordFontIndex(*pWord); 1761 word.nFontIndex = m_pVT->GetWordFontIndex(*pWord);
1767 word.fFontSize = m_pVT->GetWordFontSize(*pWord); 1762 word.fFontSize = m_pVT->GetWordFontSize(*pWord);
1768 return TRUE; 1763 return TRUE;
1769 } 1764 }
1770 } 1765 }
1771 } 1766 }
1772 return FALSE; 1767 return FALSE;
1773 } 1768 }
1774 FX_BOOL CPDF_VariableText_Iterator::SetWord(const CPVT_Word& word) { 1769 FX_BOOL CPDF_VariableText_Iterator::SetWord(const CPVT_Word& word) {
1775 ASSERT(m_pVT != NULL);
1776 if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { 1770 if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
1777 if (CPVT_WordInfo* pWord = 1771 if (CPVT_WordInfo* pWord =
1778 pSection->m_WordArray.GetAt(m_CurPos.nWordIndex)) { 1772 pSection->m_WordArray.GetAt(m_CurPos.nWordIndex)) {
1779 if (pWord->pWordProps) { 1773 if (pWord->pWordProps) {
1780 *pWord->pWordProps = word.WordProps; 1774 *pWord->pWordProps = word.WordProps;
1781 } 1775 }
1782 return TRUE; 1776 return TRUE;
1783 } 1777 }
1784 } 1778 }
1785 return FALSE; 1779 return FALSE;
1786 } 1780 }
1787 FX_BOOL CPDF_VariableText_Iterator::GetLine(CPVT_Line& line) const { 1781 FX_BOOL CPDF_VariableText_Iterator::GetLine(CPVT_Line& line) const {
1788 ASSERT(m_pVT != NULL); 1782 ASSERT(m_pVT);
1789 line.lineplace = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex, -1); 1783 line.lineplace = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex, -1);
1790 if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { 1784 if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
1791 if (CLine* pLine = pSection->m_LineArray.GetAt(m_CurPos.nLineIndex)) { 1785 if (CLine* pLine = pSection->m_LineArray.GetAt(m_CurPos.nLineIndex)) {
1792 line.ptLine = m_pVT->InToOut(CPDF_Point( 1786 line.ptLine = m_pVT->InToOut(CPDF_Point(
1793 pLine->m_LineInfo.fLineX + pSection->m_SecInfo.rcSection.left, 1787 pLine->m_LineInfo.fLineX + pSection->m_SecInfo.rcSection.left,
1794 pLine->m_LineInfo.fLineY + pSection->m_SecInfo.rcSection.top)); 1788 pLine->m_LineInfo.fLineY + pSection->m_SecInfo.rcSection.top));
1795 line.fLineWidth = pLine->m_LineInfo.fLineWidth; 1789 line.fLineWidth = pLine->m_LineInfo.fLineWidth;
1796 line.fLineAscent = pLine->m_LineInfo.fLineAscent; 1790 line.fLineAscent = pLine->m_LineInfo.fLineAscent;
1797 line.fLineDescent = pLine->m_LineInfo.fLineDescent; 1791 line.fLineDescent = pLine->m_LineInfo.fLineDescent;
1798 line.lineEnd = pLine->GetEndWordPlace(); 1792 line.lineEnd = pLine->GetEndWordPlace();
1799 return TRUE; 1793 return TRUE;
1800 } 1794 }
1801 } 1795 }
1802 return FALSE; 1796 return FALSE;
1803 } 1797 }
1804 FX_BOOL CPDF_VariableText_Iterator::GetSection(CPVT_Section& section) const { 1798 FX_BOOL CPDF_VariableText_Iterator::GetSection(CPVT_Section& section) const {
1805 ASSERT(m_pVT != NULL);
1806 section.secplace = CPVT_WordPlace(m_CurPos.nSecIndex, 0, -1); 1799 section.secplace = CPVT_WordPlace(m_CurPos.nSecIndex, 0, -1);
1807 if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { 1800 if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
1808 section.rcSection = m_pVT->InToOut(pSection->m_SecInfo.rcSection); 1801 section.rcSection = m_pVT->InToOut(pSection->m_SecInfo.rcSection);
1809 if (pSection->m_SecInfo.pSecProps) { 1802 if (pSection->m_SecInfo.pSecProps) {
1810 section.SecProps = *pSection->m_SecInfo.pSecProps; 1803 section.SecProps = *pSection->m_SecInfo.pSecProps;
1811 } 1804 }
1812 if (pSection->m_SecInfo.pWordProps) { 1805 if (pSection->m_SecInfo.pWordProps) {
1813 section.WordProps = *pSection->m_SecInfo.pWordProps; 1806 section.WordProps = *pSection->m_SecInfo.pWordProps;
1814 } 1807 }
1815 return TRUE; 1808 return TRUE;
1816 } 1809 }
1817 return FALSE; 1810 return FALSE;
1818 } 1811 }
1819 FX_BOOL CPDF_VariableText_Iterator::SetSection(const CPVT_Section& section) { 1812 FX_BOOL CPDF_VariableText_Iterator::SetSection(const CPVT_Section& section) {
1820 ASSERT(m_pVT != NULL);
1821 if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) { 1813 if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
1822 if (pSection->m_SecInfo.pSecProps) { 1814 if (pSection->m_SecInfo.pSecProps) {
1823 *pSection->m_SecInfo.pSecProps = section.SecProps; 1815 *pSection->m_SecInfo.pSecProps = section.SecProps;
1824 } 1816 }
1825 if (pSection->m_SecInfo.pWordProps) { 1817 if (pSection->m_SecInfo.pWordProps) {
1826 *pSection->m_SecInfo.pWordProps = section.WordProps; 1818 *pSection->m_SecInfo.pWordProps = section.WordProps;
1827 } 1819 }
1828 return TRUE; 1820 return TRUE;
1829 } 1821 }
1830 return FALSE; 1822 return FALSE;
1831 } 1823 }
OLDNEW
« no previous file with comments | « core/src/fpdfdoc/doc_utils.cpp ('k') | core/src/fxcodec/codec/fx_codec_jpeg.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698