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/fxfa/app/xfa_fftext.h" | 7 #include "xfa/fxfa/app/xfa_fftext.h" |
8 | 8 |
9 #include "xfa/fwl/core/fwl_widgetdef.h" | 9 #include "xfa/fwl/core/fwl_widgetdef.h" |
10 #include "xfa/fxfa/app/xfa_ffapp.h" | 10 #include "xfa/fxfa/app/xfa_ffapp.h" |
11 #include "xfa/fxfa/app/xfa_ffdoc.h" | 11 #include "xfa/fxfa/app/xfa_ffdoc.h" |
12 #include "xfa/fxfa/app/xfa_ffdraw.h" | 12 #include "xfa/fxfa/app/xfa_ffdraw.h" |
13 #include "xfa/fxfa/app/xfa_ffpageview.h" | 13 #include "xfa/fxfa/app/xfa_ffpageview.h" |
14 #include "xfa/fxfa/app/xfa_ffwidget.h" | 14 #include "xfa/fxfa/app/xfa_ffwidget.h" |
15 #include "xfa/fxfa/app/xfa_textlayout.h" | 15 #include "xfa/fxfa/app/xfa_textlayout.h" |
16 #include "xfa/fxgraphics/include/cfx_graphics.h" | 16 #include "xfa/fxgraphics/include/cfx_graphics.h" |
17 | 17 |
18 CXFA_FFText::CXFA_FFText(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) | 18 CXFA_FFText::CXFA_FFText(CXFA_FFPageView* pPageView, CXFA_WidgetAcc* pDataAcc) |
19 : CXFA_FFDraw(pPageView, pDataAcc) {} | 19 : CXFA_FFDraw(pPageView, pDataAcc) {} |
20 CXFA_FFText::~CXFA_FFText() {} | 20 CXFA_FFText::~CXFA_FFText() {} |
21 void CXFA_FFText::RenderWidget(CFX_Graphics* pGS, | 21 void CXFA_FFText::RenderWidget(CFX_Graphics* pGS, |
22 CFX_Matrix* pMatrix, | 22 CFX_Matrix* pMatrix, |
23 FX_DWORD dwStatus, | 23 uint32_t dwStatus, |
24 int32_t iRotate) { | 24 int32_t iRotate) { |
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 mgWidget.GetBottomInset(fBottomInset); | 94 mgWidget.GetBottomInset(fBottomInset); |
95 rtText.height -= fBottomInset; | 95 rtText.height -= fBottomInset; |
96 } | 96 } |
97 } | 97 } |
98 pTextLayout->ItemBlocks(rtText, pItem->GetIndex()); | 98 pTextLayout->ItemBlocks(rtText, pItem->GetIndex()); |
99 pItem = pItem->GetNext(); | 99 pItem = pItem->GetNext(); |
100 } | 100 } |
101 pTextLayout->m_bHasBlock = FALSE; | 101 pTextLayout->m_bHasBlock = FALSE; |
102 return TRUE; | 102 return TRUE; |
103 } | 103 } |
104 FX_BOOL CXFA_FFText::OnLButtonDown(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy) { | 104 FX_BOOL CXFA_FFText::OnLButtonDown(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { |
105 CFX_RectF rtBox; | 105 CFX_RectF rtBox; |
106 GetRectWithoutRotate(rtBox); | 106 GetRectWithoutRotate(rtBox); |
107 if (!rtBox.Contains(fx, fy)) { | 107 if (!rtBox.Contains(fx, fy)) { |
108 return FALSE; | 108 return FALSE; |
109 } | 109 } |
110 const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy); | 110 const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy); |
111 if (NULL == wsURLContent) { | 111 if (NULL == wsURLContent) { |
112 return FALSE; | 112 return FALSE; |
113 } | 113 } |
114 SetButtonDown(TRUE); | 114 SetButtonDown(TRUE); |
115 return TRUE; | 115 return TRUE; |
116 } | 116 } |
117 FX_BOOL CXFA_FFText::OnMouseMove(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy) { | 117 FX_BOOL CXFA_FFText::OnMouseMove(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { |
118 CFX_RectF rtBox; | 118 CFX_RectF rtBox; |
119 GetRectWithoutRotate(rtBox); | 119 GetRectWithoutRotate(rtBox); |
120 if (!rtBox.Contains(fx, fy)) { | 120 if (!rtBox.Contains(fx, fy)) { |
121 return FALSE; | 121 return FALSE; |
122 } | 122 } |
123 const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy); | 123 const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy); |
124 if (NULL == wsURLContent) { | 124 if (NULL == wsURLContent) { |
125 return FALSE; | 125 return FALSE; |
126 } | 126 } |
127 return TRUE; | 127 return TRUE; |
128 } | 128 } |
129 FX_BOOL CXFA_FFText::OnLButtonUp(FX_DWORD dwFlags, FX_FLOAT fx, FX_FLOAT fy) { | 129 FX_BOOL CXFA_FFText::OnLButtonUp(uint32_t dwFlags, FX_FLOAT fx, FX_FLOAT fy) { |
130 if (!IsButtonDown()) { | 130 if (!IsButtonDown()) { |
131 return FALSE; | 131 return FALSE; |
132 } | 132 } |
133 SetButtonDown(FALSE); | 133 SetButtonDown(FALSE); |
134 const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy); | 134 const FX_WCHAR* wsURLContent = GetLinkURLAtPoint(fx, fy); |
135 if (NULL == wsURLContent) { | 135 if (NULL == wsURLContent) { |
136 return FALSE; | 136 return FALSE; |
137 } | 137 } |
138 CXFA_FFDoc* pDoc = GetDoc(); | 138 CXFA_FFDoc* pDoc = GetDoc(); |
139 pDoc->GetDocProvider()->GotoURL(pDoc, CFX_WideStringC(wsURLContent), FALSE); | 139 pDoc->GetDocProvider()->GotoURL(pDoc, CFX_WideStringC(wsURLContent), FALSE); |
140 return TRUE; | 140 return TRUE; |
141 } | 141 } |
142 FX_DWORD CXFA_FFText::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { | 142 uint32_t CXFA_FFText::OnHitTest(FX_FLOAT fx, FX_FLOAT fy) { |
143 CFX_RectF rtBox; | 143 CFX_RectF rtBox; |
144 GetRectWithoutRotate(rtBox); | 144 GetRectWithoutRotate(rtBox); |
145 if (!rtBox.Contains(fx, fy)) { | 145 if (!rtBox.Contains(fx, fy)) { |
146 return FWL_WGTHITTEST_Unknown; | 146 return FWL_WGTHITTEST_Unknown; |
147 } | 147 } |
148 if (!GetLinkURLAtPoint(fx, fy)) { | 148 if (!GetLinkURLAtPoint(fx, fy)) { |
149 return FWL_WGTHITTEST_Unknown; | 149 return FWL_WGTHITTEST_Unknown; |
150 } | 150 } |
151 return FWL_WGTHITTEST_HyperLink; | 151 return FWL_WGTHITTEST_HyperLink; |
152 } | 152 } |
(...skipping 17 matching lines...) Expand all Loading... |
170 } | 170 } |
171 } | 171 } |
172 return NULL; | 172 return NULL; |
173 } | 173 } |
174 void CXFA_FFText::FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy) { | 174 void CXFA_FFText::FWLToClient(FX_FLOAT& fx, FX_FLOAT& fy) { |
175 CFX_RectF rtWidget; | 175 CFX_RectF rtWidget; |
176 GetRectWithoutRotate(rtWidget); | 176 GetRectWithoutRotate(rtWidget); |
177 fx -= rtWidget.left; | 177 fx -= rtWidget.left; |
178 fy -= rtWidget.top; | 178 fy -= rtWidget.top; |
179 } | 179 } |
OLD | NEW |