| 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 "fpdfsdk/pdfwindow/PWL_Edit.h" | 7 #include "fpdfsdk/pdfwindow/PWL_Edit.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "core/fpdfapi/font/cpdf_font.h" | 11 #include "core/fpdfapi/font/cpdf_font.h" |
| 12 #include "core/fpdfdoc/cpvt_word.h" | 12 #include "core/fpdfdoc/cpvt_word.h" |
| 13 #include "core/fxcrt/fx_safe_types.h" | 13 #include "core/fxcrt/fx_safe_types.h" |
| 14 #include "core/fxcrt/fx_xml.h" | 14 #include "core/fxcrt/fx_xml.h" |
| 15 #include "core/fxge/cfx_graphstatedata.h" | 15 #include "core/fxge/cfx_graphstatedata.h" |
| 16 #include "core/fxge/cfx_pathdata.h" | 16 #include "core/fxge/cfx_pathdata.h" |
| 17 #include "core/fxge/cfx_renderdevice.h" | 17 #include "core/fxge/cfx_renderdevice.h" |
| 18 #include "core/fxge/fx_font.h" | 18 #include "core/fxge/fx_font.h" |
| 19 #include "fpdfsdk/fxedit/fxet_edit.h" | 19 #include "fpdfsdk/fxedit/fxet_edit.h" |
| 20 #include "fpdfsdk/pdfwindow/PWL_Caret.h" | 20 #include "fpdfsdk/pdfwindow/PWL_Caret.h" |
| 21 #include "fpdfsdk/pdfwindow/PWL_EditCtrl.h" | 21 #include "fpdfsdk/pdfwindow/PWL_EditCtrl.h" |
| 22 #include "fpdfsdk/pdfwindow/PWL_FontMap.h" | 22 #include "fpdfsdk/pdfwindow/PWL_FontMap.h" |
| 23 #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h" | 23 #include "fpdfsdk/pdfwindow/PWL_ScrollBar.h" |
| 24 #include "fpdfsdk/pdfwindow/PWL_Utils.h" | 24 #include "fpdfsdk/pdfwindow/PWL_Utils.h" |
| 25 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" | 25 #include "fpdfsdk/pdfwindow/PWL_Wnd.h" |
| 26 #include "public/fpdf_fwlevent.h" | 26 #include "public/fpdf_fwlevent.h" |
| 27 #include "third_party/base/stl_util.h" | 27 #include "third_party/base/stl_util.h" |
| 28 | 28 |
| 29 CPWL_Edit::CPWL_Edit() | 29 CPWL_Edit::CPWL_Edit() |
| 30 : m_pFillerNotify(nullptr), m_bFocus(FALSE), m_pFormFiller(nullptr) {} | 30 : m_pFillerNotify(nullptr), m_bFocus(false), m_pFormFiller(nullptr) {} |
| 31 | 31 |
| 32 CPWL_Edit::~CPWL_Edit() { | 32 CPWL_Edit::~CPWL_Edit() { |
| 33 ASSERT(m_bFocus == FALSE); | 33 ASSERT(m_bFocus == false); |
| 34 } | 34 } |
| 35 | 35 |
| 36 CFX_ByteString CPWL_Edit::GetClassName() const { | 36 CFX_ByteString CPWL_Edit::GetClassName() const { |
| 37 return PWL_CLASSNAME_EDIT; | 37 return PWL_CLASSNAME_EDIT; |
| 38 } | 38 } |
| 39 | 39 |
| 40 void CPWL_Edit::OnDestroy() {} | 40 void CPWL_Edit::OnDestroy() {} |
| 41 | 41 |
| 42 void CPWL_Edit::SetText(const CFX_WideString& csText) { | 42 void CPWL_Edit::SetText(const CFX_WideString& csText) { |
| 43 CFX_WideString swText = csText; | 43 CFX_WideString swText = csText; |
| 44 if (HasFlag(PES_RICH)) { | 44 if (HasFlag(PES_RICH)) { |
| 45 CFX_ByteString sValue = CFX_ByteString::FromUnicode(swText); | 45 CFX_ByteString sValue = CFX_ByteString::FromUnicode(swText); |
| 46 if (CXML_Element* pXML = | 46 if (CXML_Element* pXML = |
| 47 CXML_Element::Parse(sValue.c_str(), sValue.GetLength())) { | 47 CXML_Element::Parse(sValue.c_str(), sValue.GetLength())) { |
| 48 int32_t nCount = pXML->CountChildren(); | 48 int32_t nCount = pXML->CountChildren(); |
| 49 FX_BOOL bFirst = TRUE; | 49 bool bFirst = true; |
| 50 | 50 |
| 51 swText.clear(); | 51 swText.clear(); |
| 52 | 52 |
| 53 for (int32_t i = 0; i < nCount; i++) { | 53 for (int32_t i = 0; i < nCount; i++) { |
| 54 if (CXML_Element* pSubElement = pXML->GetElement(i)) { | 54 if (CXML_Element* pSubElement = pXML->GetElement(i)) { |
| 55 CFX_ByteString tag = pSubElement->GetTagName(); | 55 CFX_ByteString tag = pSubElement->GetTagName(); |
| 56 if (tag.EqualNoCase("p")) { | 56 if (tag.EqualNoCase("p")) { |
| 57 int nChild = pSubElement->CountChildren(); | 57 int nChild = pSubElement->CountChildren(); |
| 58 CFX_WideString swSection; | 58 CFX_WideString swSection; |
| 59 for (int32_t j = 0; j < nChild; j++) { | 59 for (int32_t j = 0; j < nChild; j++) { |
| 60 swSection += pSubElement->GetContent(j); | 60 swSection += pSubElement->GetContent(j); |
| 61 } | 61 } |
| 62 | 62 |
| 63 if (bFirst) | 63 if (bFirst) |
| 64 bFirst = FALSE; | 64 bFirst = false; |
| 65 else | 65 else |
| 66 swText += FWL_VKEY_Return; | 66 swText += FWL_VKEY_Return; |
| 67 swText += swSection; | 67 swText += swSection; |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 delete pXML; | 72 delete pXML; |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 m_pEdit->SetText(swText); | 76 m_pEdit->SetText(swText); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void CPWL_Edit::RePosChildWnd() { | 79 void CPWL_Edit::RePosChildWnd() { |
| 80 if (CPWL_ScrollBar* pVSB = GetVScrollBar()) { | 80 if (CPWL_ScrollBar* pVSB = GetVScrollBar()) { |
| 81 CFX_FloatRect rcWindow = m_rcOldWindow; | 81 CFX_FloatRect rcWindow = m_rcOldWindow; |
| 82 CFX_FloatRect rcVScroll = | 82 CFX_FloatRect rcVScroll = |
| 83 CFX_FloatRect(rcWindow.right, rcWindow.bottom, | 83 CFX_FloatRect(rcWindow.right, rcWindow.bottom, |
| 84 rcWindow.right + PWL_SCROLLBAR_WIDTH, rcWindow.top); | 84 rcWindow.right + PWL_SCROLLBAR_WIDTH, rcWindow.top); |
| 85 pVSB->Move(rcVScroll, TRUE, FALSE); | 85 pVSB->Move(rcVScroll, true, false); |
| 86 } | 86 } |
| 87 | 87 |
| 88 if (m_pEditCaret && !HasFlag(PES_TEXTOVERFLOW)) | 88 if (m_pEditCaret && !HasFlag(PES_TEXTOVERFLOW)) |
| 89 m_pEditCaret->SetClipRect(CPWL_Utils::InflateRect( | 89 m_pEditCaret->SetClipRect(CPWL_Utils::InflateRect( |
| 90 GetClientRect(), 1.0f)); // +1 for caret beside border | 90 GetClientRect(), 1.0f)); // +1 for caret beside border |
| 91 | 91 |
| 92 CPWL_EditCtrl::RePosChildWnd(); | 92 CPWL_EditCtrl::RePosChildWnd(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 CFX_FloatRect CPWL_Edit::GetClientRect() const { | 95 CFX_FloatRect CPWL_Edit::GetClientRect() const { |
| 96 CFX_FloatRect rcClient = CPWL_Utils::DeflateRect( | 96 CFX_FloatRect rcClient = CPWL_Utils::DeflateRect( |
| 97 GetWindowRect(), (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth())); | 97 GetWindowRect(), (FX_FLOAT)(GetBorderWidth() + GetInnerBorderWidth())); |
| 98 | 98 |
| 99 if (CPWL_ScrollBar* pVSB = GetVScrollBar()) { | 99 if (CPWL_ScrollBar* pVSB = GetVScrollBar()) { |
| 100 if (pVSB->IsVisible()) { | 100 if (pVSB->IsVisible()) { |
| 101 rcClient.right -= PWL_SCROLLBAR_WIDTH; | 101 rcClient.right -= PWL_SCROLLBAR_WIDTH; |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 return rcClient; | 105 return rcClient; |
| 106 } | 106 } |
| 107 | 107 |
| 108 void CPWL_Edit::SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat, | 108 void CPWL_Edit::SetAlignFormatV(PWL_EDIT_ALIGNFORMAT_V nFormat, bool bPaint) { |
| 109 FX_BOOL bPaint) { | |
| 110 m_pEdit->SetAlignmentV((int32_t)nFormat, bPaint); | 109 m_pEdit->SetAlignmentV((int32_t)nFormat, bPaint); |
| 111 } | 110 } |
| 112 | 111 |
| 113 FX_BOOL CPWL_Edit::CanSelectAll() const { | 112 bool CPWL_Edit::CanSelectAll() const { |
| 114 return GetSelectWordRange() != m_pEdit->GetWholeWordRange(); | 113 return GetSelectWordRange() != m_pEdit->GetWholeWordRange(); |
| 115 } | 114 } |
| 116 | 115 |
| 117 FX_BOOL CPWL_Edit::CanClear() const { | 116 bool CPWL_Edit::CanClear() const { |
| 118 return !IsReadOnly() && m_pEdit->IsSelected(); | 117 return !IsReadOnly() && m_pEdit->IsSelected(); |
| 119 } | 118 } |
| 120 | 119 |
| 121 FX_BOOL CPWL_Edit::CanCopy() const { | 120 bool CPWL_Edit::CanCopy() const { |
| 122 return !HasFlag(PES_PASSWORD) && !HasFlag(PES_NOREAD) && | 121 return !HasFlag(PES_PASSWORD) && !HasFlag(PES_NOREAD) && |
| 123 m_pEdit->IsSelected(); | 122 m_pEdit->IsSelected(); |
| 124 } | 123 } |
| 125 | 124 |
| 126 FX_BOOL CPWL_Edit::CanCut() const { | 125 bool CPWL_Edit::CanCut() const { |
| 127 return CanCopy() && !IsReadOnly(); | 126 return CanCopy() && !IsReadOnly(); |
| 128 } | 127 } |
| 129 void CPWL_Edit::CutText() { | 128 void CPWL_Edit::CutText() { |
| 130 if (!CanCut()) | 129 if (!CanCut()) |
| 131 return; | 130 return; |
| 132 m_pEdit->Clear(); | 131 m_pEdit->Clear(); |
| 133 } | 132 } |
| 134 | 133 |
| 135 void CPWL_Edit::OnCreated() { | 134 void CPWL_Edit::OnCreated() { |
| 136 CPWL_EditCtrl::OnCreated(); | 135 CPWL_EditCtrl::OnCreated(); |
| 137 | 136 |
| 138 if (CPWL_ScrollBar* pScroll = GetVScrollBar()) { | 137 if (CPWL_ScrollBar* pScroll = GetVScrollBar()) { |
| 139 pScroll->RemoveFlag(PWS_AUTOTRANSPARENT); | 138 pScroll->RemoveFlag(PWS_AUTOTRANSPARENT); |
| 140 pScroll->SetTransparency(255); | 139 pScroll->SetTransparency(255); |
| 141 } | 140 } |
| 142 | 141 |
| 143 SetParamByFlag(); | 142 SetParamByFlag(); |
| 144 | 143 |
| 145 m_rcOldWindow = GetWindowRect(); | 144 m_rcOldWindow = GetWindowRect(); |
| 146 | 145 |
| 147 m_pEdit->SetOprNotify(this); | 146 m_pEdit->SetOprNotify(this); |
| 148 m_pEdit->EnableOprNotify(TRUE); | 147 m_pEdit->EnableOprNotify(true); |
| 149 } | 148 } |
| 150 | 149 |
| 151 void CPWL_Edit::SetParamByFlag() { | 150 void CPWL_Edit::SetParamByFlag() { |
| 152 if (HasFlag(PES_RIGHT)) { | 151 if (HasFlag(PES_RIGHT)) { |
| 153 m_pEdit->SetAlignmentH(2, FALSE); | 152 m_pEdit->SetAlignmentH(2, false); |
| 154 } else if (HasFlag(PES_MIDDLE)) { | 153 } else if (HasFlag(PES_MIDDLE)) { |
| 155 m_pEdit->SetAlignmentH(1, FALSE); | 154 m_pEdit->SetAlignmentH(1, false); |
| 156 } else { | 155 } else { |
| 157 m_pEdit->SetAlignmentH(0, FALSE); | 156 m_pEdit->SetAlignmentH(0, false); |
| 158 } | 157 } |
| 159 | 158 |
| 160 if (HasFlag(PES_BOTTOM)) { | 159 if (HasFlag(PES_BOTTOM)) { |
| 161 m_pEdit->SetAlignmentV(2, FALSE); | 160 m_pEdit->SetAlignmentV(2, false); |
| 162 } else if (HasFlag(PES_CENTER)) { | 161 } else if (HasFlag(PES_CENTER)) { |
| 163 m_pEdit->SetAlignmentV(1, FALSE); | 162 m_pEdit->SetAlignmentV(1, false); |
| 164 } else { | 163 } else { |
| 165 m_pEdit->SetAlignmentV(0, FALSE); | 164 m_pEdit->SetAlignmentV(0, false); |
| 166 } | 165 } |
| 167 | 166 |
| 168 if (HasFlag(PES_PASSWORD)) { | 167 if (HasFlag(PES_PASSWORD)) { |
| 169 m_pEdit->SetPasswordChar('*', FALSE); | 168 m_pEdit->SetPasswordChar('*', false); |
| 170 } | 169 } |
| 171 | 170 |
| 172 m_pEdit->SetMultiLine(HasFlag(PES_MULTILINE), FALSE); | 171 m_pEdit->SetMultiLine(HasFlag(PES_MULTILINE), false); |
| 173 m_pEdit->SetAutoReturn(HasFlag(PES_AUTORETURN), FALSE); | 172 m_pEdit->SetAutoReturn(HasFlag(PES_AUTORETURN), false); |
| 174 m_pEdit->SetAutoFontSize(HasFlag(PWS_AUTOFONTSIZE), FALSE); | 173 m_pEdit->SetAutoFontSize(HasFlag(PWS_AUTOFONTSIZE), false); |
| 175 m_pEdit->SetAutoScroll(HasFlag(PES_AUTOSCROLL), FALSE); | 174 m_pEdit->SetAutoScroll(HasFlag(PES_AUTOSCROLL), false); |
| 176 m_pEdit->EnableUndo(HasFlag(PES_UNDO)); | 175 m_pEdit->EnableUndo(HasFlag(PES_UNDO)); |
| 177 | 176 |
| 178 if (HasFlag(PES_TEXTOVERFLOW)) { | 177 if (HasFlag(PES_TEXTOVERFLOW)) { |
| 179 SetClipRect(CFX_FloatRect(0.0f, 0.0f, 0.0f, 0.0f)); | 178 SetClipRect(CFX_FloatRect(0.0f, 0.0f, 0.0f, 0.0f)); |
| 180 m_pEdit->SetTextOverflow(TRUE, FALSE); | 179 m_pEdit->SetTextOverflow(true, false); |
| 181 } else { | 180 } else { |
| 182 if (m_pEditCaret) { | 181 if (m_pEditCaret) { |
| 183 m_pEditCaret->SetClipRect(CPWL_Utils::InflateRect( | 182 m_pEditCaret->SetClipRect(CPWL_Utils::InflateRect( |
| 184 GetClientRect(), 1.0f)); // +1 for caret beside border | 183 GetClientRect(), 1.0f)); // +1 for caret beside border |
| 185 } | 184 } |
| 186 } | 185 } |
| 187 } | 186 } |
| 188 | 187 |
| 189 void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { | 188 void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { |
| 190 CPWL_Wnd::GetThisAppearanceStream(sAppStream); | 189 CPWL_Wnd::GetThisAppearanceStream(sAppStream); |
| 191 | 190 |
| 192 CFX_FloatRect rcClient = GetClientRect(); | 191 CFX_FloatRect rcClient = GetClientRect(); |
| 193 CFX_ByteTextBuf sLine; | 192 CFX_ByteTextBuf sLine; |
| 194 | 193 |
| 195 int32_t nCharArray = m_pEdit->GetCharArray(); | 194 int32_t nCharArray = m_pEdit->GetCharArray(); |
| 196 | 195 |
| 197 if (nCharArray > 0) { | 196 if (nCharArray > 0) { |
| 198 switch (GetBorderStyle()) { | 197 switch (GetBorderStyle()) { |
| 199 case BorderStyle::SOLID: { | 198 case BorderStyle::SOLID: { |
| 200 sLine << "q\n" << GetBorderWidth() << " w\n" | 199 sLine << "q\n" |
| 201 << CPWL_Utils::GetColorAppStream(GetBorderColor(), FALSE) | 200 << GetBorderWidth() << " w\n" |
| 201 << CPWL_Utils::GetColorAppStream(GetBorderColor(), false) |
| 202 .AsStringC() | 202 .AsStringC() |
| 203 << " 2 J 0 j\n"; | 203 << " 2 J 0 j\n"; |
| 204 | 204 |
| 205 for (int32_t i = 1; i < nCharArray; i++) { | 205 for (int32_t i = 1; i < nCharArray; i++) { |
| 206 sLine << rcClient.left + | 206 sLine << rcClient.left + |
| 207 ((rcClient.right - rcClient.left) / nCharArray) * i | 207 ((rcClient.right - rcClient.left) / nCharArray) * i |
| 208 << " " << rcClient.bottom << " m\n" | 208 << " " << rcClient.bottom << " m\n" |
| 209 << rcClient.left + | 209 << rcClient.left + |
| 210 ((rcClient.right - rcClient.left) / nCharArray) * i | 210 ((rcClient.right - rcClient.left) / nCharArray) * i |
| 211 << " " << rcClient.top << " l S\n"; | 211 << " " << rcClient.top << " l S\n"; |
| 212 } | 212 } |
| 213 | 213 |
| 214 sLine << "Q\n"; | 214 sLine << "Q\n"; |
| 215 break; | 215 break; |
| 216 } | 216 } |
| 217 case BorderStyle::DASH: { | 217 case BorderStyle::DASH: { |
| 218 sLine << "q\n" << GetBorderWidth() << " w\n" | 218 sLine << "q\n" |
| 219 << CPWL_Utils::GetColorAppStream(GetBorderColor(), FALSE) | 219 << GetBorderWidth() << " w\n" |
| 220 << CPWL_Utils::GetColorAppStream(GetBorderColor(), false) |
| 220 .AsStringC() | 221 .AsStringC() |
| 221 << " 2 J 0 j\n" | 222 << " 2 J 0 j\n" |
| 222 << "[" << GetBorderDash().nDash << " " << GetBorderDash().nGap | 223 << "[" << GetBorderDash().nDash << " " << GetBorderDash().nGap |
| 223 << "] " << GetBorderDash().nPhase << " d\n"; | 224 << "] " << GetBorderDash().nPhase << " d\n"; |
| 224 | 225 |
| 225 for (int32_t i = 1; i < nCharArray; i++) { | 226 for (int32_t i = 1; i < nCharArray; i++) { |
| 226 sLine << rcClient.left + | 227 sLine << rcClient.left + |
| 227 ((rcClient.right - rcClient.left) / nCharArray) * i | 228 ((rcClient.right - rcClient.left) / nCharArray) * i |
| 228 << " " << rcClient.bottom << " m\n" | 229 << " " << rcClient.bottom << " m\n" |
| 229 << rcClient.left + | 230 << rcClient.left + |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 } | 391 } |
| 391 | 392 |
| 392 CFX_SystemHandler* pSysHandler = GetSystemHandler(); | 393 CFX_SystemHandler* pSysHandler = GetSystemHandler(); |
| 393 CFX_Edit::DrawEdit( | 394 CFX_Edit::DrawEdit( |
| 394 pDevice, pUser2Device, m_pEdit.get(), | 395 pDevice, pUser2Device, m_pEdit.get(), |
| 395 CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), | 396 CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), |
| 396 CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()), | 397 CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()), |
| 397 rcClip, CFX_FloatPoint(), pRange, pSysHandler, m_pFormFiller); | 398 rcClip, CFX_FloatPoint(), pRange, pSysHandler, m_pFormFiller); |
| 398 } | 399 } |
| 399 | 400 |
| 400 FX_BOOL CPWL_Edit::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { | 401 bool CPWL_Edit::OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag) { |
| 401 CPWL_Wnd::OnLButtonDown(point, nFlag); | 402 CPWL_Wnd::OnLButtonDown(point, nFlag); |
| 402 | 403 |
| 403 if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point)) { | 404 if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point)) { |
| 404 if (m_bMouseDown) | 405 if (m_bMouseDown) |
| 405 InvalidateRect(); | 406 InvalidateRect(); |
| 406 | 407 |
| 407 m_bMouseDown = TRUE; | 408 m_bMouseDown = true; |
| 408 SetCapture(); | 409 SetCapture(); |
| 409 | 410 |
| 410 m_pEdit->OnMouseDown(point, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); | 411 m_pEdit->OnMouseDown(point, IsSHIFTpressed(nFlag), IsCTRLpressed(nFlag)); |
| 411 } | 412 } |
| 412 | 413 |
| 413 return TRUE; | 414 return true; |
| 414 } | 415 } |
| 415 | 416 |
| 416 FX_BOOL CPWL_Edit::OnLButtonDblClk(const CFX_FloatPoint& point, | 417 bool CPWL_Edit::OnLButtonDblClk(const CFX_FloatPoint& point, uint32_t nFlag) { |
| 417 uint32_t nFlag) { | |
| 418 CPWL_Wnd::OnLButtonDblClk(point, nFlag); | 418 CPWL_Wnd::OnLButtonDblClk(point, nFlag); |
| 419 | 419 |
| 420 if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point)) { | 420 if (HasFlag(PES_TEXTOVERFLOW) || ClientHitTest(point)) { |
| 421 m_pEdit->SelectAll(); | 421 m_pEdit->SelectAll(); |
| 422 } | 422 } |
| 423 | 423 |
| 424 return TRUE; | 424 return true; |
| 425 } | 425 } |
| 426 | 426 |
| 427 FX_BOOL CPWL_Edit::OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { | 427 bool CPWL_Edit::OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag) { |
| 428 if (m_bMouseDown) | 428 if (m_bMouseDown) |
| 429 return FALSE; | 429 return false; |
| 430 | 430 |
| 431 CPWL_Wnd::OnRButtonUp(point, nFlag); | 431 CPWL_Wnd::OnRButtonUp(point, nFlag); |
| 432 | 432 |
| 433 if (!HasFlag(PES_TEXTOVERFLOW) && !ClientHitTest(point)) | 433 if (!HasFlag(PES_TEXTOVERFLOW) && !ClientHitTest(point)) |
| 434 return TRUE; | 434 return true; |
| 435 | 435 |
| 436 CFX_SystemHandler* pSH = GetSystemHandler(); | 436 CFX_SystemHandler* pSH = GetSystemHandler(); |
| 437 if (!pSH) | 437 if (!pSH) |
| 438 return FALSE; | 438 return false; |
| 439 | 439 |
| 440 SetFocus(); | 440 SetFocus(); |
| 441 | 441 |
| 442 return FALSE; | 442 return false; |
| 443 } | 443 } |
| 444 | 444 |
| 445 void CPWL_Edit::OnSetFocus() { | 445 void CPWL_Edit::OnSetFocus() { |
| 446 SetEditCaret(TRUE); | 446 SetEditCaret(true); |
| 447 if (!IsReadOnly()) { | 447 if (!IsReadOnly()) { |
| 448 if (IPWL_FocusHandler* pFocusHandler = GetFocusHandler()) | 448 if (IPWL_FocusHandler* pFocusHandler = GetFocusHandler()) |
| 449 pFocusHandler->OnSetFocus(this); | 449 pFocusHandler->OnSetFocus(this); |
| 450 } | 450 } |
| 451 m_bFocus = TRUE; | 451 m_bFocus = true; |
| 452 } | 452 } |
| 453 | 453 |
| 454 void CPWL_Edit::OnKillFocus() { | 454 void CPWL_Edit::OnKillFocus() { |
| 455 ShowVScrollBar(FALSE); | 455 ShowVScrollBar(false); |
| 456 m_pEdit->SelectNone(); | 456 m_pEdit->SelectNone(); |
| 457 SetCaret(FALSE, CFX_FloatPoint(), CFX_FloatPoint()); | 457 SetCaret(false, CFX_FloatPoint(), CFX_FloatPoint()); |
| 458 SetCharSet(FXFONT_ANSI_CHARSET); | 458 SetCharSet(FXFONT_ANSI_CHARSET); |
| 459 m_bFocus = FALSE; | 459 m_bFocus = false; |
| 460 } | 460 } |
| 461 | 461 |
| 462 void CPWL_Edit::SetCharSpace(FX_FLOAT fCharSpace) { | 462 void CPWL_Edit::SetCharSpace(FX_FLOAT fCharSpace) { |
| 463 m_pEdit->SetCharSpace(fCharSpace); | 463 m_pEdit->SetCharSpace(fCharSpace); |
| 464 } | 464 } |
| 465 | 465 |
| 466 CFX_ByteString CPWL_Edit::GetSelectAppearanceStream( | 466 CFX_ByteString CPWL_Edit::GetSelectAppearanceStream( |
| 467 const CFX_FloatPoint& ptOffset) const { | 467 const CFX_FloatPoint& ptOffset) const { |
| 468 CPVT_WordRange wr = GetSelectWordRange(); | 468 CPVT_WordRange wr = GetSelectWordRange(); |
| 469 return CPWL_Utils::GetEditSelAppStream(m_pEdit.get(), ptOffset, &wr); | 469 return CPWL_Utils::GetEditSelAppStream(m_pEdit.get(), ptOffset, &wr); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 CFX_FloatPoint pt; | 513 CFX_FloatPoint pt; |
| 514 CPVT_Word word; | 514 CPVT_Word word; |
| 515 if (pIterator->GetWord(word)) { | 515 if (pIterator->GetWord(word)) { |
| 516 pt = CFX_FloatPoint(word.ptWord.x + word.fWidth, | 516 pt = CFX_FloatPoint(word.ptWord.x + word.fWidth, |
| 517 word.ptWord.y + word.fDescent); | 517 word.ptWord.y + word.fDescent); |
| 518 } | 518 } |
| 519 pIterator->SetAt(wpOld); | 519 pIterator->SetAt(wpOld); |
| 520 return pt; | 520 return pt; |
| 521 } | 521 } |
| 522 | 522 |
| 523 FX_BOOL CPWL_Edit::IsTextFull() const { | 523 bool CPWL_Edit::IsTextFull() const { |
| 524 return m_pEdit->IsTextFull(); | 524 return m_pEdit->IsTextFull(); |
| 525 } | 525 } |
| 526 | 526 |
| 527 FX_FLOAT CPWL_Edit::GetCharArrayAutoFontSize(CPDF_Font* pFont, | 527 FX_FLOAT CPWL_Edit::GetCharArrayAutoFontSize(CPDF_Font* pFont, |
| 528 const CFX_FloatRect& rcPlate, | 528 const CFX_FloatRect& rcPlate, |
| 529 int32_t nCharArray) { | 529 int32_t nCharArray) { |
| 530 if (pFont && !pFont->IsStandardFont()) { | 530 if (pFont && !pFont->IsStandardFont()) { |
| 531 FX_RECT rcBBox; | 531 FX_RECT rcBBox; |
| 532 pFont->GetFontBBox(rcBBox); | 532 pFont->GetFontBBox(rcBBox); |
| 533 | 533 |
| 534 CFX_FloatRect rcCell = rcPlate; | 534 CFX_FloatRect rcCell = rcPlate; |
| 535 FX_FLOAT xdiv = rcCell.Width() / nCharArray * 1000.0f / rcBBox.Width(); | 535 FX_FLOAT xdiv = rcCell.Width() / nCharArray * 1000.0f / rcBBox.Width(); |
| 536 FX_FLOAT ydiv = -rcCell.Height() * 1000.0f / rcBBox.Height(); | 536 FX_FLOAT ydiv = -rcCell.Height() * 1000.0f / rcBBox.Height(); |
| 537 | 537 |
| 538 return xdiv < ydiv ? xdiv : ydiv; | 538 return xdiv < ydiv ? xdiv : ydiv; |
| 539 } | 539 } |
| 540 | 540 |
| 541 return 0.0f; | 541 return 0.0f; |
| 542 } | 542 } |
| 543 | 543 |
| 544 void CPWL_Edit::SetCharArray(int32_t nCharArray) { | 544 void CPWL_Edit::SetCharArray(int32_t nCharArray) { |
| 545 if (HasFlag(PES_CHARARRAY) && nCharArray > 0) { | 545 if (HasFlag(PES_CHARARRAY) && nCharArray > 0) { |
| 546 m_pEdit->SetCharArray(nCharArray); | 546 m_pEdit->SetCharArray(nCharArray); |
| 547 m_pEdit->SetTextOverflow(TRUE, TRUE); | 547 m_pEdit->SetTextOverflow(true, true); |
| 548 | 548 |
| 549 if (HasFlag(PWS_AUTOFONTSIZE)) { | 549 if (HasFlag(PWS_AUTOFONTSIZE)) { |
| 550 if (IPVT_FontMap* pFontMap = GetFontMap()) { | 550 if (IPVT_FontMap* pFontMap = GetFontMap()) { |
| 551 FX_FLOAT fFontSize = GetCharArrayAutoFontSize( | 551 FX_FLOAT fFontSize = GetCharArrayAutoFontSize( |
| 552 pFontMap->GetPDFFont(0), GetClientRect(), nCharArray); | 552 pFontMap->GetPDFFont(0), GetClientRect(), nCharArray); |
| 553 if (fFontSize > 0.0f) { | 553 if (fFontSize > 0.0f) { |
| 554 m_pEdit->SetAutoFontSize(FALSE, TRUE); | 554 m_pEdit->SetAutoFontSize(false, true); |
| 555 m_pEdit->SetFontSize(fFontSize); | 555 m_pEdit->SetFontSize(fFontSize); |
| 556 } | 556 } |
| 557 } | 557 } |
| 558 } | 558 } |
| 559 } | 559 } |
| 560 } | 560 } |
| 561 | 561 |
| 562 void CPWL_Edit::SetLimitChar(int32_t nLimitChar) { | 562 void CPWL_Edit::SetLimitChar(int32_t nLimitChar) { |
| 563 m_pEdit->SetLimitChar(nLimitChar); | 563 m_pEdit->SetLimitChar(nLimitChar); |
| 564 } | 564 } |
| 565 | 565 |
| 566 void CPWL_Edit::ReplaceSel(const CFX_WideString& wsText) { | 566 void CPWL_Edit::ReplaceSel(const CFX_WideString& wsText) { |
| 567 m_pEdit->Clear(); | 567 m_pEdit->Clear(); |
| 568 m_pEdit->InsertText(wsText, FXFONT_DEFAULT_CHARSET); | 568 m_pEdit->InsertText(wsText, FXFONT_DEFAULT_CHARSET); |
| 569 } | 569 } |
| 570 | 570 |
| 571 CFX_FloatRect CPWL_Edit::GetFocusRect() const { | 571 CFX_FloatRect CPWL_Edit::GetFocusRect() const { |
| 572 return CFX_FloatRect(); | 572 return CFX_FloatRect(); |
| 573 } | 573 } |
| 574 | 574 |
| 575 void CPWL_Edit::ShowVScrollBar(FX_BOOL bShow) { | 575 void CPWL_Edit::ShowVScrollBar(bool bShow) { |
| 576 if (CPWL_ScrollBar* pScroll = GetVScrollBar()) { | 576 if (CPWL_ScrollBar* pScroll = GetVScrollBar()) { |
| 577 if (bShow) { | 577 if (bShow) { |
| 578 if (!pScroll->IsVisible()) { | 578 if (!pScroll->IsVisible()) { |
| 579 pScroll->SetVisible(TRUE); | 579 pScroll->SetVisible(true); |
| 580 CFX_FloatRect rcWindow = GetWindowRect(); | 580 CFX_FloatRect rcWindow = GetWindowRect(); |
| 581 m_rcOldWindow = rcWindow; | 581 m_rcOldWindow = rcWindow; |
| 582 rcWindow.right += PWL_SCROLLBAR_WIDTH; | 582 rcWindow.right += PWL_SCROLLBAR_WIDTH; |
| 583 Move(rcWindow, TRUE, TRUE); | 583 Move(rcWindow, true, true); |
| 584 } | 584 } |
| 585 } else { | 585 } else { |
| 586 if (pScroll->IsVisible()) { | 586 if (pScroll->IsVisible()) { |
| 587 pScroll->SetVisible(FALSE); | 587 pScroll->SetVisible(false); |
| 588 Move(m_rcOldWindow, TRUE, TRUE); | 588 Move(m_rcOldWindow, true, true); |
| 589 } | 589 } |
| 590 } | 590 } |
| 591 } | 591 } |
| 592 } | 592 } |
| 593 | 593 |
| 594 FX_BOOL CPWL_Edit::IsVScrollBarVisible() const { | 594 bool CPWL_Edit::IsVScrollBarVisible() const { |
| 595 if (CPWL_ScrollBar* pScroll = GetVScrollBar()) { | 595 if (CPWL_ScrollBar* pScroll = GetVScrollBar()) { |
| 596 return pScroll->IsVisible(); | 596 return pScroll->IsVisible(); |
| 597 } | 597 } |
| 598 | 598 |
| 599 return FALSE; | 599 return false; |
| 600 } | 600 } |
| 601 | 601 |
| 602 FX_BOOL CPWL_Edit::OnKeyDown(uint16_t nChar, uint32_t nFlag) { | 602 bool CPWL_Edit::OnKeyDown(uint16_t nChar, uint32_t nFlag) { |
| 603 if (m_bMouseDown) | 603 if (m_bMouseDown) |
| 604 return TRUE; | 604 return true; |
| 605 | 605 |
| 606 if (nChar == FWL_VKEY_Delete) { | 606 if (nChar == FWL_VKEY_Delete) { |
| 607 if (m_pFillerNotify) { | 607 if (m_pFillerNotify) { |
| 608 FX_BOOL bRC = TRUE; | 608 bool bRC = true; |
| 609 FX_BOOL bExit = FALSE; | 609 bool bExit = false; |
| 610 CFX_WideString strChange; | 610 CFX_WideString strChange; |
| 611 CFX_WideString strChangeEx; | 611 CFX_WideString strChangeEx; |
| 612 | 612 |
| 613 int nSelStart = 0; | 613 int nSelStart = 0; |
| 614 int nSelEnd = 0; | 614 int nSelEnd = 0; |
| 615 GetSel(nSelStart, nSelEnd); | 615 GetSel(nSelStart, nSelEnd); |
| 616 | 616 |
| 617 if (nSelStart == nSelEnd) | 617 if (nSelStart == nSelEnd) |
| 618 nSelEnd = nSelStart + 1; | 618 nSelEnd = nSelStart + 1; |
| 619 m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), strChange, | 619 m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), strChange, |
| 620 strChangeEx, nSelStart, nSelEnd, TRUE, | 620 strChangeEx, nSelStart, nSelEnd, true, |
| 621 bRC, bExit, nFlag); | 621 bRC, bExit, nFlag); |
| 622 if (!bRC) | 622 if (!bRC) |
| 623 return FALSE; | 623 return false; |
| 624 if (bExit) | 624 if (bExit) |
| 625 return FALSE; | 625 return false; |
| 626 } | 626 } |
| 627 } | 627 } |
| 628 | 628 |
| 629 FX_BOOL bRet = CPWL_EditCtrl::OnKeyDown(nChar, nFlag); | 629 bool bRet = CPWL_EditCtrl::OnKeyDown(nChar, nFlag); |
| 630 | 630 |
| 631 // In case of implementation swallow the OnKeyDown event. | 631 // In case of implementation swallow the OnKeyDown event. |
| 632 if (IsProceedtoOnChar(nChar, nFlag)) | 632 if (IsProceedtoOnChar(nChar, nFlag)) |
| 633 return TRUE; | 633 return true; |
| 634 | 634 |
| 635 return bRet; | 635 return bRet; |
| 636 } | 636 } |
| 637 | 637 |
| 638 /** | 638 /** |
| 639 *In case of implementation swallow the OnKeyDown event. | 639 *In case of implementation swallow the OnKeyDown event. |
| 640 *If the event is swallowed, implementation may do other unexpected things, which | 640 *If the event is swallowed, implementation may do other unexpected things, which |
| 641 *is not the control means to do. | 641 *is not the control means to do. |
| 642 */ | 642 */ |
| 643 FX_BOOL CPWL_Edit::IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag) { | 643 bool CPWL_Edit::IsProceedtoOnChar(uint16_t nKeyCode, uint32_t nFlag) { |
| 644 FX_BOOL bCtrl = IsCTRLpressed(nFlag); | 644 bool bCtrl = IsCTRLpressed(nFlag); |
| 645 FX_BOOL bAlt = IsALTpressed(nFlag); | 645 bool bAlt = IsALTpressed(nFlag); |
| 646 if (bCtrl && !bAlt) { | 646 if (bCtrl && !bAlt) { |
| 647 // hot keys for edit control. | 647 // hot keys for edit control. |
| 648 switch (nKeyCode) { | 648 switch (nKeyCode) { |
| 649 case 'C': | 649 case 'C': |
| 650 case 'V': | 650 case 'V': |
| 651 case 'X': | 651 case 'X': |
| 652 case 'A': | 652 case 'A': |
| 653 case 'Z': | 653 case 'Z': |
| 654 return TRUE; | 654 return true; |
| 655 default: | 655 default: |
| 656 break; | 656 break; |
| 657 } | 657 } |
| 658 } | 658 } |
| 659 // control characters. | 659 // control characters. |
| 660 switch (nKeyCode) { | 660 switch (nKeyCode) { |
| 661 case FWL_VKEY_Escape: | 661 case FWL_VKEY_Escape: |
| 662 case FWL_VKEY_Back: | 662 case FWL_VKEY_Back: |
| 663 case FWL_VKEY_Return: | 663 case FWL_VKEY_Return: |
| 664 case FWL_VKEY_Space: | 664 case FWL_VKEY_Space: |
| 665 return TRUE; | 665 return true; |
| 666 default: | 666 default: |
| 667 return FALSE; | 667 return false; |
| 668 } | 668 } |
| 669 } | 669 } |
| 670 | 670 |
| 671 FX_BOOL CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { | 671 bool CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { |
| 672 if (m_bMouseDown) | 672 if (m_bMouseDown) |
| 673 return TRUE; | 673 return true; |
| 674 | 674 |
| 675 FX_BOOL bRC = TRUE; | 675 bool bRC = true; |
| 676 FX_BOOL bExit = FALSE; | 676 bool bExit = false; |
| 677 | 677 |
| 678 if (!IsCTRLpressed(nFlag)) { | 678 if (!IsCTRLpressed(nFlag)) { |
| 679 if (m_pFillerNotify) { | 679 if (m_pFillerNotify) { |
| 680 CFX_WideString swChange; | 680 CFX_WideString swChange; |
| 681 | 681 |
| 682 int nSelStart = 0; | 682 int nSelStart = 0; |
| 683 int nSelEnd = 0; | 683 int nSelEnd = 0; |
| 684 GetSel(nSelStart, nSelEnd); | 684 GetSel(nSelStart, nSelEnd); |
| 685 | 685 |
| 686 switch (nChar) { | 686 switch (nChar) { |
| 687 case FWL_VKEY_Back: | 687 case FWL_VKEY_Back: |
| 688 if (nSelStart == nSelEnd) | 688 if (nSelStart == nSelEnd) |
| 689 nSelStart = nSelEnd - 1; | 689 nSelStart = nSelEnd - 1; |
| 690 break; | 690 break; |
| 691 case FWL_VKEY_Return: | 691 case FWL_VKEY_Return: |
| 692 break; | 692 break; |
| 693 default: | 693 default: |
| 694 swChange += nChar; | 694 swChange += nChar; |
| 695 break; | 695 break; |
| 696 } | 696 } |
| 697 | 697 |
| 698 CFX_WideString strChangeEx; | 698 CFX_WideString strChangeEx; |
| 699 m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swChange, | 699 m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swChange, |
| 700 strChangeEx, nSelStart, nSelEnd, TRUE, | 700 strChangeEx, nSelStart, nSelEnd, true, |
| 701 bRC, bExit, nFlag); | 701 bRC, bExit, nFlag); |
| 702 } | 702 } |
| 703 } | 703 } |
| 704 | 704 |
| 705 if (!bRC) | 705 if (!bRC) |
| 706 return TRUE; | 706 return true; |
| 707 if (bExit) | 707 if (bExit) |
| 708 return FALSE; | 708 return false; |
| 709 | 709 |
| 710 if (IPVT_FontMap* pFontMap = GetFontMap()) { | 710 if (IPVT_FontMap* pFontMap = GetFontMap()) { |
| 711 int32_t nOldCharSet = GetCharSet(); | 711 int32_t nOldCharSet = GetCharSet(); |
| 712 int32_t nNewCharSet = | 712 int32_t nNewCharSet = |
| 713 pFontMap->CharSetFromUnicode(nChar, FXFONT_DEFAULT_CHARSET); | 713 pFontMap->CharSetFromUnicode(nChar, FXFONT_DEFAULT_CHARSET); |
| 714 if (nOldCharSet != nNewCharSet) { | 714 if (nOldCharSet != nNewCharSet) { |
| 715 SetCharSet(nNewCharSet); | 715 SetCharSet(nNewCharSet); |
| 716 } | 716 } |
| 717 } | 717 } |
| 718 | 718 |
| 719 return CPWL_EditCtrl::OnChar(nChar, nFlag); | 719 return CPWL_EditCtrl::OnChar(nChar, nFlag); |
| 720 } | 720 } |
| 721 | 721 |
| 722 FX_BOOL CPWL_Edit::OnMouseWheel(short zDelta, | 722 bool CPWL_Edit::OnMouseWheel(short zDelta, |
| 723 const CFX_FloatPoint& point, | 723 const CFX_FloatPoint& point, |
| 724 uint32_t nFlag) { | 724 uint32_t nFlag) { |
| 725 if (HasFlag(PES_MULTILINE)) { | 725 if (HasFlag(PES_MULTILINE)) { |
| 726 CFX_FloatPoint ptScroll = GetScrollPos(); | 726 CFX_FloatPoint ptScroll = GetScrollPos(); |
| 727 | 727 |
| 728 if (zDelta > 0) { | 728 if (zDelta > 0) { |
| 729 ptScroll.y += GetFontSize(); | 729 ptScroll.y += GetFontSize(); |
| 730 } else { | 730 } else { |
| 731 ptScroll.y -= GetFontSize(); | 731 ptScroll.y -= GetFontSize(); |
| 732 } | 732 } |
| 733 SetScrollPos(ptScroll); | 733 SetScrollPos(ptScroll); |
| 734 | 734 |
| 735 return TRUE; | 735 return true; |
| 736 } | 736 } |
| 737 | 737 |
| 738 return FALSE; | 738 return false; |
| 739 } | 739 } |
| 740 | 740 |
| 741 void CPWL_Edit::OnInsertReturn(const CPVT_WordPlace& place, | 741 void CPWL_Edit::OnInsertReturn(const CPVT_WordPlace& place, |
| 742 const CPVT_WordPlace& oldplace) { | 742 const CPVT_WordPlace& oldplace) { |
| 743 if (HasFlag(PES_SPELLCHECK)) { | 743 if (HasFlag(PES_SPELLCHECK)) { |
| 744 m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace), | 744 m_pEdit->RefreshWordRange(CombineWordRange(GetLatinWordsRange(oldplace), |
| 745 GetLatinWordsRange(place))); | 745 GetLatinWordsRange(place))); |
| 746 } | 746 } |
| 747 } | 747 } |
| 748 | 748 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 800 wrRet.EndPos = wr2.EndPos; | 800 wrRet.EndPos = wr2.EndPos; |
| 801 } else { | 801 } else { |
| 802 wrRet.EndPos = wr1.EndPos; | 802 wrRet.EndPos = wr1.EndPos; |
| 803 } | 803 } |
| 804 | 804 |
| 805 return wrRet; | 805 return wrRet; |
| 806 } | 806 } |
| 807 | 807 |
| 808 CPVT_WordRange CPWL_Edit::GetLatinWordsRange( | 808 CPVT_WordRange CPWL_Edit::GetLatinWordsRange( |
| 809 const CFX_FloatPoint& point) const { | 809 const CFX_FloatPoint& point) const { |
| 810 return GetSameWordsRange(m_pEdit->SearchWordPlace(point), TRUE, FALSE); | 810 return GetSameWordsRange(m_pEdit->SearchWordPlace(point), true, false); |
| 811 } | 811 } |
| 812 | 812 |
| 813 CPVT_WordRange CPWL_Edit::GetLatinWordsRange( | 813 CPVT_WordRange CPWL_Edit::GetLatinWordsRange( |
| 814 const CPVT_WordPlace& place) const { | 814 const CPVT_WordPlace& place) const { |
| 815 return GetSameWordsRange(place, TRUE, FALSE); | 815 return GetSameWordsRange(place, true, false); |
| 816 } | 816 } |
| 817 | 817 |
| 818 CPVT_WordRange CPWL_Edit::GetArabicWordsRange( | 818 CPVT_WordRange CPWL_Edit::GetArabicWordsRange( |
| 819 const CPVT_WordPlace& place) const { | 819 const CPVT_WordPlace& place) const { |
| 820 return GetSameWordsRange(place, FALSE, TRUE); | 820 return GetSameWordsRange(place, false, true); |
| 821 } | 821 } |
| 822 | 822 |
| 823 #define PWL_ISARABICWORD(word) \ | 823 #define PWL_ISARABICWORD(word) \ |
| 824 ((word >= 0x0600 && word <= 0x06FF) || (word >= 0xFB50 && word <= 0xFEFC)) | 824 ((word >= 0x0600 && word <= 0x06FF) || (word >= 0xFB50 && word <= 0xFEFC)) |
| 825 | 825 |
| 826 CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace& place, | 826 CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace& place, |
| 827 FX_BOOL bLatin, | 827 bool bLatin, |
| 828 FX_BOOL bArabic) const { | 828 bool bArabic) const { |
| 829 CPVT_WordRange range; | 829 CPVT_WordRange range; |
| 830 | 830 |
| 831 CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); | 831 CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); |
| 832 CPVT_Word wordinfo; | 832 CPVT_Word wordinfo; |
| 833 CPVT_WordPlace wpStart(place), wpEnd(place); | 833 CPVT_WordPlace wpStart(place), wpEnd(place); |
| 834 pIterator->SetAt(place); | 834 pIterator->SetAt(place); |
| 835 | 835 |
| 836 if (bLatin) { | 836 if (bLatin) { |
| 837 while (pIterator->NextWord()) { | 837 while (pIterator->NextWord()) { |
| 838 if (!pIterator->GetWord(wordinfo) || | 838 if (!pIterator->GetWord(wordinfo) || |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 } | 886 } |
| 887 | 887 |
| 888 void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, | 888 void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, |
| 889 const CFX_FloatPoint& ptOffset) { | 889 const CFX_FloatPoint& ptOffset) { |
| 890 CFX_ArrayTemplate<CPDF_TextObject*> ObjArray; | 890 CFX_ArrayTemplate<CPDF_TextObject*> ObjArray; |
| 891 CFX_Edit::GeneratePageObjects( | 891 CFX_Edit::GeneratePageObjects( |
| 892 pObjectHolder, m_pEdit.get(), ptOffset, nullptr, | 892 pObjectHolder, m_pEdit.get(), ptOffset, nullptr, |
| 893 CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), | 893 CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), |
| 894 ObjArray); | 894 ObjArray); |
| 895 } | 895 } |
| OLD | NEW |