OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fee/fde_txtedtengine.h" | 7 #include "xfa/fee/fde_txtedtengine.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 56 } |
57 RemoveAllParags(); | 57 RemoveAllParags(); |
58 RemoveAllPages(); | 58 RemoveAllPages(); |
59 m_Param.pEventSink = NULL; | 59 m_Param.pEventSink = NULL; |
60 ClearSelection(); | 60 ClearSelection(); |
61 } | 61 } |
62 void CFDE_TxtEdtEngine::Release() { | 62 void CFDE_TxtEdtEngine::Release() { |
63 delete this; | 63 delete this; |
64 } | 64 } |
65 void CFDE_TxtEdtEngine::SetEditParams(const FDE_TXTEDTPARAMS& params) { | 65 void CFDE_TxtEdtEngine::SetEditParams(const FDE_TXTEDTPARAMS& params) { |
66 if (m_pTextBreak == NULL) { | 66 if (!m_pTextBreak) |
67 m_pTextBreak = IFX_TxtBreak::Create(FX_TXTBREAKPOLICY_None); | 67 m_pTextBreak = new CFX_TxtBreak(FX_TXTBREAKPOLICY_None); |
68 } | 68 |
69 FXSYS_memcpy(&m_Param, ¶ms, sizeof(FDE_TXTEDTPARAMS)); | 69 FXSYS_memcpy(&m_Param, ¶ms, sizeof(FDE_TXTEDTPARAMS)); |
70 m_wLineEnd = params.wLineBreakChar; | 70 m_wLineEnd = params.wLineBreakChar; |
71 m_bAutoLineEnd = (m_Param.nLineEnd == FDE_TXTEDIT_LINEEND_Auto); | 71 m_bAutoLineEnd = (m_Param.nLineEnd == FDE_TXTEDIT_LINEEND_Auto); |
72 UpdateTxtBreak(); | 72 UpdateTxtBreak(); |
73 } | 73 } |
74 const FDE_TXTEDTPARAMS* CFDE_TxtEdtEngine::GetEditParams() const { | 74 const FDE_TXTEDTPARAMS* CFDE_TxtEdtEngine::GetEditParams() const { |
75 return &m_Param; | 75 return &m_Param; |
76 } | 76 } |
77 int32_t CFDE_TxtEdtEngine::CountPages() const { | 77 int32_t CFDE_TxtEdtEngine::CountPages() const { |
78 if (m_nLineCount == 0) { | 78 if (m_nLineCount == 0) { |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 } | 714 } |
715 FX_BOOL CFDE_TxtEdtEngine::Optimize(IFX_Pause* pPause) { | 715 FX_BOOL CFDE_TxtEdtEngine::Optimize(IFX_Pause* pPause) { |
716 return m_pTxtBuf->Optimize(pPause); | 716 return m_pTxtBuf->Optimize(pPause); |
717 } | 717 } |
718 IFDE_TxtEdtBuf* CFDE_TxtEdtEngine::GetTextBuf() const { | 718 IFDE_TxtEdtBuf* CFDE_TxtEdtEngine::GetTextBuf() const { |
719 return (IFDE_TxtEdtBuf*)m_pTxtBuf; | 719 return (IFDE_TxtEdtBuf*)m_pTxtBuf; |
720 } | 720 } |
721 int32_t CFDE_TxtEdtEngine::GetTextBufLength() const { | 721 int32_t CFDE_TxtEdtEngine::GetTextBufLength() const { |
722 return m_pTxtBuf->GetTextLength() - 1; | 722 return m_pTxtBuf->GetTextLength() - 1; |
723 } | 723 } |
724 IFX_TxtBreak* CFDE_TxtEdtEngine::GetTextBreak() const { | 724 CFX_TxtBreak* CFDE_TxtEdtEngine::GetTextBreak() const { |
725 return m_pTextBreak; | 725 return m_pTextBreak; |
726 } | 726 } |
727 int32_t CFDE_TxtEdtEngine::GetLineCount() const { | 727 int32_t CFDE_TxtEdtEngine::GetLineCount() const { |
728 return m_nLineCount; | 728 return m_nLineCount; |
729 } | 729 } |
730 int32_t CFDE_TxtEdtEngine::GetPageLineCount() const { | 730 int32_t CFDE_TxtEdtEngine::GetPageLineCount() const { |
731 return m_nPageLineCount; | 731 return m_nPageLineCount; |
732 } | 732 } |
733 int32_t CFDE_TxtEdtEngine::CountParags() const { | 733 int32_t CFDE_TxtEdtEngine::CountParags() const { |
734 return m_ParagPtrArray.GetSize(); | 734 return m_ParagPtrArray.GetSize(); |
(...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1776 int32_t nEngine = 0; | 1776 int32_t nEngine = 0; |
1777 ArchiveLoader >> nEngine; | 1777 ArchiveLoader >> nEngine; |
1778 m_pEngine = (CFDE_TxtEdtEngine*)(uintptr_t)nEngine; | 1778 m_pEngine = (CFDE_TxtEdtEngine*)(uintptr_t)nEngine; |
1779 int32_t iSel = 0; | 1779 int32_t iSel = 0; |
1780 ArchiveLoader >> iSel; | 1780 ArchiveLoader >> iSel; |
1781 m_bSel = !!iSel; | 1781 m_bSel = !!iSel; |
1782 ArchiveLoader >> m_nIndex; | 1782 ArchiveLoader >> m_nIndex; |
1783 ArchiveLoader >> m_nCaret; | 1783 ArchiveLoader >> m_nCaret; |
1784 ArchiveLoader >> m_wsRange; | 1784 ArchiveLoader >> m_wsRange; |
1785 } | 1785 } |
OLD | NEW |