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/fee/fde_txtedtpage.h" | 7 #include "xfa/fee/fde_txtedtpage.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 return 0; | 70 return 0; |
71 } | 71 } |
72 FDE_TEXTEDITPIECE* pPiece = (FDE_TEXTEDITPIECE*)hText; | 72 FDE_TEXTEDITPIECE* pPiece = (FDE_TEXTEDITPIECE*)hText; |
73 int32_t nLength = pPiece->nCount; | 73 int32_t nLength = pPiece->nCount; |
74 if (nLength < 1) { | 74 if (nLength < 1) { |
75 return 0; | 75 return 0; |
76 } | 76 } |
77 CFDE_TxtEdtEngine* pEngine = (CFDE_TxtEdtEngine*)(m_pPage->GetEngine()); | 77 CFDE_TxtEdtEngine* pEngine = (CFDE_TxtEdtEngine*)(m_pPage->GetEngine()); |
78 const FDE_TXTEDTPARAMS* pTextParams = pEngine->GetEditParams(); | 78 const FDE_TXTEDTPARAMS* pTextParams = pEngine->GetEditParams(); |
79 IFX_TxtBreak* pBreak = pEngine->GetTextBreak(); | 79 IFX_TxtBreak* pBreak = pEngine->GetTextBreak(); |
80 FX_DWORD dwLayoutStyle = pBreak->GetLayoutStyles(); | 80 uint32_t dwLayoutStyle = pBreak->GetLayoutStyles(); |
81 FX_TXTRUN tr; | 81 FX_TXTRUN tr; |
82 tr.pAccess = m_pPage; | 82 tr.pAccess = m_pPage; |
83 tr.pIdentity = (void*)hText; | 83 tr.pIdentity = (void*)hText; |
84 tr.pStr = NULL; | 84 tr.pStr = NULL; |
85 tr.pWidths = NULL; | 85 tr.pWidths = NULL; |
86 tr.iLength = nLength; | 86 tr.iLength = nLength; |
87 tr.pFont = pTextParams->pFont; | 87 tr.pFont = pTextParams->pFont; |
88 tr.fFontSize = pTextParams->fFontSize; | 88 tr.fFontSize = pTextParams->fFontSize; |
89 tr.dwStyles = dwLayoutStyle; | 89 tr.dwStyles = dwLayoutStyle; |
90 tr.iCharRotation = pTextParams->nCharRotation; | 90 tr.iCharRotation = pTextParams->nCharRotation; |
(...skipping 12 matching lines...) Expand all Loading... |
103 if (hText == NULL) { | 103 if (hText == NULL) { |
104 return 0; | 104 return 0; |
105 } | 105 } |
106 FDE_TEXTEDITPIECE* pPiece = (FDE_TEXTEDITPIECE*)hText; | 106 FDE_TEXTEDITPIECE* pPiece = (FDE_TEXTEDITPIECE*)hText; |
107 CFDE_TxtEdtEngine* pEngine = (CFDE_TxtEdtEngine*)(m_pPage->GetEngine()); | 107 CFDE_TxtEdtEngine* pEngine = (CFDE_TxtEdtEngine*)(m_pPage->GetEngine()); |
108 int32_t nLength = pPiece->nCount; | 108 int32_t nLength = pPiece->nCount; |
109 if (nLength < 1) { | 109 if (nLength < 1) { |
110 return 0; | 110 return 0; |
111 } | 111 } |
112 const FDE_TXTEDTPARAMS* pTextParams = pEngine->GetEditParams(); | 112 const FDE_TXTEDTPARAMS* pTextParams = pEngine->GetEditParams(); |
113 FX_DWORD dwLayoutStyle = pEngine->GetTextBreak()->GetLayoutStyles(); | 113 uint32_t dwLayoutStyle = pEngine->GetTextBreak()->GetLayoutStyles(); |
114 FX_TXTRUN tr; | 114 FX_TXTRUN tr; |
115 tr.pAccess = m_pPage; | 115 tr.pAccess = m_pPage; |
116 tr.pIdentity = (void*)hText; | 116 tr.pIdentity = (void*)hText; |
117 tr.pStr = NULL; | 117 tr.pStr = NULL; |
118 tr.pWidths = NULL; | 118 tr.pWidths = NULL; |
119 tr.iLength = nLength; | 119 tr.iLength = nLength; |
120 tr.pFont = pTextParams->pFont; | 120 tr.pFont = pTextParams->pFont; |
121 tr.fFontSize = pTextParams->fFontSize; | 121 tr.fFontSize = pTextParams->fFontSize; |
122 tr.dwStyles = dwLayoutStyle; | 122 tr.dwStyles = dwLayoutStyle; |
123 tr.iCharRotation = pTextParams->nCharRotation; | 123 tr.iCharRotation = pTextParams->nCharRotation; |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 bVertial | 421 bVertial |
422 ? (bLineReserve ? (pParams->fPlateWidth - pParams->fLineSpace) : 0.0f) | 422 ? (bLineReserve ? (pParams->fPlateWidth - pParams->fLineSpace) : 0.0f) |
423 : 0.0f; | 423 : 0.0f; |
424 FX_FLOAT fLineStep = | 424 FX_FLOAT fLineStep = |
425 (bVertial && bLineReserve) ? (-pParams->fLineSpace) : pParams->fLineSpace; | 425 (bVertial && bLineReserve) ? (-pParams->fLineSpace) : pParams->fLineSpace; |
426 FX_FLOAT fLinePos = fLineStart; | 426 FX_FLOAT fLinePos = fLineStart; |
427 if (m_pTextSet == NULL) { | 427 if (m_pTextSet == NULL) { |
428 m_pTextSet = new CFDE_TxtEdtTextSet(this); | 428 m_pTextSet = new CFDE_TxtEdtTextSet(this); |
429 } | 429 } |
430 m_PieceMassArr.RemoveAll(TRUE); | 430 m_PieceMassArr.RemoveAll(TRUE); |
431 FX_DWORD dwBreakStatus = FX_TXTBREAK_None; | 431 uint32_t dwBreakStatus = FX_TXTBREAK_None; |
432 int32_t nPieceStart = 0; | 432 int32_t nPieceStart = 0; |
433 if (m_pCharWidth != NULL) { | 433 if (m_pCharWidth != NULL) { |
434 delete[] m_pCharWidth; | 434 delete[] m_pCharWidth; |
435 } | 435 } |
436 m_pCharWidth = new int32_t[nPageEnd - nPageStart + 1]; | 436 m_pCharWidth = new int32_t[nPageEnd - nPageStart + 1]; |
437 pBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); | 437 pBreak->EndBreak(FX_TXTBREAK_ParagraphBreak); |
438 pBreak->ClearBreakPieces(); | 438 pBreak->ClearBreakPieces(); |
439 m_nPageStart = nPageStart; | 439 m_nPageStart = nPageStart; |
440 m_nCharCount = nPageEnd - nPageStart + 1; | 440 m_nCharCount = nPageEnd - nPageStart + 1; |
441 FX_BOOL bReload = FALSE; | 441 FX_BOOL bReload = FALSE; |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 ptF.x = rtF.left; | 641 ptF.x = rtF.left; |
642 } else if (ptF.x >= rtF.right()) { | 642 } else if (ptF.x >= rtF.right()) { |
643 ptF.x = rtF.right() - fTolerance; | 643 ptF.x = rtF.right() - fTolerance; |
644 } | 644 } |
645 if (ptF.y < rtF.top) { | 645 if (ptF.y < rtF.top) { |
646 ptF.y = rtF.top; | 646 ptF.y = rtF.top; |
647 } else if (ptF.y >= rtF.bottom()) { | 647 } else if (ptF.y >= rtF.bottom()) { |
648 ptF.y = rtF.bottom() - fTolerance; | 648 ptF.y = rtF.bottom() - fTolerance; |
649 } | 649 } |
650 } | 650 } |
OLD | NEW |