John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 1 | // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 4 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
dan sinclair | 89e904b | 2016-03-23 19:29:15 -0400 | [diff] [blame] | 7 | #include "fpdfsdk/pdfwindow/PWL_Edit.h" |
Lei Zhang | c2fb35f | 2016-01-05 16:46:58 -0800 | [diff] [blame] | 8 | |
Dan Sinclair | 3ebd121 | 2016-03-09 09:59:23 -0500 | [diff] [blame] | 9 | #include <vector> |
| 10 | |
dan sinclair | 61b2fc7 | 2016-03-23 19:21:44 -0400 | [diff] [blame] | 11 | #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
dsinclair | c7a7349 | 2016-04-05 12:01:42 -0700 | [diff] [blame] | 12 | #include "core/fpdfdoc/include/cpvt_word.h" |
Dan Sinclair | a8a28e0 | 2016-03-23 15:41:39 -0400 | [diff] [blame] | 13 | #include "core/fxcrt/include/fx_safe_types.h" |
| 14 | #include "core/fxcrt/include/fx_xml.h" |
npm | 9ada2d8 | 2016-08-10 07:51:38 -0700 | [diff] [blame] | 15 | #include "core/fxge/include/cfx_graphstatedata.h" |
npm | 660de3c | 2016-08-08 08:18:29 -0700 | [diff] [blame] | 16 | #include "core/fxge/include/cfx_pathdata.h" |
npm | 9ada2d8 | 2016-08-10 07:51:38 -0700 | [diff] [blame] | 17 | #include "core/fxge/include/cfx_renderdevice.h" |
dsinclair | e35af1e | 2016-07-13 11:26:20 -0700 | [diff] [blame] | 18 | #include "fpdfsdk/fxedit/include/fxet_edit.h" |
dan sinclair | 89e904b | 2016-03-23 19:29:15 -0400 | [diff] [blame] | 19 | #include "fpdfsdk/pdfwindow/PWL_Caret.h" |
| 20 | #include "fpdfsdk/pdfwindow/PWL_EditCtrl.h" |
| 21 | #include "fpdfsdk/pdfwindow/PWL_FontMap.h" |
| 22 | #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h" |
| 23 | #include "fpdfsdk/pdfwindow/PWL_Utils.h" |
| 24 | #include "fpdfsdk/pdfwindow/PWL_Wnd.h" |
Lei Zhang | c2fb35f | 2016-01-05 16:46:58 -0800 | [diff] [blame] | 25 | #include "public/fpdf_fwlevent.h" |
Tom Sepez | ab27768 | 2016-02-17 10:07:21 -0800 | [diff] [blame] | 26 | #include "third_party/base/stl_util.h" |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 27 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 28 | CPWL_Edit::CPWL_Edit() |
dsinclair | 8da140e | 2016-04-07 12:39:44 -0700 | [diff] [blame] | 29 | : m_pFillerNotify(nullptr), m_bFocus(FALSE), m_pFormFiller(nullptr) {} |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 30 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 31 | CPWL_Edit::~CPWL_Edit() { |
| 32 | ASSERT(m_bFocus == FALSE); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 33 | } |
| 34 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 35 | CFX_ByteString CPWL_Edit::GetClassName() const { |
| 36 | return PWL_CLASSNAME_EDIT; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 37 | } |
| 38 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 39 | void CPWL_Edit::OnDestroy() {} |
| 40 | |
tsepez | 067990c | 2016-09-13 06:46:40 -0700 | [diff] [blame] | 41 | void CPWL_Edit::SetText(const CFX_WideString& csText) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 42 | CFX_WideString swText = csText; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 43 | if (HasFlag(PES_RICH)) { |
| 44 | CFX_ByteString sValue = CFX_ByteString::FromUnicode(swText); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 45 | if (CXML_Element* pXML = |
| 46 | CXML_Element::Parse(sValue.c_str(), sValue.GetLength())) { |
| 47 | int32_t nCount = pXML->CountChildren(); |
| 48 | FX_BOOL bFirst = TRUE; |
| 49 | |
tsepez | 774bdde | 2016-04-14 09:49:44 -0700 | [diff] [blame] | 50 | swText.clear(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 51 | |
| 52 | for (int32_t i = 0; i < nCount; i++) { |
| 53 | if (CXML_Element* pSubElement = pXML->GetElement(i)) { |
| 54 | CFX_ByteString tag = pSubElement->GetTagName(); |
| 55 | if (tag.EqualNoCase("p")) { |
| 56 | int nChild = pSubElement->CountChildren(); |
| 57 | CFX_WideString swSection; |
| 58 | for (int32_t j = 0; j < nChild; j++) { |
| 59 | swSection += pSubElement->GetContent(j); |
| 60 | } |
| 61 | |
| 62 | if (bFirst) |
| 63 | bFirst = FALSE; |
| 64 | else |
| 65 | swText += FWL_VKEY_Return; |
| 66 | swText += swSection; |
| 67 | } |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | delete pXML; |
| 72 | } |
| 73 | } |
| 74 | |
tsepez | 067990c | 2016-09-13 06:46:40 -0700 | [diff] [blame] | 75 | m_pEdit->SetText(swText); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 76 | } |
| 77 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 78 | void CPWL_Edit::RePosChildWnd() { |
| 79 | if (CPWL_ScrollBar* pVSB = GetVScrollBar()) { |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 80 | CFX_FloatRect rcWindow = m_rcOldWindow; |
| 81 | CFX_FloatRect rcVScroll = |
| 82 | CFX_FloatRect(rcWindow.right, rcWindow.bottom, |
| 83 | rcWindow.right + PWL_SCROLLBAR_WIDTH, rcWindow.top); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 84 | pVSB->Move(rcVScroll, TRUE, FALSE); |
| 85 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 86 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 87 | if (m_pEditCaret && !HasFlag(PES_TEXTOVERFLOW)) |
| 88 | m_pEditCaret->SetClipRect(CPWL_Utils::InflateRect( |
Dan Sinclair | 50cce60 | 2016-02-24 09:51:16 -0500 | [diff] [blame] | 89 | GetClientRect(), 1.0f)); // +1 for caret beside border |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 90 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 91 | CPWL_EditCtrl::RePosChildWnd(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 92 | } |
| 93 | |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 94 | CFX_FloatRect CPWL_Edit::GetClientRect() const { |
| 95 | CFX_FloatRect rcClient = CPWL_Utils::DeflateRect( |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 96 | GetWindowRect(), (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth())); |
| 97 | |
| 98 | if (CPWL_ScrollBar* pVSB = GetVScrollBar()) { |
| 99 | if (pVSB->IsVisible()) { |
| 100 | rcClient.right -= PWL_SCROLLBAR_WIDTH; |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | return rcClient; |
| 105 | } |
| 106 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 107 | void CPWL_Edit::SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat, |
Lei Zhang | c2fb35f | 2016-01-05 16:46:58 -0800 | [diff] [blame] | 108 | FX_BOOL bPaint) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 109 | m_pEdit->SetAlignmentV((int32_t)nFormat, bPaint); |
| 110 | } |
| 111 | |
| 112 | FX_BOOL CPWL_Edit::CanSelectAll() const { |
| 113 | return GetSelectWordRange() != m_pEdit->GetWholeWordRange(); |
| 114 | } |
| 115 | |
| 116 | FX_BOOL CPWL_Edit::CanClear() const { |
| 117 | return !IsReadOnly() && m_pEdit->IsSelected(); |
| 118 | } |
| 119 | |
| 120 | FX_BOOL CPWL_Edit::CanCopy() const { |
| 121 | return !HasFlag(PES_PASSWORD) && !HasFlag(PES_NOREAD) && |
| 122 | m_pEdit->IsSelected(); |
| 123 | } |
| 124 | |
| 125 | FX_BOOL CPWL_Edit::CanCut() const { |
| 126 | return CanCopy() && !IsReadOnly(); |
| 127 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 128 | void CPWL_Edit::CutText() { |
| 129 | if (!CanCut()) |
| 130 | return; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 131 | m_pEdit->Clear(); |
| 132 | } |
| 133 | |
| 134 | void CPWL_Edit::OnCreated() { |
| 135 | CPWL_EditCtrl::OnCreated(); |
| 136 | |
| 137 | if (CPWL_ScrollBar* pScroll = GetVScrollBar()) { |
| 138 | pScroll->RemoveFlag(PWS_AUTOTRANSPARENT); |
| 139 | pScroll->SetTransparency(255); |
| 140 | } |
| 141 | |
| 142 | SetParamByFlag(); |
| 143 | |
| 144 | m_rcOldWindow = GetWindowRect(); |
| 145 | |
| 146 | m_pEdit->SetOprNotify(this); |
| 147 | m_pEdit->EnableOprNotify(TRUE); |
| 148 | } |
| 149 | |
| 150 | void CPWL_Edit::SetParamByFlag() { |
| 151 | if (HasFlag(PES_RIGHT)) { |
| 152 | m_pEdit->SetAlignmentH(2, FALSE); |
| 153 | } else if (HasFlag(PES_MIDDLE)) { |
| 154 | m_pEdit->SetAlignmentH(1, FALSE); |
| 155 | } else { |
| 156 | m_pEdit->SetAlignmentH(0, FALSE); |
| 157 | } |
| 158 | |
| 159 | if (HasFlag(PES_BOTTOM)) { |
| 160 | m_pEdit->SetAlignmentV(2, FALSE); |
| 161 | } else if (HasFlag(PES_CENTER)) { |
| 162 | m_pEdit->SetAlignmentV(1, FALSE); |
| 163 | } else { |
| 164 | m_pEdit->SetAlignmentV(0, FALSE); |
| 165 | } |
| 166 | |
| 167 | if (HasFlag(PES_PASSWORD)) { |
| 168 | m_pEdit->SetPasswordChar('*', FALSE); |
| 169 | } |
| 170 | |
| 171 | m_pEdit->SetMultiLine(HasFlag(PES_MULTILINE), FALSE); |
| 172 | m_pEdit->SetAutoReturn(HasFlag(PES_AUTORETURN), FALSE); |
| 173 | m_pEdit->SetAutoFontSize(HasFlag(PWS_AUTOFONTSIZE), FALSE); |
| 174 | m_pEdit->SetAutoScroll(HasFlag(PES_AUTOSCROLL), FALSE); |
| 175 | m_pEdit->EnableUndo(HasFlag(PES_UNDO)); |
| 176 | |
| 177 | if (HasFlag(PES_TEXTOVERFLOW)) { |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 178 | SetClipRect(CFX_FloatRect(0.0f, 0.0f, 0.0f, 0.0f)); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 179 | m_pEdit->SetTextOverflow(TRUE, FALSE); |
| 180 | } else { |
| 181 | if (m_pEditCaret) { |
| 182 | m_pEditCaret->SetClipRect(CPWL_Utils::InflateRect( |
Dan Sinclair | 50cce60 | 2016-02-24 09:51:16 -0500 | [diff] [blame] | 183 | GetClientRect(), 1.0f)); // +1 for caret beside border |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 184 | } |
| 185 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 186 | } |
| 187 | |
| 188 | void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { |
| 189 | CPWL_Wnd::GetThisAppearanceStream(sAppStream); |
| 190 | |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 191 | CFX_FloatRect rcClient = GetClientRect(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 192 | CFX_ByteTextBuf sLine; |
| 193 | |
| 194 | int32_t nCharArray = m_pEdit->GetCharArray(); |
| 195 | |
| 196 | if (nCharArray > 0) { |
| 197 | switch (GetBorderStyle()) { |
dsinclair | 92cb5e5 | 2016-05-16 11:38:28 -0700 | [diff] [blame] | 198 | case BorderStyle::SOLID: { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 199 | sLine << "q\n" << GetBorderWidth() << " w\n" |
| 200 | << CPWL_Utils::GetColorAppStream(GetBorderColor(), FALSE) |
tsepez | 4c3debb | 2016-04-08 12:20:38 -0700 | [diff] [blame] | 201 | .AsStringC() |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 202 | << " 2 J 0 j\n"; |
| 203 | |
| 204 | for (int32_t i = 1; i < nCharArray; i++) { |
| 205 | sLine << rcClient.left + |
| 206 | ((rcClient.right - rcClient.left) / nCharArray) * i |
| 207 | << " " << rcClient.bottom << " m\n" |
| 208 | << rcClient.left + |
| 209 | ((rcClient.right - rcClient.left) / nCharArray) * i |
| 210 | << " " << rcClient.top << " l S\n"; |
| 211 | } |
| 212 | |
| 213 | sLine << "Q\n"; |
dsinclair | 92cb5e5 | 2016-05-16 11:38:28 -0700 | [diff] [blame] | 214 | break; |
| 215 | } |
| 216 | case BorderStyle::DASH: { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 217 | sLine << "q\n" << GetBorderWidth() << " w\n" |
| 218 | << CPWL_Utils::GetColorAppStream(GetBorderColor(), FALSE) |
tsepez | 4c3debb | 2016-04-08 12:20:38 -0700 | [diff] [blame] | 219 | .AsStringC() |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 220 | << " 2 J 0 j\n" |
| 221 | << "[" << GetBorderDash().nDash << " " << GetBorderDash().nGap |
| 222 | << "] " << GetBorderDash().nPhase << " d\n"; |
| 223 | |
| 224 | for (int32_t i = 1; i < nCharArray; i++) { |
| 225 | sLine << rcClient.left + |
| 226 | ((rcClient.right - rcClient.left) / nCharArray) * i |
| 227 | << " " << rcClient.bottom << " m\n" |
| 228 | << rcClient.left + |
| 229 | ((rcClient.right - rcClient.left) / nCharArray) * i |
| 230 | << " " << rcClient.top << " l S\n"; |
| 231 | } |
| 232 | |
| 233 | sLine << "Q\n"; |
dsinclair | 92cb5e5 | 2016-05-16 11:38:28 -0700 | [diff] [blame] | 234 | break; |
| 235 | } |
| 236 | default: |
| 237 | break; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 238 | } |
| 239 | } |
| 240 | |
| 241 | sAppStream << sLine; |
| 242 | |
| 243 | CFX_ByteTextBuf sText; |
tsepez | 63f545c | 2016-09-13 16:08:49 -0700 | [diff] [blame] | 244 | CFX_FloatPoint ptOffset = CFX_FloatPoint(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 245 | CPVT_WordRange wrWhole = m_pEdit->GetWholeWordRange(); |
| 246 | CPVT_WordRange wrSelect = GetSelectWordRange(); |
| 247 | CPVT_WordRange wrVisible = |
tsepez | 63f545c | 2016-09-13 16:08:49 -0700 | [diff] [blame] | 248 | HasFlag(PES_TEXTOVERFLOW) ? wrWhole : m_pEdit->GetVisibleWordRange(); |
| 249 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 250 | CPVT_WordRange wrSelBefore(wrWhole.BeginPos, wrSelect.BeginPos); |
| 251 | CPVT_WordRange wrSelAfter(wrSelect.EndPos, wrWhole.EndPos); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 252 | CPVT_WordRange wrTemp = |
| 253 | CPWL_Utils::OverlapWordRange(GetSelectWordRange(), wrVisible); |
| 254 | CFX_ByteString sEditSel = |
dsinclair | e35af1e | 2016-07-13 11:26:20 -0700 | [diff] [blame] | 255 | CPWL_Utils::GetEditSelAppStream(m_pEdit.get(), ptOffset, &wrTemp); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 256 | |
| 257 | if (sEditSel.GetLength() > 0) |
tsepez | 4c3debb | 2016-04-08 12:20:38 -0700 | [diff] [blame] | 258 | sText << CPWL_Utils::GetColorAppStream(PWL_DEFAULT_SELBACKCOLOR).AsStringC() |
| 259 | << sEditSel.AsStringC(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 260 | |
| 261 | wrTemp = CPWL_Utils::OverlapWordRange(wrVisible, wrSelBefore); |
| 262 | CFX_ByteString sEditBefore = CPWL_Utils::GetEditAppStream( |
dsinclair | e35af1e | 2016-07-13 11:26:20 -0700 | [diff] [blame] | 263 | m_pEdit.get(), ptOffset, &wrTemp, !HasFlag(PES_CHARARRAY), |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 264 | m_pEdit->GetPasswordChar()); |
| 265 | |
| 266 | if (sEditBefore.GetLength() > 0) |
tsepez | 4c3debb | 2016-04-08 12:20:38 -0700 | [diff] [blame] | 267 | sText << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC() |
| 268 | << sEditBefore.AsStringC() << "ET\n"; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 269 | |
| 270 | wrTemp = CPWL_Utils::OverlapWordRange(wrVisible, wrSelect); |
| 271 | CFX_ByteString sEditMid = CPWL_Utils::GetEditAppStream( |
dsinclair | e35af1e | 2016-07-13 11:26:20 -0700 | [diff] [blame] | 272 | m_pEdit.get(), ptOffset, &wrTemp, !HasFlag(PES_CHARARRAY), |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 273 | m_pEdit->GetPasswordChar()); |
| 274 | |
| 275 | if (sEditMid.GetLength() > 0) |
| 276 | sText << "BT\n" |
| 277 | << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_GRAY, 1)) |
tsepez | 4c3debb | 2016-04-08 12:20:38 -0700 | [diff] [blame] | 278 | .AsStringC() |
| 279 | << sEditMid.AsStringC() << "ET\n"; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 280 | |
| 281 | wrTemp = CPWL_Utils::OverlapWordRange(wrVisible, wrSelAfter); |
| 282 | CFX_ByteString sEditAfter = CPWL_Utils::GetEditAppStream( |
dsinclair | e35af1e | 2016-07-13 11:26:20 -0700 | [diff] [blame] | 283 | m_pEdit.get(), ptOffset, &wrTemp, !HasFlag(PES_CHARARRAY), |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 284 | m_pEdit->GetPasswordChar()); |
| 285 | |
| 286 | if (sEditAfter.GetLength() > 0) |
tsepez | 4c3debb | 2016-04-08 12:20:38 -0700 | [diff] [blame] | 287 | sText << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC() |
| 288 | << sEditAfter.AsStringC() << "ET\n"; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 289 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 290 | if (sText.GetLength() > 0) { |
weili | db444d2 | 2016-06-02 15:48:15 -0700 | [diff] [blame] | 291 | CFX_FloatRect rect = GetClientRect(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 292 | sAppStream << "q\n/Tx BMC\n"; |
| 293 | |
| 294 | if (!HasFlag(PES_TEXTOVERFLOW)) |
weili | db444d2 | 2016-06-02 15:48:15 -0700 | [diff] [blame] | 295 | sAppStream << rect.left << " " << rect.bottom << " " |
| 296 | << rect.right - rect.left << " " << rect.top - rect.bottom |
| 297 | << " re W n\n"; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 298 | |
| 299 | sAppStream << sText; |
| 300 | |
| 301 | sAppStream << "EMC\nQ\n"; |
| 302 | } |
| 303 | } |
| 304 | |
| 305 | void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, |
Tom Sepez | 60d909e | 2015-12-10 15:34:55 -0800 | [diff] [blame] | 306 | CFX_Matrix* pUser2Device) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 307 | CPWL_Wnd::DrawThisAppearance(pDevice, pUser2Device); |
| 308 | |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 309 | CFX_FloatRect rcClient = GetClientRect(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 310 | CFX_ByteTextBuf sLine; |
| 311 | |
| 312 | int32_t nCharArray = m_pEdit->GetCharArray(); |
| 313 | FX_SAFE_INT32 nCharArraySafe = nCharArray; |
| 314 | nCharArraySafe -= 1; |
| 315 | nCharArraySafe *= 2; |
| 316 | |
| 317 | if (nCharArray > 0 && nCharArraySafe.IsValid()) { |
| 318 | switch (GetBorderStyle()) { |
dsinclair | 92cb5e5 | 2016-05-16 11:38:28 -0700 | [diff] [blame] | 319 | case BorderStyle::SOLID: { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 320 | CFX_GraphStateData gsd; |
| 321 | gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth(); |
| 322 | |
| 323 | CFX_PathData path; |
| 324 | path.SetPointCount(nCharArraySafe.ValueOrDie()); |
| 325 | |
| 326 | for (int32_t i = 0; i < nCharArray - 1; i++) { |
| 327 | path.SetPoint( |
| 328 | i * 2, |
| 329 | rcClient.left + |
| 330 | ((rcClient.right - rcClient.left) / nCharArray) * (i + 1), |
| 331 | rcClient.bottom, FXPT_MOVETO); |
| 332 | path.SetPoint( |
| 333 | i * 2 + 1, |
| 334 | rcClient.left + |
| 335 | ((rcClient.right - rcClient.left) / nCharArray) * (i + 1), |
| 336 | rcClient.top, FXPT_LINETO); |
| 337 | } |
dsinclair | 92cb5e5 | 2016-05-16 11:38:28 -0700 | [diff] [blame] | 338 | if (path.GetPointCount() > 0) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 339 | pDevice->DrawPath( |
| 340 | &path, pUser2Device, &gsd, 0, |
| 341 | CPWL_Utils::PWLColorToFXColor(GetBorderColor(), 255), |
| 342 | FXFILL_ALTERNATE); |
dsinclair | 92cb5e5 | 2016-05-16 11:38:28 -0700 | [diff] [blame] | 343 | } |
| 344 | break; |
| 345 | } |
| 346 | case BorderStyle::DASH: { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 347 | CFX_GraphStateData gsd; |
| 348 | gsd.m_LineWidth = (FX_FLOAT)GetBorderWidth(); |
| 349 | |
| 350 | gsd.SetDashCount(2); |
| 351 | gsd.m_DashArray[0] = (FX_FLOAT)GetBorderDash().nDash; |
| 352 | gsd.m_DashArray[1] = (FX_FLOAT)GetBorderDash().nGap; |
| 353 | gsd.m_DashPhase = (FX_FLOAT)GetBorderDash().nPhase; |
| 354 | |
| 355 | CFX_PathData path; |
| 356 | path.SetPointCount(nCharArraySafe.ValueOrDie()); |
| 357 | |
| 358 | for (int32_t i = 0; i < nCharArray - 1; i++) { |
| 359 | path.SetPoint( |
| 360 | i * 2, |
| 361 | rcClient.left + |
| 362 | ((rcClient.right - rcClient.left) / nCharArray) * (i + 1), |
| 363 | rcClient.bottom, FXPT_MOVETO); |
| 364 | path.SetPoint( |
| 365 | i * 2 + 1, |
| 366 | rcClient.left + |
| 367 | ((rcClient.right - rcClient.left) / nCharArray) * (i + 1), |
| 368 | rcClient.top, FXPT_LINETO); |
| 369 | } |
dsinclair | 92cb5e5 | 2016-05-16 11:38:28 -0700 | [diff] [blame] | 370 | if (path.GetPointCount() > 0) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 371 | pDevice->DrawPath( |
| 372 | &path, pUser2Device, &gsd, 0, |
| 373 | CPWL_Utils::PWLColorToFXColor(GetBorderColor(), 255), |
| 374 | FXFILL_ALTERNATE); |
dsinclair | 92cb5e5 | 2016-05-16 11:38:28 -0700 | [diff] [blame] | 375 | } |
| 376 | break; |
| 377 | } |
| 378 | default: |
| 379 | break; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 380 | } |
| 381 | } |
| 382 | |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 383 | CFX_FloatRect rcClip; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 384 | CPVT_WordRange wrRange = m_pEdit->GetVisibleWordRange(); |
thestig | 1cd352e | 2016-06-07 17:53:06 -0700 | [diff] [blame] | 385 | CPVT_WordRange* pRange = nullptr; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 386 | if (!HasFlag(PES_TEXTOVERFLOW)) { |
| 387 | rcClip = GetClientRect(); |
| 388 | pRange = &wrRange; |
| 389 | } |
tsepez | 63f545c | 2016-09-13 16:08:49 -0700 | [diff] [blame] | 390 | |
dsinclair | b959010 | 2016-04-27 06:38:59 -0700 | [diff] [blame] | 391 | CFX_SystemHandler* pSysHandler = GetSystemHandler(); |
dsinclair | e35af1e | 2016-07-13 11:26:20 -0700 | [diff] [blame] | 392 | CFX_Edit::DrawEdit( |
| 393 | pDevice, pUser2Device, m_pEdit.get(), |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 394 | CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), |
| 395 | CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()), |
tsepez | 63f545c | 2016-09-13 16:08:49 -0700 | [diff] [blame] | 396 | rcClip, CFX_FloatPoint(), pRange, pSysHandler, m_pFormFiller); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 397 | } |
| 398 | |
tsepez | c3255f5 | 2016-03-25 14:52:27 -0700 | [diff] [blame] | 399 | FX_BOOL CPWL_Edit::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 400 | CPWL_Wnd::OnLButtonDown(point, nFlag); |
| 401 | |
| 402 | if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point)) { |
| 403 | if (m_bMouseDown) |
| 404 | InvalidateRect(); |
| 405 | |
| 406 | m_bMouseDown = TRUE; |
| 407 | SetCapture(); |
| 408 | |
| 409 | m_pEdit->OnMouseDown(point, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); |
| 410 | } |
| 411 | |
| 412 | return TRUE; |
| 413 | } |
| 414 | |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 415 | FX_BOOL CPWL_Edit::OnLButtonDblClk(const CFX_FloatPoint& point, |
tsepez | c3255f5 | 2016-03-25 14:52:27 -0700 | [diff] [blame] | 416 | uint32_t nFlag) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 417 | CPWL_Wnd::OnLButtonDblClk(point, nFlag); |
| 418 | |
| 419 | if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point)) { |
| 420 | m_pEdit->SelectAll(); |
| 421 | } |
| 422 | |
| 423 | return TRUE; |
| 424 | } |
| 425 | |
tsepez | c3255f5 | 2016-03-25 14:52:27 -0700 | [diff] [blame] | 426 | FX_BOOL CPWL_Edit::OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 427 | if (m_bMouseDown) |
| 428 | return FALSE; |
| 429 | |
| 430 | CPWL_Wnd::OnRButtonUp(point, nFlag); |
| 431 | |
| 432 | if (!HasFlag(PES_TEXTOVERFLOW) && !ClientHitTest(point)) |
| 433 | return TRUE; |
| 434 | |
dsinclair | b959010 | 2016-04-27 06:38:59 -0700 | [diff] [blame] | 435 | CFX_SystemHandler* pSH = GetSystemHandler(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 436 | if (!pSH) |
| 437 | return FALSE; |
| 438 | |
| 439 | SetFocus(); |
| 440 | |
dsinclair | b959010 | 2016-04-27 06:38:59 -0700 | [diff] [blame] | 441 | return FALSE; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 442 | } |
| 443 | |
| 444 | void CPWL_Edit::OnSetFocus() { |
| 445 | SetEditCaret(TRUE); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 446 | if (!IsReadOnly()) { |
| 447 | if (IPWL_FocusHandler* pFocusHandler = GetFocusHandler()) |
| 448 | pFocusHandler->OnSetFocus(this); |
| 449 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 450 | m_bFocus = TRUE; |
| 451 | } |
| 452 | |
| 453 | void CPWL_Edit::OnKillFocus() { |
| 454 | ShowVScrollBar(FALSE); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 455 | m_pEdit->SelectNone(); |
tsepez | 63f545c | 2016-09-13 16:08:49 -0700 | [diff] [blame] | 456 | SetCaret(FALSE, CFX_FloatPoint(), CFX_FloatPoint()); |
thestig | 907a522 | 2016-06-21 14:38:27 -0700 | [diff] [blame] | 457 | SetCharSet(FXFONT_ANSI_CHARSET); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 458 | m_bFocus = FALSE; |
| 459 | } |
| 460 | |
dsinclair | efd5a99 | 2016-07-18 10:04:07 -0700 | [diff] [blame] | 461 | void CPWL_Edit::SetCharSpace(FX_FLOAT fCharSpace) { |
| 462 | m_pEdit->SetCharSpace(fCharSpace); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 463 | } |
| 464 | |
| 465 | CFX_ByteString CPWL_Edit::GetSelectAppearanceStream( |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 466 | const CFX_FloatPoint& ptOffset) const { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 467 | CPVT_WordRange wr = GetSelectWordRange(); |
dsinclair | e35af1e | 2016-07-13 11:26:20 -0700 | [diff] [blame] | 468 | return CPWL_Utils::GetEditSelAppStream(m_pEdit.get(), ptOffset, &wr); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 469 | } |
| 470 | |
| 471 | CPVT_WordRange CPWL_Edit::GetSelectWordRange() const { |
| 472 | if (m_pEdit->IsSelected()) { |
| 473 | int32_t nStart = -1; |
| 474 | int32_t nEnd = -1; |
| 475 | |
| 476 | m_pEdit->GetSel(nStart, nEnd); |
| 477 | |
| 478 | CPVT_WordPlace wpStart = m_pEdit->WordIndexToWordPlace(nStart); |
| 479 | CPVT_WordPlace wpEnd = m_pEdit->WordIndexToWordPlace(nEnd); |
| 480 | |
| 481 | return CPVT_WordRange(wpStart, wpEnd); |
| 482 | } |
| 483 | |
| 484 | return CPVT_WordRange(); |
| 485 | } |
| 486 | |
| 487 | CFX_ByteString CPWL_Edit::GetTextAppearanceStream( |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 488 | const CFX_FloatPoint& ptOffset) const { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 489 | CFX_ByteTextBuf sRet; |
dsinclair | e35af1e | 2016-07-13 11:26:20 -0700 | [diff] [blame] | 490 | CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit.get(), ptOffset); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 491 | if (sEdit.GetLength() > 0) { |
tsepez | 4c3debb | 2016-04-08 12:20:38 -0700 | [diff] [blame] | 492 | sRet << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC() |
| 493 | << sEdit.AsStringC() << "ET\n"; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 494 | } |
tsepez | 71a452f | 2016-05-13 17:51:27 -0700 | [diff] [blame] | 495 | return sRet.MakeString(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 496 | } |
| 497 | |
| 498 | CFX_ByteString CPWL_Edit::GetCaretAppearanceStream( |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 499 | const CFX_FloatPoint& ptOffset) const { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 500 | if (m_pEditCaret) |
| 501 | return m_pEditCaret->GetCaretAppearanceStream(ptOffset); |
| 502 | |
| 503 | return CFX_ByteString(); |
| 504 | } |
| 505 | |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 506 | CFX_FloatPoint CPWL_Edit::GetWordRightBottomPoint( |
| 507 | const CPVT_WordPlace& wpWord) { |
dsinclair | e35af1e | 2016-07-13 11:26:20 -0700 | [diff] [blame] | 508 | CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); |
thestig | 821d59e | 2016-05-11 12:59:22 -0700 | [diff] [blame] | 509 | CPVT_WordPlace wpOld = pIterator->GetAt(); |
| 510 | pIterator->SetAt(wpWord); |
tsepez | 63f545c | 2016-09-13 16:08:49 -0700 | [diff] [blame] | 511 | |
| 512 | CFX_FloatPoint pt; |
thestig | 821d59e | 2016-05-11 12:59:22 -0700 | [diff] [blame] | 513 | CPVT_Word word; |
| 514 | if (pIterator->GetWord(word)) { |
| 515 | pt = CFX_FloatPoint(word.ptWord.x + word.fWidth, |
| 516 | word.ptWord.y + word.fDescent); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 517 | } |
thestig | 821d59e | 2016-05-11 12:59:22 -0700 | [diff] [blame] | 518 | pIterator->SetAt(wpOld); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 519 | return pt; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 520 | } |
| 521 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 522 | FX_BOOL CPWL_Edit::IsTextFull() const { |
| 523 | return m_pEdit->IsTextFull(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 524 | } |
| 525 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 526 | FX_FLOAT CPWL_Edit::GetCharArrayAutoFontSize(CPDF_Font* pFont, |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 527 | const CFX_FloatRect& rcPlate, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 528 | int32_t nCharArray) { |
| 529 | if (pFont && !pFont->IsStandardFont()) { |
| 530 | FX_RECT rcBBox; |
| 531 | pFont->GetFontBBox(rcBBox); |
| 532 | |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 533 | CFX_FloatRect rcCell = rcPlate; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 534 | FX_FLOAT xdiv = rcCell.Width() / nCharArray * 1000.0f / rcBBox.Width(); |
| 535 | FX_FLOAT ydiv = -rcCell.Height() * 1000.0f / rcBBox.Height(); |
| 536 | |
| 537 | return xdiv < ydiv ? xdiv : ydiv; |
| 538 | } |
| 539 | |
| 540 | return 0.0f; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 541 | } |
| 542 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 543 | void CPWL_Edit::SetCharArray(int32_t nCharArray) { |
| 544 | if (HasFlag(PES_CHARARRAY) && nCharArray > 0) { |
| 545 | m_pEdit->SetCharArray(nCharArray); |
dsinclair | efd5a99 | 2016-07-18 10:04:07 -0700 | [diff] [blame] | 546 | m_pEdit->SetTextOverflow(TRUE, TRUE); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 547 | |
| 548 | if (HasFlag(PWS_AUTOFONTSIZE)) { |
dsinclair | c7a7349 | 2016-04-05 12:01:42 -0700 | [diff] [blame] | 549 | if (IPVT_FontMap* pFontMap = GetFontMap()) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 550 | FX_FLOAT fFontSize = GetCharArrayAutoFontSize( |
| 551 | pFontMap->GetPDFFont(0), GetClientRect(), nCharArray); |
| 552 | if (fFontSize > 0.0f) { |
dsinclair | efd5a99 | 2016-07-18 10:04:07 -0700 | [diff] [blame] | 553 | m_pEdit->SetAutoFontSize(FALSE, TRUE); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 554 | m_pEdit->SetFontSize(fFontSize); |
| 555 | } |
| 556 | } |
| 557 | } |
| 558 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 559 | } |
| 560 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 561 | void CPWL_Edit::SetLimitChar(int32_t nLimitChar) { |
| 562 | m_pEdit->SetLimitChar(nLimitChar); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 563 | } |
| 564 | |
tsepez | 067990c | 2016-09-13 06:46:40 -0700 | [diff] [blame] | 565 | void CPWL_Edit::ReplaceSel(const CFX_WideString& wsText) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 566 | m_pEdit->Clear(); |
tsepez | 067990c | 2016-09-13 06:46:40 -0700 | [diff] [blame] | 567 | m_pEdit->InsertText(wsText, DEFAULT_CHARSET); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 568 | } |
| 569 | |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 570 | CFX_FloatRect CPWL_Edit::GetFocusRect() const { |
| 571 | return CFX_FloatRect(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 572 | } |
| 573 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 574 | void CPWL_Edit::ShowVScrollBar(FX_BOOL bShow) { |
| 575 | if (CPWL_ScrollBar* pScroll = GetVScrollBar()) { |
| 576 | if (bShow) { |
| 577 | if (!pScroll->IsVisible()) { |
| 578 | pScroll->SetVisible(TRUE); |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 579 | CFX_FloatRect rcWindow = GetWindowRect(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 580 | m_rcOldWindow = rcWindow; |
| 581 | rcWindow.right += PWL_SCROLLBAR_WIDTH; |
| 582 | Move(rcWindow, TRUE, TRUE); |
| 583 | } |
| 584 | } else { |
| 585 | if (pScroll->IsVisible()) { |
| 586 | pScroll->SetVisible(FALSE); |
| 587 | Move(m_rcOldWindow, TRUE, TRUE); |
| 588 | } |
| 589 | } |
| 590 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 591 | } |
| 592 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 593 | FX_BOOL CPWL_Edit::IsVScrollBarVisible() const { |
| 594 | if (CPWL_ScrollBar* pScroll = GetVScrollBar()) { |
| 595 | return pScroll->IsVisible(); |
| 596 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 597 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 598 | return FALSE; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 599 | } |
| 600 | |
tsepez | c3255f5 | 2016-03-25 14:52:27 -0700 | [diff] [blame] | 601 | FX_BOOL CPWL_Edit::OnKeyDown(uint16_t nChar, uint32_t nFlag) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 602 | if (m_bMouseDown) |
| 603 | return TRUE; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 604 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 605 | if (nChar == FWL_VKEY_Delete) { |
| 606 | if (m_pFillerNotify) { |
| 607 | FX_BOOL bRC = TRUE; |
| 608 | FX_BOOL bExit = FALSE; |
| 609 | CFX_WideString strChange; |
| 610 | CFX_WideString strChangeEx; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 611 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 612 | int nSelStart = 0; |
| 613 | int nSelEnd = 0; |
| 614 | GetSel(nSelStart, nSelEnd); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 615 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 616 | if (nSelStart == nSelEnd) |
| 617 | nSelEnd = nSelStart + 1; |
Lei Zhang | a5b4704 | 2015-10-19 14:32:16 -0700 | [diff] [blame] | 618 | m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), strChange, |
| 619 | strChangeEx, nSelStart, nSelEnd, TRUE, |
| 620 | bRC, bExit, nFlag); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 621 | if (!bRC) |
| 622 | return FALSE; |
| 623 | if (bExit) |
| 624 | return FALSE; |
| 625 | } |
| 626 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 627 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 628 | FX_BOOL bRet = CPWL_EditCtrl::OnKeyDown(nChar, nFlag); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 629 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 630 | // In case of implementation swallow the OnKeyDown event. |
| 631 | if (IsProceedtoOnChar(nChar, nFlag)) |
| 632 | return TRUE; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 633 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 634 | return bRet; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 635 | } |
| 636 | |
| 637 | /** |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 638 | *In case of implementation swallow the OnKeyDown event. |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 639 | *If the event is swallowed, implementation may do other unexpected things, which |
| 640 | *is not the control means to do. |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 641 | */ |
tsepez | c3255f5 | 2016-03-25 14:52:27 -0700 | [diff] [blame] | 642 | FX_BOOL CPWL_Edit::IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 643 | FX_BOOL bCtrl = IsCTRLpressed(nFlag); |
| 644 | FX_BOOL bAlt = IsALTpressed(nFlag); |
| 645 | if (bCtrl && !bAlt) { |
| 646 | // hot keys for edit control. |
| 647 | switch (nKeyCode) { |
| 648 | case 'C': |
| 649 | case 'V': |
| 650 | case 'X': |
| 651 | case 'A': |
| 652 | case 'Z': |
| 653 | return TRUE; |
| 654 | default: |
| 655 | break; |
| 656 | } |
| 657 | } |
| 658 | // control characters. |
| 659 | switch (nKeyCode) { |
| 660 | case FWL_VKEY_Escape: |
| 661 | case FWL_VKEY_Back: |
| 662 | case FWL_VKEY_Return: |
| 663 | case FWL_VKEY_Space: |
| 664 | return TRUE; |
| 665 | default: |
Lei Zhang | a5b4704 | 2015-10-19 14:32:16 -0700 | [diff] [blame] | 666 | return FALSE; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 667 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 668 | } |
| 669 | |
tsepez | c3255f5 | 2016-03-25 14:52:27 -0700 | [diff] [blame] | 670 | FX_BOOL CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 671 | if (m_bMouseDown) |
| 672 | return TRUE; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 673 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 674 | FX_BOOL bRC = TRUE; |
| 675 | FX_BOOL bExit = FALSE; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 676 | |
Lei Zhang | a5b4704 | 2015-10-19 14:32:16 -0700 | [diff] [blame] | 677 | if (!IsCTRLpressed(nFlag)) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 678 | if (m_pFillerNotify) { |
| 679 | CFX_WideString swChange; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 680 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 681 | int nSelStart = 0; |
| 682 | int nSelEnd = 0; |
| 683 | GetSel(nSelStart, nSelEnd); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 684 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 685 | switch (nChar) { |
| 686 | case FWL_VKEY_Back: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 687 | if (nSelStart == nSelEnd) |
| 688 | nSelStart = nSelEnd - 1; |
| 689 | break; |
| 690 | case FWL_VKEY_Return: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 691 | break; |
| 692 | default: |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 693 | swChange += nChar; |
| 694 | break; |
| 695 | } |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 696 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 697 | CFX_WideString strChangeEx; |
Lei Zhang | a5b4704 | 2015-10-19 14:32:16 -0700 | [diff] [blame] | 698 | m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swChange, |
| 699 | strChangeEx, nSelStart, nSelEnd, TRUE, |
| 700 | bRC, bExit, nFlag); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 701 | } |
| 702 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 703 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 704 | if (!bRC) |
| 705 | return TRUE; |
| 706 | if (bExit) |
| 707 | return FALSE; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 708 | |
dsinclair | c7a7349 | 2016-04-05 12:01:42 -0700 | [diff] [blame] | 709 | if (IPVT_FontMap* pFontMap = GetFontMap()) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 710 | int32_t nOldCharSet = GetCharSet(); |
| 711 | int32_t nNewCharSet = pFontMap->CharSetFromUnicode(nChar, DEFAULT_CHARSET); |
| 712 | if (nOldCharSet != nNewCharSet) { |
| 713 | SetCharSet(nNewCharSet); |
| 714 | } |
| 715 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 716 | |
Lei Zhang | a5b4704 | 2015-10-19 14:32:16 -0700 | [diff] [blame] | 717 | return CPWL_EditCtrl::OnChar(nChar, nFlag); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 718 | } |
| 719 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 720 | FX_BOOL CPWL_Edit::OnMouseWheel(short zDelta, |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 721 | const CFX_FloatPoint& point, |
tsepez | c3255f5 | 2016-03-25 14:52:27 -0700 | [diff] [blame] | 722 | uint32_t nFlag) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 723 | if (HasFlag(PES_MULTILINE)) { |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 724 | CFX_FloatPoint ptScroll = GetScrollPos(); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 725 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 726 | if (zDelta > 0) { |
| 727 | ptScroll.y += GetFontSize(); |
| 728 | } else { |
| 729 | ptScroll.y -= GetFontSize(); |
| 730 | } |
| 731 | SetScrollPos(ptScroll); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 732 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 733 | return TRUE; |
| 734 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 735 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 736 | return FALSE; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 737 | } |
| 738 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 739 | void CPWL_Edit::OnInsertReturn(const CPVT_WordPlace& place, |
| 740 | const CPVT_WordPlace& oldplace) { |
| 741 | if (HasFlag(PES_SPELLCHECK)) { |
| 742 | m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace), |
| 743 | GetLatinWordsRange(place))); |
| 744 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 745 | } |
| 746 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 747 | void CPWL_Edit::OnBackSpace(const CPVT_WordPlace& place, |
| 748 | const CPVT_WordPlace& oldplace) { |
| 749 | if (HasFlag(PES_SPELLCHECK)) { |
| 750 | m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace), |
| 751 | GetLatinWordsRange(place))); |
| 752 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 753 | } |
| 754 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 755 | void CPWL_Edit::OnDelete(const CPVT_WordPlace& place, |
| 756 | const CPVT_WordPlace& oldplace) { |
| 757 | if (HasFlag(PES_SPELLCHECK)) { |
| 758 | m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace), |
| 759 | GetLatinWordsRange(place))); |
| 760 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 761 | } |
| 762 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 763 | void CPWL_Edit::OnClear(const CPVT_WordPlace& place, |
| 764 | const CPVT_WordPlace& oldplace) { |
| 765 | if (HasFlag(PES_SPELLCHECK)) { |
| 766 | m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace), |
| 767 | GetLatinWordsRange(place))); |
| 768 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 769 | } |
| 770 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 771 | void CPWL_Edit::OnInsertWord(const CPVT_WordPlace& place, |
| 772 | const CPVT_WordPlace& oldplace) { |
| 773 | if (HasFlag(PES_SPELLCHECK)) { |
| 774 | m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace), |
| 775 | GetLatinWordsRange(place))); |
| 776 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 777 | } |
| 778 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 779 | void CPWL_Edit::OnInsertText(const CPVT_WordPlace& place, |
| 780 | const CPVT_WordPlace& oldplace) { |
| 781 | if (HasFlag(PES_SPELLCHECK)) { |
| 782 | m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace), |
| 783 | GetLatinWordsRange(place))); |
| 784 | } |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 785 | } |
| 786 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 787 | CPVT_WordRange CPWL_Edit::CombineWordRange(const CPVT_WordRange& wr1, |
| 788 | const CPVT_WordRange& wr2) { |
| 789 | CPVT_WordRange wrRet; |
| 790 | |
| 791 | if (wr1.BeginPos.WordCmp(wr2.BeginPos) < 0) { |
| 792 | wrRet.BeginPos = wr1.BeginPos; |
| 793 | } else { |
| 794 | wrRet.BeginPos = wr2.BeginPos; |
| 795 | } |
| 796 | |
| 797 | if (wr1.EndPos.WordCmp(wr2.EndPos) < 0) { |
| 798 | wrRet.EndPos = wr2.EndPos; |
| 799 | } else { |
| 800 | wrRet.EndPos = wr1.EndPos; |
| 801 | } |
| 802 | |
| 803 | return wrRet; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 804 | } |
| 805 | |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 806 | CPVT_WordRange CPWL_Edit::GetLatinWordsRange( |
| 807 | const CFX_FloatPoint& point) const { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 808 | return GetSameWordsRange(m_pEdit->SearchWordPlace(point), TRUE, FALSE); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 809 | } |
| 810 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 811 | CPVT_WordRange CPWL_Edit::GetLatinWordsRange( |
| 812 | const CPVT_WordPlace& place) const { |
| 813 | return GetSameWordsRange(place, TRUE, FALSE); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 814 | } |
| 815 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 816 | CPVT_WordRange CPWL_Edit::GetArabicWordsRange( |
| 817 | const CPVT_WordPlace& place) const { |
| 818 | return GetSameWordsRange(place, FALSE, TRUE); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 819 | } |
| 820 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 821 | #define PWL_ISARABICWORD(word) \ |
| 822 | ((word >= 0x0600 && word <= 0x06FF) || (word >= 0xFB50 && word <= 0xFEFC)) |
| 823 | |
| 824 | CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace& place, |
| 825 | FX_BOOL bLatin, |
| 826 | FX_BOOL bArabic) const { |
| 827 | CPVT_WordRange range; |
| 828 | |
dsinclair | e35af1e | 2016-07-13 11:26:20 -0700 | [diff] [blame] | 829 | CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); |
thestig | 821d59e | 2016-05-11 12:59:22 -0700 | [diff] [blame] | 830 | CPVT_Word wordinfo; |
| 831 | CPVT_WordPlace wpStart(place), wpEnd(place); |
| 832 | pIterator->SetAt(place); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 833 | |
thestig | 821d59e | 2016-05-11 12:59:22 -0700 | [diff] [blame] | 834 | if (bLatin) { |
| 835 | while (pIterator->NextWord()) { |
| 836 | if (!pIterator->GetWord(wordinfo) || |
| 837 | !FX_EDIT_ISLATINWORD(wordinfo.Word)) { |
| 838 | break; |
Lei Zhang | c2fb35f | 2016-01-05 16:46:58 -0800 | [diff] [blame] | 839 | } |
Lei Zhang | c2fb35f | 2016-01-05 16:46:58 -0800 | [diff] [blame] | 840 | |
thestig | 821d59e | 2016-05-11 12:59:22 -0700 | [diff] [blame] | 841 | wpEnd = pIterator->GetAt(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 842 | } |
thestig | 821d59e | 2016-05-11 12:59:22 -0700 | [diff] [blame] | 843 | } else if (bArabic) { |
| 844 | while (pIterator->NextWord()) { |
| 845 | if (!pIterator->GetWord(wordinfo) || !PWL_ISARABICWORD(wordinfo.Word)) |
| 846 | break; |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 847 | |
thestig | 821d59e | 2016-05-11 12:59:22 -0700 | [diff] [blame] | 848 | wpEnd = pIterator->GetAt(); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 849 | } |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 850 | } |
| 851 | |
thestig | 821d59e | 2016-05-11 12:59:22 -0700 | [diff] [blame] | 852 | pIterator->SetAt(place); |
| 853 | |
| 854 | if (bLatin) { |
| 855 | do { |
| 856 | if (!pIterator->GetWord(wordinfo) || |
| 857 | !FX_EDIT_ISLATINWORD(wordinfo.Word)) { |
| 858 | break; |
| 859 | } |
| 860 | |
| 861 | wpStart = pIterator->GetAt(); |
| 862 | } while (pIterator->PrevWord()); |
| 863 | } else if (bArabic) { |
| 864 | do { |
| 865 | if (!pIterator->GetWord(wordinfo) || !PWL_ISARABICWORD(wordinfo.Word)) |
| 866 | break; |
| 867 | |
| 868 | wpStart = pIterator->GetAt(); |
| 869 | } while (pIterator->PrevWord()); |
| 870 | } |
| 871 | |
| 872 | range.Set(wpStart, wpEnd); |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 873 | return range; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 874 | } |
| 875 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 876 | void CPWL_Edit::GeneratePageObjects( |
Tom Sepez | 2398d89 | 2016-02-17 16:46:26 -0800 | [diff] [blame] | 877 | CPDF_PageObjectHolder* pObjectHolder, |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 878 | const CFX_FloatPoint& ptOffset, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 879 | CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray) { |
dsinclair | e35af1e | 2016-07-13 11:26:20 -0700 | [diff] [blame] | 880 | CFX_Edit::GeneratePageObjects( |
| 881 | pObjectHolder, m_pEdit.get(), ptOffset, nullptr, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 882 | CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), |
| 883 | ObjArray); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 884 | } |
| 885 | |
Tom Sepez | 2398d89 | 2016-02-17 16:46:26 -0800 | [diff] [blame] | 886 | void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, |
Tom Sepez | 281a9ea | 2016-02-26 14:24:28 -0800 | [diff] [blame] | 887 | const CFX_FloatPoint& ptOffset) { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 888 | CFX_ArrayTemplate<CPDF_TextObject*> ObjArray; |
dsinclair | e35af1e | 2016-07-13 11:26:20 -0700 | [diff] [blame] | 889 | CFX_Edit::GeneratePageObjects( |
| 890 | pObjectHolder, m_pEdit.get(), ptOffset, nullptr, |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 891 | CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), |
| 892 | ObjArray); |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 893 | } |