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 "../../../foxitlib.h" | 7 #include "../../../foxitlib.h" |
8 #include "../common/xfa_common.h" | 8 #include "../common/xfa_common.h" |
9 #include "xfa_ffwidget.h" | 9 #include "xfa_ffwidget.h" |
10 #include "xfa_ffdraw.h" | 10 #include "xfa_ffdraw.h" |
11 #include "xfa_fftext.h" | 11 #include "xfa_fftext.h" |
12 #include "xfa_textlayout.h" | 12 #include "xfa_textlayout.h" |
13 #include "xfa_ffpageview.h" | 13 #include "xfa_ffpageview.h" |
14 #include "xfa_ffdoc.h" | 14 #include "xfa_ffdoc.h" |
15 #include "xfa_ffapp.h" | 15 #include "xfa_ffapp.h" |
16 CXFA_FFText::CXFA_FFText(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) | 16 CXFA_FFText::CXFA_FFText(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) |
17 : CXFA_FFDraw(pPageView, pDataAcc) | 17 : CXFA_FFDraw(pPageView, pDataAcc) |
18 { | 18 { |
19 } | 19 } |
20 CXFA_FFText::~CXFA_FFText() | 20 CXFA_FFText::~CXFA_FFText() |
21 { | 21 { |
22 } | 22 } |
23 void CXFA_FFText::RenderWidget(CFX_Graphics* pGS, CFX_Matrix* pMatrix , FX_DWORD
dwStatus , FX_INT32 iRotate ) | 23 void CXFA_FFText::RenderWidget(CFX_Graphics* pGS, CFX_Matrix* pMatrix , FX_DWORD
dwStatus , int32_t iRotate ) |
24 { | 24 { |
25 if (!IsMatchVisibleStatus(dwStatus)) { | 25 if (!IsMatchVisibleStatus(dwStatus)) { |
26 return; | 26 return; |
27 } | 27 } |
28 { | 28 { |
29 CFX_Matrix mtRotate; | 29 CFX_Matrix mtRotate; |
30 GetRotateMatrix(mtRotate); | 30 GetRotateMatrix(mtRotate); |
31 if (pMatrix) { | 31 if (pMatrix) { |
32 mtRotate.Concat(*pMatrix); | 32 mtRotate.Concat(*pMatrix); |
33 } | 33 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 } | 159 } |
160 FX_LPCWSTR CXFA_FFText::GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy) | 160 FX_LPCWSTR CXFA_FFText::GetLinkURLAtPoint(FX_FLOAT fx, FX_FLOAT fy) |
161 { | 161 { |
162 CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout(); | 162 CXFA_TextLayout* pTextLayout = m_pDataAcc->GetTextLayout(); |
163 if ( NULL == pTextLayout) { | 163 if ( NULL == pTextLayout) { |
164 return NULL; | 164 return NULL; |
165 } | 165 } |
166 FX_FLOAT x(fx), y(fy); | 166 FX_FLOAT x(fx), y(fy); |
167 FWLToClient(x, y); | 167 FWLToClient(x, y); |
168 const CXFA_PieceLineArray* pPieceLines = pTextLayout->GetPieceLines(); | 168 const CXFA_PieceLineArray* pPieceLines = pTextLayout->GetPieceLines(); |
169 FX_INT32 iCount = pPieceLines->GetSize(); | 169 int32_t iCount = pPieceLines->GetSize(); |
170 for (FX_INT32 i = 0; i < iCount; i++) { | 170 for (int32_t i = 0; i < iCount; i++) { |
171 CXFA_PieceLine *pPieceLine = pPieceLines->GetAt(i); | 171 CXFA_PieceLine *pPieceLine = pPieceLines->GetAt(i); |
172 FX_INT32 iPieces = pPieceLine->m_textPieces.GetSize(); | 172 int32_t iPieces = pPieceLine->m_textPieces.GetSize(); |
173 for (FX_INT32 j = 0; j < iPieces; j++) { | 173 for (int32_t j = 0; j < iPieces; j++) { |
174 XFA_LPTEXTPIECE pPiece = pPieceLine->m_textPieces.GetAt(j); | 174 XFA_LPTEXTPIECE pPiece = pPieceLine->m_textPieces.GetAt(j); |
175 if (pPiece->pLinkData && pPiece->rtPiece.Contains(x, y)) { | 175 if (pPiece->pLinkData && pPiece->rtPiece.Contains(x, y)) { |
176 return pPiece->pLinkData->GetLinkURL(); | 176 return pPiece->pLinkData->GetLinkURL(); |
177 } | 177 } |
178 } | 178 } |
179 } | 179 } |
180 return NULL; | 180 return NULL; |
181 } | 181 } |
182 void CXFA_FFText::FWLToClient(FX_FLOAT &fx, FX_FLOAT &fy) | 182 void CXFA_FFText::FWLToClient(FX_FLOAT &fx, FX_FLOAT &fy) |
183 { | 183 { |
184 CFX_RectF rtWidget; | 184 CFX_RectF rtWidget; |
185 GetRectWithoutRotate(rtWidget); | 185 GetRectWithoutRotate(rtWidget); |
186 fx -= rtWidget.left; | 186 fx -= rtWidget.left; |
187 fy -= rtWidget.top; | 187 fy -= rtWidget.top; |
188 } | 188 } |
OLD | NEW |