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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "core/fpdfdoc/cpvt_wordinfo.h" | 9 #include "core/fpdfdoc/cpvt_wordinfo.h" |
10 #include "core/fpdfdoc/csection.h" | 10 #include "core/fpdfdoc/csection.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
75 } | 75 } |
76 CPVT_WordPlace CSection::AddLine(const CPVT_LineInfo& lineinfo) { | 76 CPVT_WordPlace CSection::AddLine(const CPVT_LineInfo& lineinfo) { |
77 return CPVT_WordPlace(SecPlace.nSecIndex, m_LineArray.Add(lineinfo), -1); | 77 return CPVT_WordPlace(SecPlace.nSecIndex, m_LineArray.Add(lineinfo), -1); |
78 } | 78 } |
79 CPVT_FloatRect CSection::Rearrange() { | 79 CPVT_FloatRect CSection::Rearrange() { |
80 if (m_pVT->m_nCharArray > 0) { | 80 if (m_pVT->m_nCharArray > 0) { |
81 return CTypeset(this).CharArray(); | 81 return CTypeset(this).CharArray(); |
82 } | 82 } |
83 return CTypeset(this).Typeset(); | 83 return CTypeset(this).Typeset(); |
84 } | 84 } |
85 CPVT_Size CSection::GetSectionSize(FX_FLOAT fFontSize) { | 85 CFX_PointF CSection::GetSectionSize(FX_FLOAT fFontSize) { |
Wei Li
2016/05/10 20:09:42
Ditto for all below.
| |
86 return CTypeset(this).GetEditSize(fFontSize); | 86 return CTypeset(this).GetEditSize(fFontSize); |
87 } | 87 } |
88 CPVT_WordPlace CSection::GetBeginWordPlace() const { | 88 CPVT_WordPlace CSection::GetBeginWordPlace() const { |
89 if (CLine* pLine = m_LineArray.GetAt(0)) { | 89 if (CLine* pLine = m_LineArray.GetAt(0)) { |
90 return pLine->GetBeginWordPlace(); | 90 return pLine->GetBeginWordPlace(); |
91 } | 91 } |
92 return SecPlace; | 92 return SecPlace; |
93 } | 93 } |
94 CPVT_WordPlace CSection::GetEndWordPlace() const { | 94 CPVT_WordPlace CSection::GetEndWordPlace() const { |
95 if (CLine* pLine = m_LineArray.GetAt(m_LineArray.GetSize() - 1)) { | 95 if (CLine* pLine = m_LineArray.GetAt(m_LineArray.GetSize() - 1)) { |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
369 pLine->m_LineInfo.nBeginWordIndex = 0; | 369 pLine->m_LineInfo.nBeginWordIndex = 0; |
370 pLine->m_LineInfo.nEndWordIndex = m_pSection->m_WordArray.GetSize() - 1; | 370 pLine->m_LineInfo.nEndWordIndex = m_pSection->m_WordArray.GetSize() - 1; |
371 pLine->m_LineInfo.fLineY = y; | 371 pLine->m_LineInfo.fLineY = y; |
372 pLine->m_LineInfo.fLineWidth = x - pLine->m_LineInfo.fLineX; | 372 pLine->m_LineInfo.fLineWidth = x - pLine->m_LineInfo.fLineX; |
373 pLine->m_LineInfo.fLineAscent = fLineAscent; | 373 pLine->m_LineInfo.fLineAscent = fLineAscent; |
374 pLine->m_LineInfo.fLineDescent = fLineDescent; | 374 pLine->m_LineInfo.fLineDescent = fLineDescent; |
375 y -= fLineDescent; | 375 y -= fLineDescent; |
376 } | 376 } |
377 return m_rcRet = CPVT_FloatRect(0, 0, x, y); | 377 return m_rcRet = CPVT_FloatRect(0, 0, x, y); |
378 } | 378 } |
379 CPVT_Size CTypeset::GetEditSize(FX_FLOAT fFontSize) { | 379 CFX_PointF CTypeset::GetEditSize(FX_FLOAT fFontSize) { |
380 ASSERT(m_pSection); | 380 ASSERT(m_pSection); |
381 ASSERT(m_pVT); | 381 ASSERT(m_pVT); |
382 SplitLines(FALSE, fFontSize); | 382 SplitLines(FALSE, fFontSize); |
383 return CPVT_Size(m_rcRet.Width(), m_rcRet.Height()); | 383 return CFX_PointF(m_rcRet.Width(), m_rcRet.Height()); |
384 } | 384 } |
385 CPVT_FloatRect CTypeset::Typeset() { | 385 CPVT_FloatRect CTypeset::Typeset() { |
386 ASSERT(m_pVT); | 386 ASSERT(m_pVT); |
387 m_pSection->m_LineArray.Empty(); | 387 m_pSection->m_LineArray.Empty(); |
388 SplitLines(TRUE, 0.0f); | 388 SplitLines(TRUE, 0.0f); |
389 m_pSection->m_LineArray.Clear(); | 389 m_pSection->m_LineArray.Clear(); |
390 OutputLines(); | 390 OutputLines(); |
391 return m_rcRet; | 391 return m_rcRet; |
392 } | 392 } |
393 | 393 |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
760 } | 760 } |
761 fPosX += m_pVT->GetWordWidth(*pWord); | 761 fPosX += m_pVT->GetWordWidth(*pWord); |
762 } | 762 } |
763 } | 763 } |
764 fPosY -= pLine->m_LineInfo.fLineDescent; | 764 fPosY -= pLine->m_LineInfo.fLineDescent; |
765 } | 765 } |
766 } | 766 } |
767 } | 767 } |
768 m_rcRet = CPVT_FloatRect(fMinX, fMinY, fMaxX, fMaxY); | 768 m_rcRet = CPVT_FloatRect(fMinX, fMinY, fMaxX, fMaxY); |
769 } | 769 } |
OLD | NEW |